Add controldb_name GUC

pull/7254/head
EmelSimsek 2023-10-13 12:33:15 +03:00 committed by Emel Şimşek
parent 0ba47298a7
commit 67d6246821
3 changed files with 19 additions and 1 deletions

View File

@ -1023,6 +1023,16 @@ RegisterCitusConfigVariables(void)
GUC_STANDARD,
NULL, NULL, NULL);
DefineCustomStringVariable(
"citus.controldb_name",
gettext_noop("Which database is designated as the controldb"),
NULL,
&ControlDbName,
"",
PGC_SU_BACKEND,
GUC_STANDARD,
NULL, NULL, NULL);
DefineCustomEnumVariable(
"citus.coordinator_aggregation_strategy",
gettext_noop("Sets the strategy for when an aggregate cannot be pushed down. "

View File

@ -99,6 +99,7 @@ int Recover2PCInterval = 60000;
int DeferShardDeleteInterval = 15000;
int BackgroundTaskQueueCheckInterval = 5000;
int MaxBackgroundTaskExecutors = 4;
char *ControlDbName = "";
/* config variables for metadata sync timeout */
int MetadataSyncInterval = 60000;
@ -146,6 +147,12 @@ InitializeMaintenanceDaemon(void)
void
InitializeMaintenanceDaemonForAdminDB(void)
{
if (strcmp(ControlDbName, "") == 0)
{
elog(LOG, "There is no designated control database.");
return;
}
BackgroundWorker worker;
memset(&worker, 0, sizeof(worker));
@ -335,7 +342,7 @@ CitusMaintenanceDaemonMain(Datum main_arg)
if (databaseOid == 0)
{
/* TODO : Get the admin database name from GUC contro_db*/
char *databaseName = "postgres";
char *databaseName = ControlDbName;
BackgroundWorkerInitializeConnection(databaseName, NULL, 0);

View File

@ -20,6 +20,7 @@
/* config variable for */
extern double DistributedDeadlockDetectionTimeoutFactor;
extern char *ControlDbName;
extern void StopMaintenanceDaemon(Oid databaseId);
extern void TriggerNodeMetadataSync(Oid databaseId);