refactor some of hard coded values in citus gucs (#3137)

* refactor some of hard coded values in citus gucs

* rename GUC_ALLOW_ALL to GUC_STANDARD
pull/3146/head
SaitTalhaNisanci 2019-10-30 10:35:39 +03:00 committed by GitHub
parent 341feb21ca
commit dadbe86af1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 48 deletions

View File

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

View File

@ -11,6 +11,10 @@
#ifndef SHARED_LIBRARY_INIT_H #ifndef SHARED_LIBRARY_INIT_H
#define 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); extern void StartupCitusBackend(void);
#endif /* SHARED_LIBRARY_INIT_H */ #endif /* SHARED_LIBRARY_INIT_H */

View File

@ -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 */