diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index 78e278a4e..8700345fb 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -44,6 +44,7 @@ #include "distributed/relation_access_tracking.h" #include "distributed/run_from_same_connection.h" #include "distributed/query_pushdown_planning.h" +#include "distributed/time_constants.h" #include "distributed/query_stats.h" #include "distributed/remote_commands.h" #include "distributed/shared_library_init.h" @@ -371,9 +372,9 @@ RegisterCitusConfigVariables(void) gettext_noop("Sets the maximum duration to connect to worker nodes."), NULL, &NodeConnectionTimeout, - 5000, 10, 60 * 60 * 1000, + 5 * MS_PER_SECOND, 10 * MS, MS_PER_HOUR, PGC_USERSET, - GUC_UNIT_MS, + GUC_UNIT_MS | GUC_STANDARD, NULL, NULL, NULL); /* keeping temporarily for updates from pre-6.0 versions */ @@ -407,7 +408,7 @@ RegisterCitusConfigVariables(void) &BinaryMasterCopyFormat, false, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -419,7 +420,7 @@ RegisterCitusConfigVariables(void) &BinaryWorkerCopyFormat, false, PGC_SIGHUP, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -429,7 +430,7 @@ RegisterCitusConfigVariables(void) &ExpireCachedShards, false, PGC_SIGHUP, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -440,7 +441,7 @@ RegisterCitusConfigVariables(void) &EnableLocalExecution, true, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -498,7 +499,7 @@ RegisterCitusConfigVariables(void) &SubqueryPushdown, false, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -519,7 +520,7 @@ RegisterCitusConfigVariables(void) &LogRemoteCommands, false, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -566,7 +567,7 @@ RegisterCitusConfigVariables(void) &ExplainAllTasks, false, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -576,7 +577,7 @@ RegisterCitusConfigVariables(void) &AllModificationsCommutative, false, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomRealVariable( @@ -589,7 +590,7 @@ RegisterCitusConfigVariables(void) &DistributedDeadlockDetectionTimeoutFactor, 2.0, -1.0, 1000.0, PGC_SIGHUP, - 0, + GUC_STANDARD, ErrorIfNotASuitableDeadlockFactor, NULL, NULL); DefineCustomIntVariable( @@ -601,9 +602,9 @@ RegisterCitusConfigVariables(void) "determines how often recovery should run, " "use -1 to disable."), &Recover2PCInterval, - 60000, -1, 7 * 24 * 3600 * 1000, + 60 * MS_PER_SECOND, -1, 7 * MS_PER_DAY, PGC_SIGHUP, - GUC_UNIT_MS, + GUC_UNIT_MS | GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -613,7 +614,7 @@ RegisterCitusConfigVariables(void) "to synchronize metadata to metadata nodes " "that are out of sync."), &MetadataSyncInterval, - 60000, 1, 7 * 24 * 3600 * 1000, + 60 * MS_PER_SECOND, 1, 7 * MS_PER_DAY, PGC_SIGHUP, GUC_UNIT_MS | GUC_NO_SHOW_ALL, NULL, NULL, NULL); @@ -625,7 +626,7 @@ RegisterCitusConfigVariables(void) "to synchronize metadata to metadata nodes " "that are out of sync."), &MetadataSyncRetryInterval, - 5000, 1, 7 * 24 * 3600 * 1000, + 5 * MS_PER_SECOND, 1, 7 * MS_PER_DAY, PGC_SIGHUP, GUC_UNIT_MS | GUC_NO_SHOW_ALL, NULL, NULL, NULL); @@ -705,7 +706,7 @@ RegisterCitusConfigVariables(void) &EnableDeadlockPrevention, true, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -715,7 +716,7 @@ RegisterCitusConfigVariables(void) &EnableDDLPropagation, true, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -747,7 +748,7 @@ RegisterCitusConfigVariables(void) PROPSETCMD_NONE, propagate_set_commands_options, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -766,9 +767,9 @@ RegisterCitusConfigVariables(void) "created with create_distributed_table()."), NULL, &ShardCount, - 32, 1, 64000, + 32, 1, MAX_SHARD_COUNT, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -779,9 +780,9 @@ RegisterCitusConfigVariables(void) "configuration value at sharded table creation time, " "and later reuse the initially read value."), &ShardReplicationFactor, - 1, 1, 100, + 1, 1, MAX_SHARD_REPLICATION_FACTOR, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -796,7 +797,7 @@ RegisterCitusConfigVariables(void) &ShardMaxSize, 1048576, 256, INT_MAX, /* max allowed size not set to MAX_KILOBYTES on purpose */ PGC_USERSET, - GUC_UNIT_KB, + GUC_UNIT_KB | GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -821,7 +822,7 @@ RegisterCitusConfigVariables(void) &MaxIntermediateResult, 1048576, -1, MAX_KILOBYTES, PGC_USERSET, - GUC_UNIT_KB, + GUC_UNIT_KB | GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -839,7 +840,7 @@ RegisterCitusConfigVariables(void) &MaxAdaptiveExecutorPoolSize, 16, 1, INT_MAX, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -853,7 +854,7 @@ RegisterCitusConfigVariables(void) &MaxWorkerNodesTracked, 2048, 8, INT_MAX, PGC_POSTMASTER, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -866,7 +867,7 @@ RegisterCitusConfigVariables(void) &RemoteTaskCheckInterval, 10, 1, INT_MAX, PGC_USERSET, - GUC_UNIT_MS, + GUC_UNIT_MS | GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -878,9 +879,9 @@ RegisterCitusConfigVariables(void) "before walking over these tasks again. This configuration " "value determines the length of that sleeping period."), &TaskTrackerDelay, - 200, 1, 100000, + 200 * MS, 1, 100 * MS_PER_SECOND, PGC_SIGHUP, - GUC_UNIT_MS, + GUC_UNIT_MS | GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -894,7 +895,7 @@ RegisterCitusConfigVariables(void) &MaxCachedConnectionsPerWorker, 1, 0, INT_MAX, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -908,7 +909,7 @@ RegisterCitusConfigVariables(void) &MaxAssignTaskBatchSize, 64, 1, INT_MAX, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -922,7 +923,7 @@ RegisterCitusConfigVariables(void) &MaxTrackedTasksPerNode, 1024, 8, INT_MAX, PGC_POSTMASTER, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -935,7 +936,7 @@ RegisterCitusConfigVariables(void) &MaxRunningTasksPerNode, 8, 1, INT_MAX, PGC_SIGHUP, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -949,7 +950,7 @@ RegisterCitusConfigVariables(void) &PartitionBufferSize, 8192, 0, (INT_MAX / 1024), /* result stored in int variable */ PGC_USERSET, - GUC_UNIT_KB, + GUC_UNIT_KB | GUC_STANDARD, NULL, NULL, NULL); DefineCustomIntVariable( @@ -974,7 +975,7 @@ RegisterCitusConfigVariables(void) &LimitClauseRowFetchCount, -1, -1, INT_MAX, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomRealVariable( @@ -987,7 +988,7 @@ RegisterCitusConfigVariables(void) &CountDistinctErrorRate, 0.0, 0.0, 1.0, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomEnumVariable( @@ -1001,7 +1002,7 @@ RegisterCitusConfigVariables(void) COMMIT_PROTOCOL_2PC, shard_commit_protocol_options, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomEnumVariable( @@ -1033,7 +1034,7 @@ RegisterCitusConfigVariables(void) TASK_ASSIGNMENT_GREEDY, task_assignment_policy_options, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomEnumVariable( @@ -1064,7 +1065,7 @@ RegisterCitusConfigVariables(void) MULTI_EXECUTOR_ADAPTIVE, task_executor_type_options, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -1074,7 +1075,7 @@ RegisterCitusConfigVariables(void) &EnableRepartitionJoins, false, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomEnumVariable( @@ -1090,7 +1091,7 @@ RegisterCitusConfigVariables(void) &ShardPlacementPolicy, SHARD_PLACEMENT_ROUND_ROBIN, shard_placement_policy_options, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomEnumVariable( @@ -1100,7 +1101,7 @@ RegisterCitusConfigVariables(void) &ReadFromSecondaries, USE_SECONDARY_NODES_NEVER, use_secondary_nodes_options, PGC_SU_BACKEND, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomEnumVariable( @@ -1110,7 +1111,7 @@ RegisterCitusConfigVariables(void) &MultiTaskQueryLogLevel, MULTI_TASK_QUERY_INFO_OFF, multi_task_query_log_level_options, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomEnumVariable( @@ -1120,7 +1121,7 @@ RegisterCitusConfigVariables(void) &MultiShardConnectionType, PARALLEL_CONNECTION, multi_shard_modify_connection_options, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomStringVariable( @@ -1130,7 +1131,7 @@ RegisterCitusConfigVariables(void) &CitusVersion, CITUS_VERSION, PGC_INTERNAL, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomStringVariable( @@ -1140,7 +1141,7 @@ RegisterCitusConfigVariables(void) &CurrentCluster, "default", PGC_SU_BACKEND, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -1150,7 +1151,7 @@ RegisterCitusConfigVariables(void) &WritableStandbyCoordinator, false, PGC_USERSET, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( @@ -1215,7 +1216,7 @@ RegisterCitusConfigVariables(void) &MaxTaskStringSize, 12288, 8192, 65536, PGC_POSTMASTER, - 0, + GUC_STANDARD, NULL, NULL, NULL); DefineCustomBoolVariable( diff --git a/src/include/distributed/shared_library_init.h b/src/include/distributed/shared_library_init.h index a50e8db99..b5bc09da3 100644 --- a/src/include/distributed/shared_library_init.h +++ b/src/include/distributed/shared_library_init.h @@ -11,6 +11,10 @@ #ifndef SHARED_LIBRARY_INIT_H #define SHARED_LIBRARY_INIT_H +#define GUC_STANDARD 0 +#define MAX_SHARD_COUNT 64000 +#define MAX_SHARD_REPLICATION_FACTOR 100 + extern void StartupCitusBackend(void); #endif /* SHARED_LIBRARY_INIT_H */ diff --git a/src/include/distributed/time_constants.h b/src/include/distributed/time_constants.h new file mode 100644 index 000000000..0406cd4a9 --- /dev/null +++ b/src/include/distributed/time_constants.h @@ -0,0 +1,18 @@ +/*------------------------------------------------------------------------- + * time_constants.h + * + * Copyright (c) Citus Data, Inc. + * + *------------------------------------------------------------------------- + */ + +#ifndef TIME_CONSTANTS_H +#define TIME_CONSTANTS_H + +#define MS 1 +#define MS_PER_SECOND MS * 1000 +#define MS_PER_MINUTE MS_PER_SECOND * 60 +#define MS_PER_HOUR MS_PER_MINUTE * 60 +#define MS_PER_DAY MS_PER_HOUR * 24 + +#endif /* TIME_CONSTANTS_H */