mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-07 11:32:47 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Refactor ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? No ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) ### Description Split up GUCs by intent: - Testing GUCs - only for backend or test infra - System GUCs - configuration of the system as a whole - Background GUCs - configuration for background jobs - Feature flag GUCs - GUCs that are transient and we should track enabling and removing them ---- #### AI description (iteration 1) #### PR Classification Code cleanup #### PR Summary This pull request refactors the codebase by splitting up GUC (Grand Unified Configuration) files based on their intent, improving modularity and maintainability. - Refactored `documentdb_init.c` to delegate GUC initialization to specific functions. - Added new files `feature_flag_configs.c`, `system_configs.c`, `background_job_configs.c`, and `testing_configs.c` for modular GUC initialization. - Updated `config_initialization.h` to declare new initialization functions. - Adjusted related configurations in `documentdb_distributed_init.c` and test files to align with the new structure.
60 lines
2.0 KiB
C
60 lines
2.0 KiB
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* src/documentdb_distributed_init.c
|
|
*
|
|
* Initialization of the shared library initialization for distribution for Hleio API.
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#include <postgres.h>
|
|
#include <miscadmin.h>
|
|
#include <utils/guc.h>
|
|
|
|
#include "documentdb_distributed_init.h"
|
|
|
|
|
|
/* --------------------------------------------------------- */
|
|
/* GUCs and default values */
|
|
/* --------------------------------------------------------- */
|
|
|
|
#define DEFAULT_ENABLE_METADATA_REFERENCE_SYNC true
|
|
bool EnableMetadataReferenceTableSync = DEFAULT_ENABLE_METADATA_REFERENCE_SYNC;
|
|
|
|
#define DEFAULT_ENABLE_SHARD_REBALANCER false
|
|
bool EnableShardRebalancer = DEFAULT_ENABLE_SHARD_REBALANCER;
|
|
|
|
#define DEFAULT_CLUSTER_ADMIN_ROLE ""
|
|
char *ClusterAdminRole = DEFAULT_CLUSTER_ADMIN_ROLE;
|
|
|
|
/* --------------------------------------------------------- */
|
|
/* Top level exports */
|
|
/* --------------------------------------------------------- */
|
|
|
|
/*
|
|
* Initializes core configurations pertaining to documentdb distributed.
|
|
*/
|
|
void
|
|
InitDocumentDBDistributedConfigurations(const char *prefix)
|
|
{
|
|
DefineCustomBoolVariable(
|
|
psprintf("%s.enable_metadata_reference_table_sync", prefix),
|
|
gettext_noop(
|
|
"Determines whether or not to enable metadata reference table syncs."),
|
|
NULL, &EnableMetadataReferenceTableSync, DEFAULT_ENABLE_METADATA_REFERENCE_SYNC,
|
|
PGC_USERSET, 0, NULL, NULL, NULL);
|
|
|
|
DefineCustomBoolVariable(
|
|
psprintf("%s.enable_shard_rebalancer_apis", prefix),
|
|
gettext_noop(
|
|
"Determines whether or not to enable shard rebalancer APIs."),
|
|
NULL, &EnableShardRebalancer, DEFAULT_ENABLE_SHARD_REBALANCER,
|
|
PGC_USERSET, 0, NULL, NULL, NULL);
|
|
|
|
DefineCustomStringVariable(
|
|
psprintf("%s.clusterAdminRole", prefix),
|
|
gettext_noop(
|
|
"The cluster admin role."),
|
|
NULL, &ClusterAdminRole, DEFAULT_CLUSTER_ADMIN_ROLE,
|
|
PGC_USERSET, 0, NULL, NULL, NULL);
|
|
}
|