/* * Module initialize function: initialize info about Bloom relation options. * * Note: keep this in sync with makeDefaultBloomOptions(). */ void _PG_init(void) { int i; char buf[16]; bl_relopt_kind = add_reloption_kind(); /* Option for length of signature */ add_int_reloption(bl_relopt_kind, "length", "Length of signature in bits", DEFAULT_BLOOM_LENGTH, 1, MAX_BLOOM_LENGTH); bl_relopt_tab[0].optname = "length"; bl_relopt_tab[0].opttype = RELOPT_TYPE_INT; bl_relopt_tab[0].offset = offsetof(BloomOptions, bloomLength); /* Number of bits for each possible index column: col1, col2, ... */ for (i = 0; i < INDEX_MAX_KEYS; i++) { snprintf(buf, sizeof(buf), "col%d", i + 1); add_int_reloption(bl_relopt_kind, buf, "Number of bits generated for each index column", DEFAULT_BLOOM_BITS, 1, MAX_BLOOM_BITS); bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext, buf); bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT; bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) + sizeof(int) * i; } }
/* * Module initialize function: initilized relation options. */ void _MDB_init(void) { int i; char buf[16]; bl_relopt_kind = add_reloption_kind(); add_int_reloption(bl_relopt_kind, "length", "Length of signature in uint16 type", 5, 1, 256); for (i = 0; i < INDEX_MAX_KEYS; i++) { snprintf(buf, 16, "col%d", i + 1); add_int_reloption(bl_relopt_kind, buf, "Number of bits for corresponding column", 2, 1, 2048); } }
void zdb_index_init(void) { RELOPT_KIND_ZDB = add_reloption_kind(); add_string_reloption(RELOPT_KIND_ZDB, "url", "Server URL and port", NULL, validate_url); add_string_reloption(RELOPT_KIND_ZDB, "shadow", "A zombodb index to which this one should shadow", NULL, validate_shadow); add_string_reloption(RELOPT_KIND_ZDB, "options", "Comma-separated list of options to pass to underlying index", NULL, validate_options); add_string_reloption(RELOPT_KIND_ZDB, "preference", "The ?preference value used to Elasticsearch", NULL, validate_preference); add_string_reloption(RELOPT_KIND_ZDB, "refresh_interval", "Frequency in which Elasticsearch indexes are refreshed. Related to ES' index.refresh_interval setting", "-1", validate_refresh_interval); add_int_reloption(RELOPT_KIND_ZDB, "shards", "The number of shared for the index", 5, 1, ZDB_MAX_SHARDS); add_int_reloption(RELOPT_KIND_ZDB, "replicas", "The default number of replicas for the index", 1, 0, ZDB_MAX_REPLICAS); add_int_reloption(RELOPT_KIND_ZDB, "bulk_concurrency", "The maximum number of concurrent _bulk API requests", 12, 1, ZDB_MAX_BULK_CONCURRENCY); add_int_reloption(RELOPT_KIND_ZDB, "batch_size", "The size in bytes of batch calls to the _bulk API", 1024 * 1024 * 8, 1024, (INT32_MAX/2)-1); add_string_reloption(RELOPT_KIND_ZDB, "field_lists", "field=[field1, field2, field3], other=[field4,field5]", NULL, validate_field_lists); add_bool_reloption(RELOPT_KIND_ZDB, "ignore_visibility", "Should queries that require visibility information actually use it?", false); add_bool_reloption(RELOPT_KIND_ZDB, "always_resolve_joins", "Should queries that link to other indexes always resolve the links", false); DefineCustomBoolVariable("zombodb.batch_mode", "Batch INSERT/UPDATE/COPY changes until transaction commit", NULL, &zdb_batch_mode_guc, false, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable("zombodb.ignore_visibility", "If true, visibility information will be ignored for all queries", NULL, &zdb_ignore_visibility_guc, false, PGC_USERSET, 0, NULL, NULL, NULL); }
/* * initialize_reloptions_gp * initialization routine for GPDB reloptions * * We use the add_*_option interface in reloptions.h to add GPDB-specific options. */ void initialize_reloptions_gp(void) { int i; static bool initialized = false; /* only add these on first call. */ if (initialized) return; initialized = true; /* Set GPDB specific options */ for (i = 0; boolRelOpts_gp[i].gen.name; i++) { add_bool_reloption(boolRelOpts_gp[i].gen.kinds, (char *) boolRelOpts_gp[i].gen.name, (char *) boolRelOpts_gp[i].gen.desc, boolRelOpts_gp[i].default_val); } for (i = 0; intRelOpts_gp[i].gen.name; i++) { add_int_reloption(intRelOpts_gp[i].gen.kinds, (char *) intRelOpts_gp[i].gen.name, (char *) intRelOpts_gp[i].gen.desc, intRelOpts_gp[i].default_val, intRelOpts_gp[i].min, intRelOpts_gp[i].max); } for (i = 0; realRelOpts_gp[i].gen.name; i++) { add_real_reloption(realRelOpts_gp[i].gen.kinds, (char *) realRelOpts_gp[i].gen.name, (char *) realRelOpts_gp[i].gen.desc, realRelOpts_gp[i].default_val, realRelOpts_gp[i].min, realRelOpts_gp[i].max); } for (i = 0; stringRelOpts_gp[i].gen.name; i++) { add_string_reloption(stringRelOpts_gp[i].gen.kinds, (char *) stringRelOpts_gp[i].gen.name, (char *) stringRelOpts_gp[i].gen.desc, NULL, stringRelOpts_gp[i].validate_cb); } }