From 083008c21ebab3833315179cc6045f0dae862999 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Mon, 22 Jan 2024 23:55:30 -0800 Subject: [PATCH] Added validation for GUC parameters --- CHANGELOG.md | 1 + src/hnsw.c | 6 ++++++ src/ivfflat.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5ad068..4e9ccd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Improved performance of HNSW - Added support for parallel index builds for HNSW +- Added validation for GUC parameters - Reduced memory usage for HNSW index builds - Reduced WAL generation for HNSW index builds - Fixed error with logical replication diff --git a/src/hnsw.c b/src/hnsw.c index 84df1d2..f5e1247 100644 --- a/src/hnsw.c +++ b/src/hnsw.c @@ -10,6 +10,10 @@ #include "utils/guc.h" #include "utils/selfuncs.h" +#if PG_VERSION_NUM < 150000 +#define MarkGUCPrefixReserved(x) EmitWarningsOnPlaceholders(x) +#endif + int hnsw_ef_search; int hnsw_lock_tranche_id; static relopt_kind hnsw_relopt_kind; @@ -67,6 +71,8 @@ HnswInit(void) DefineCustomIntVariable("hnsw.ef_search", "Sets the size of the dynamic candidate list for search", "Valid range is 1..1000.", &hnsw_ef_search, HNSW_DEFAULT_EF_SEARCH, HNSW_MIN_EF_SEARCH, HNSW_MAX_EF_SEARCH, PGC_USERSET, 0, NULL, NULL, NULL); + + MarkGUCPrefixReserved("hnsw"); } /* diff --git a/src/ivfflat.c b/src/ivfflat.c index f1f53ea..7545571 100644 --- a/src/ivfflat.c +++ b/src/ivfflat.c @@ -10,6 +10,10 @@ #include "utils/selfuncs.h" #include "utils/spccache.h" +#if PG_VERSION_NUM < 150000 +#define MarkGUCPrefixReserved(x) EmitWarningsOnPlaceholders(x) +#endif + int ivfflat_probes; static relopt_kind ivfflat_relopt_kind; @@ -30,6 +34,8 @@ IvfflatInit(void) DefineCustomIntVariable("ivfflat.probes", "Sets the number of probes", "Valid range is 1..lists.", &ivfflat_probes, IVFFLAT_DEFAULT_PROBES, IVFFLAT_MIN_LISTS, IVFFLAT_MAX_LISTS, PGC_USERSET, 0, NULL, NULL, NULL); + + MarkGUCPrefixReserved("ivfflat"); } /*