From fbe472828739e9ecb5578cc7ad55385fdda3f026 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Fri, 18 Sep 2020 09:19:41 -0700 Subject: [PATCH] use GUCs --- cstore.c | 5 +++++ cstore.h | 5 ----- cstore_fdw.c | 6 +++--- cstore_tableam.c | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cstore.c b/cstore.c index 94fc401a1..507d58463 100644 --- a/cstore.c +++ b/cstore.c @@ -22,6 +22,11 @@ #include "cstore.h" +/* Default values for option parameters */ +#define DEFAULT_COMPRESSION_TYPE COMPRESSION_NONE +#define DEFAULT_STRIPE_ROW_COUNT 150000 +#define DEFAULT_BLOCK_ROW_COUNT 10000 + int cstore_compression = DEFAULT_COMPRESSION_TYPE; int cstore_stripe_row_count = DEFAULT_STRIPE_ROW_COUNT; int cstore_block_row_count = DEFAULT_BLOCK_ROW_COUNT; diff --git a/cstore.h b/cstore.h index cbd60fca1..ad0ad20bd 100644 --- a/cstore.h +++ b/cstore.h @@ -24,11 +24,6 @@ #define OPTION_NAME_STRIPE_ROW_COUNT "stripe_row_count" #define OPTION_NAME_BLOCK_ROW_COUNT "block_row_count" -/* Default values for option parameters */ -#define DEFAULT_COMPRESSION_TYPE COMPRESSION_NONE -#define DEFAULT_STRIPE_ROW_COUNT 150000 -#define DEFAULT_BLOCK_ROW_COUNT 10000 - /* Limits for option parameters */ #define STRIPE_ROW_COUNT_MINIMUM 1000 #define STRIPE_ROW_COUNT_MAXIMUM 10000000 diff --git a/cstore_fdw.c b/cstore_fdw.c index 512dee5a3..a66ba1d80 100644 --- a/cstore_fdw.c +++ b/cstore_fdw.c @@ -1260,9 +1260,9 @@ static CStoreOptions * CStoreGetOptions(Oid foreignTableId) { CStoreOptions *cstoreOptions = NULL; - CompressionType compressionType = DEFAULT_COMPRESSION_TYPE; - int32 stripeRowCount = DEFAULT_STRIPE_ROW_COUNT; - int32 blockRowCount = DEFAULT_BLOCK_ROW_COUNT; + CompressionType compressionType = cstore_compression; + int32 stripeRowCount = cstore_stripe_row_count; + int32 blockRowCount = cstore_block_row_count; char *compressionTypeString = NULL; char *stripeRowCountString = NULL; char *blockRowCountString = NULL; diff --git a/cstore_tableam.c b/cstore_tableam.c index 204746aa0..95630c3e1 100644 --- a/cstore_tableam.c +++ b/cstore_tableam.c @@ -47,12 +47,12 @@ static ExecutorEnd_hook_type PreviousExecutorEndHook = NULL; static MemoryContext CStoreContext = NULL; static CStoreOptions * -CStoreGetDefaultOptions(void) +CStoreTableAMGetOptions(void) { CStoreOptions *cstoreOptions = palloc0(sizeof(CStoreOptions)); - cstoreOptions->compressionType = DEFAULT_COMPRESSION_TYPE; - cstoreOptions->stripeRowCount = DEFAULT_STRIPE_ROW_COUNT; - cstoreOptions->blockRowCount = DEFAULT_BLOCK_ROW_COUNT; + cstoreOptions->compressionType = cstore_compression; + cstoreOptions->stripeRowCount = cstore_stripe_row_count; + cstoreOptions->blockRowCount = cstore_block_row_count; return cstoreOptions; } @@ -71,7 +71,7 @@ cstore_init_write_state(Relation relation) if (CStoreWriteState == NULL) { - CStoreOptions *cstoreOptions = CStoreGetDefaultOptions(); + CStoreOptions *cstoreOptions = CStoreTableAMGetOptions(); TupleDesc tupdesc = RelationGetDescr(relation); MemoryContext oldContext; @@ -128,7 +128,7 @@ cstore_beginscan(Relation relation, Snapshot snapshot, CStoreScanDesc scan = palloc(sizeof(CStoreScanDescData)); List *columnList = NIL; - cstoreOptions = CStoreGetDefaultOptions(); + cstoreOptions = CStoreTableAMGetOptions(); scan->cs_base.rs_rd = relation; scan->cs_base.rs_snapshot = snapshot; @@ -419,7 +419,7 @@ cstore_relation_set_new_filenode(Relation rel, *freezeXid = RecentXmin; *minmulti = GetOldestMultiXactId(); srel = RelationCreateStorage(*newrnode, persistence); - InitializeCStoreTableFile(rel->rd_id, rel, CStoreGetDefaultOptions()); + InitializeCStoreTableFile(rel->rd_id, rel, CStoreTableAMGetOptions()); smgrclose(srel); }