Introduce new GUC

pull/7286/head
ivyazmitinov 2023-10-18 16:18:11 +07:00
parent 19681ca592
commit 5880ecc680
5 changed files with 33 additions and 5 deletions

View File

@ -672,7 +672,7 @@ SharedConnectionStatsShmemSize(void)
size = add_size(size, workerNodeConnHashSize);
Size workerNodeDatabaseConnSize = hash_estimate_size(DatabasesPerWorker,
Size workerNodeDatabaseConnSize = hash_estimate_size(MaxWorkerNodesTracked * MaxDatabasesPerWorkerNodesTracked,
sizeof(SharedWorkerNodeDatabaseConnStatsHashEntry));
size = add_size(size, workerNodeDatabaseConnSize);
@ -741,7 +741,7 @@ SharedConnectionStatsShmemInit(void)
sharedWorkerNodeDatabaseConnStatsHashInfo.hash = SharedWorkerNodeDatabaseHashHash;
sharedWorkerNodeDatabaseConnStatsHashInfo.match = SharedWorkerNodeDatabaseHashCompare;
int sharedWorkerNodeDatabaseConnStatsHashSize = MaxWorkerNodesTracked * DatabasesPerWorker;
int sharedWorkerNodeDatabaseConnStatsHashSize = MaxWorkerNodesTracked * MaxDatabasesPerWorkerNodesTracked;
SharedWorkerNodeDatabaseConnStatsHash =
ShmemInitHash("Shared Conn Per Database. Stats Hash",
sharedWorkerNodeDatabaseConnStatsHashSize,

View File

@ -39,7 +39,7 @@
/* Config variables managed via guc.c */
char *WorkerListFileName;
int MaxWorkerNodesTracked = 2048; /* determines worker node hash table size */
int DatabasesPerWorker = 1; /* determine database per worker hash table size */
int MaxDatabasesPerWorkerNodesTracked = 1; /* determine database per worker hash table size */
/* Local functions forward declarations */

View File

@ -1993,6 +1993,20 @@ RegisterCitusConfigVariables(void)
GUC_SUPERUSER_ONLY,
NULL, NULL, MaxSharedPoolSizeGucShowHook);
DefineCustomRealVariable(
"citus.shared_pool_size_maintenance_quota",
gettext_noop("Sets the maximum number of connections allowed per worker node "
"across all the backends from this node. Setting to -1 disables "
"connections throttling. Setting to 0 makes it auto-adjust, meaning "
"equal to max_connections on the coordinator."),
gettext_noop("As a rule of thumb, the value should be at most equal to the "
"max_connections on the remote nodes."),
&SharedPoolSizeMaintenanceQuota,
0.1, 0, 1,
PGC_SIGHUP,
GUC_SUPERUSER_ONLY,
NULL, NULL, MaxSharedPoolSizeGucShowHook);
DefineCustomIntVariable(
"citus.max_worker_nodes_tracked",
gettext_noop("Sets the maximum number of worker nodes that are tracked."),
@ -2012,6 +2026,20 @@ RegisterCitusConfigVariables(void)
GUC_STANDARD,
NULL, NULL, NULL);
DefineCustomIntVariable(
"citus.max_databases_per_worker_tracked",
gettext_noop("Sets the amount of databases per worker tracked."),
gettext_noop(
"This configuration value compliments the citus.max_worker_nodes_tracked."
"It should be used when there are more then one database with Citus in cluster,"
"and, effectively, limits the size of the hash table with connections per worker + database."
"Currently, it does not affect the connection management logic and serves only statistical purposes."),
&MaxDatabasesPerWorkerNodesTracked,
1, 1, INT_MAX,
PGC_POSTMASTER,
GUC_STANDARD,
NULL, NULL, NULL);
DefineCustomIntVariable(
"citus.metadata_sync_interval",
gettext_noop("Sets the time to wait between metadata syncs."),

View File

@ -25,7 +25,7 @@ enum SharedPoolCounterMode
};
extern int MaxSharedPoolSize;
extern float MaintenanceSharedPoolSizePercent;
extern double SharedPoolSizeMaintenanceQuota;
extern int LocalSharedPoolSize;
extern int MaxClientConnections;

View File

@ -59,7 +59,7 @@ typedef struct WorkerNode
/* Config variables managed via guc.c */
extern int MaxWorkerNodesTracked;
extern int DatabasesPerWorker;
extern int MaxDatabasesPerWorkerNodesTracked;
extern char *WorkerListFileName;
extern char *CurrentCluster;