From 1bdc22cc81290e21f62e6568425fb841b63b74a9 Mon Sep 17 00:00:00 2001 From: mrdrivingduck Date: Sun, 14 Apr 2024 10:32:12 +0800 Subject: [PATCH] feat: support global stat env --- docs/contributing/trouble-issuing.md | 118 ++++++++++++++++++ docs/zh/contributing/trouble-issuing.md | 118 ++++++++++++++++++ .../polar_stat_env/polar_stat_env--1.0.sql | 5 +- external/polar_stat_env/polar_stat_env.c | 92 ++++++++++---- polardb_build.sh | 16 +-- src/backend/px/px_util.c | 17 ++- src/backend/utils/misc/guc.c | 12 ++ src/backend/utils/misc/guc_px.c | 10 ++ src/include/miscadmin.h | 2 - src/include/utils/guc.h | 1 + src/include/utils/px_unsync_guc_name.h | 2 + 11 files changed, 355 insertions(+), 38 deletions(-) diff --git a/docs/contributing/trouble-issuing.md b/docs/contributing/trouble-issuing.md index 8702de87384..6a52562db5f 100644 --- a/docs/contributing/trouble-issuing.md +++ b/docs/contributing/trouble-issuing.md @@ -10,6 +10,7 @@ polar_stat_env -------------------------------------------------------------------- { + + "Role": "Primary", + "CPU": { + "Architecture": "x86_64", + "Model Name": "Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz",+ @@ -36,3 +37,120 @@ } (1 row) ``` + +通过 ePQ 功能可以直接获取整个集群中所有计算节点的硬件配置信息: + +```sql:no-line-numbers +=> CREATE EXTENSION polar_stat_env; +=> SET polar_enable_px TO ON; +=> SET polar_px_use_master TO ON; +=> SET polar_px_use_standby TO ON; +=> SELECT * FROM polar_global_function('polar_stat_env'); + polar_stat_env +--------------------------------------------------------------------- + { + + "Role": "Standby", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } + { + + "Role": "Replica", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } + { + + "Role": "Primary", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } + { + + "Role": "Replica", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } +(4 rows) +``` diff --git a/docs/zh/contributing/trouble-issuing.md b/docs/zh/contributing/trouble-issuing.md index 8702de87384..6a52562db5f 100644 --- a/docs/zh/contributing/trouble-issuing.md +++ b/docs/zh/contributing/trouble-issuing.md @@ -10,6 +10,7 @@ polar_stat_env -------------------------------------------------------------------- { + + "Role": "Primary", + "CPU": { + "Architecture": "x86_64", + "Model Name": "Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz",+ @@ -36,3 +37,120 @@ } (1 row) ``` + +通过 ePQ 功能可以直接获取整个集群中所有计算节点的硬件配置信息: + +```sql:no-line-numbers +=> CREATE EXTENSION polar_stat_env; +=> SET polar_enable_px TO ON; +=> SET polar_px_use_master TO ON; +=> SET polar_px_use_standby TO ON; +=> SELECT * FROM polar_global_function('polar_stat_env'); + polar_stat_env +--------------------------------------------------------------------- + { + + "Role": "Standby", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } + { + + "Role": "Replica", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } + { + + "Role": "Primary", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } + { + + "Role": "Replica", + + "CPU": { + + "Architecture": "x86_64", + + "Model Name": "Intel(R) Xeon(R) Platinum 8269CY CPU @ 2.50GHz",+ + "CPU Cores": "104", + + "CPU Thread Per Cores": "2", + + "CPU Core Per Socket": "26", + + "NUMA Nodes": "2", + + "L1d cache": "32K", + + "L1i cache": "32K", + + "L2 cache": "1024K", + + "L3 cache": "36608K" + + }, + + "Memory": { + + "Memory Total (GB)": "754", + + "HugePage Size (MB)": "2", + + "HugePage Total Size (GB)": "42" + + }, + + "OS Params": { + + "OS": "5.10.134-16.1.al8.x86_64", + + "Swappiness(1-100)": "0", + + "Vfs Cache Pressure(0-1000)": "500", + + "Min Free KBytes(KB)": "20971520" + + } + + } +(4 rows) +``` diff --git a/external/polar_stat_env/polar_stat_env--1.0.sql b/external/polar_stat_env/polar_stat_env--1.0.sql index 4718dcdfdec..58b6e981bad 100644 --- a/external/polar_stat_env/polar_stat_env--1.0.sql +++ b/external/polar_stat_env/polar_stat_env--1.0.sql @@ -1,13 +1,14 @@ -- Create customized polar stat env func CREATE FUNCTION polar_stat_env( IN format text DEFAULT 'json' -) RETURNS TEXT +) +RETURNS SETOF TEXT AS 'MODULE_PATHNAME', 'polar_stat_env' LANGUAGE C PARALLEL SAFE; CREATE FUNCTION polar_stat_env_no_format( IN format text DEFAULT 'json' ) -RETURNS TEXT +RETURNS SETOF TEXT AS 'MODULE_PATHNAME', 'polar_stat_env_no_format' LANGUAGE C PARALLEL SAFE; diff --git a/external/polar_stat_env/polar_stat_env.c b/external/polar_stat_env/polar_stat_env.c index a21f74aa29c..299e94ecfd6 100644 --- a/external/polar_stat_env/polar_stat_env.c +++ b/external/polar_stat_env/polar_stat_env.c @@ -23,19 +23,18 @@ *------------------------------------------------------------------------- */ #include "postgres.h" + +#include "access/xlog.h" +#include "commands/explain.h" #include "funcapi.h" +#include "miscadmin.h" #include "utils/builtins.h" -#include "utils/memutils.h" + #include #include #include -#include "utils/guc.h" -#include "commands/explain.h" -#include "fmgr.h" -#ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; -#endif const char *cpu_commands[][2] = { @@ -118,7 +117,7 @@ exec_collect_command(const char *command, StringInfoData *result) } static void -polar_collect_cpu(ExplainState *es) +collect_cpu(ExplainState *es) { bool success = false; StringInfoData cur_data; @@ -148,7 +147,7 @@ polar_collect_cpu(ExplainState *es) } static void -polar_collect_mem(ExplainState *es) +collect_mem(ExplainState *es) { bool success = false; StringInfoData cur_data; @@ -178,7 +177,7 @@ polar_collect_mem(ExplainState *es) } static void -polar_collect_os(ExplainState *es) +collect_os(ExplainState *es) { bool success = false; StringInfoData cur_data; @@ -208,16 +207,40 @@ polar_collect_os(ExplainState *es) } static void -polar_collect_env(ExplainState *es) +collect_node_type(ExplainState *es) +{ + static const char *role = "Role"; + + switch (polar_node_type()) + { + case POLAR_MASTER: + ExplainPropertyText(role, "Primary", es); + break; + case POLAR_REPLICA: + ExplainPropertyText(role, "Replica", es); + break; + case POLAR_STANDBY: + ExplainPropertyText(role, "Standby", es); + break; + default: + ExplainPropertyText(role, "Unknown", es); + break; + } +} + +static void +collect_all(ExplainState *es) { ExplainBeginOutput(es); + collect_node_type(es); + /* Collect CPU info */ - polar_collect_cpu(es); + collect_cpu(es); /* Collect memory info */ - polar_collect_mem(es); + collect_mem(es); /* Collect OS info */ - polar_collect_os(es); + collect_os(es); ExplainEndOutput(es); @@ -233,14 +256,40 @@ polar_collect_env(ExplainState *es) } } -static text * +static Datum stat_env(FunctionCallInfo fcinfo, bool need_newline) { + ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; + TupleDesc tupdesc; + Tuplestorestate *tupstore; + MemoryContext oldcontext; text *format_txt = PG_GETARG_TEXT_PP(0); char *format = text_to_cstring(format_txt); - text *result_text; ExplainState *es = NewExplainState(); + /* check to see if caller supports us returning a tuplestore */ + if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("set-valued function called in context that cannot accept a set"))); + if (!(rsinfo->allowedModes & SFRM_Materialize)) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("materialize mode required, but it is not allowed in this context"))); + + /* Build tuplestore to hold the result rows */ + oldcontext = MemoryContextSwitchTo(rsinfo->econtext->ecxt_per_query_memory); + + tupdesc = CreateTemplateTupleDesc(1, false); + TupleDescInitEntry(tupdesc, (AttrNumber) 1, "nodeenv", + TEXTOID, -1, 0); + tupstore = tuplestore_begin_heap(true, false, work_mem); + rsinfo->returnMode = SFRM_Materialize; + rsinfo->setResult = tupstore; + rsinfo->setDesc = tupdesc; + + MemoryContextSwitchTo(oldcontext); + if (strcmp(format, "text") == 0) es->format = EXPLAIN_FORMAT_TEXT; else if (strcmp(format, "xml") == 0) @@ -255,24 +304,25 @@ stat_env(FunctionCallInfo fcinfo, bool need_newline) errmsg("unrecognized value for output format: \"%s\"", format))); pfree(format); - polar_collect_env(es); + collect_all(es); if (!need_newline && es && es->str) remove_newlines(es->str->data); - result_text = cstring_to_text_with_len(es->str->data, es->str->len); - + tuplestore_puttuple(tupstore, + BuildTupleFromCStrings(TupleDescGetAttInMetadata(tupdesc), + &es->str->data)); pfree(es->str->data); pfree(es); - return result_text; + return (Datum) 0; } PG_FUNCTION_INFO_V1(polar_stat_env); Datum polar_stat_env(PG_FUNCTION_ARGS) { - PG_RETURN_TEXT_P(stat_env(fcinfo, true)); + return stat_env(fcinfo, true); } /* @@ -284,5 +334,5 @@ PG_FUNCTION_INFO_V1(polar_stat_env_no_format); Datum polar_stat_env_no_format(PG_FUNCTION_ARGS) { - PG_RETURN_TEXT_P(stat_env(fcinfo, false)); + return stat_env(fcinfo, false); } diff --git a/polardb_build.sh b/polardb_build.sh index e22adc3ffd0..8c3e63d443a 100755 --- a/polardb_build.sh +++ b/polardb_build.sh @@ -221,7 +221,7 @@ pg_bld_standby_data_dir=$pg_bld_prefix/tmp_standby_datadir_polardb_pg_1100_bld pg_bld_user=`whoami` pg_bld_port=5432 pg_bld_rep_port=5433 -pg_bld_standby_port=5434 +pg_bld_standby_port=5435 pg_db_user=postgres current_branch=`git rev-parse --abbrev-ref HEAD` if [[ $current_branch == "HEAD" ]]; @@ -624,7 +624,7 @@ then polar_enable_flashback_log = off" >> $pg_bld_master_dir/postgresql.conf echo "polar_enable_dma = on polar_dma_repl_user = $pg_db_user" >> $pg_bld_master_dir/polar_dma.conf - su_eval "$pg_bld_basedir/bin/postgres -D $pg_bld_master_dir -p $pg_bld_port -c polar_dma_init_meta=ON -c polar_dma_members_info=\"localhost:$pg_bld_port@1\"" + su_eval "$pg_bld_basedir/bin/postgres -D $pg_bld_master_dir -p $pg_bld_port -c polar_dma_init_meta=ON -c polar_dma_members_info=\"127.0.0.1:$pg_bld_port@1\"" fi fi @@ -638,7 +638,7 @@ then echo "polar_hostid = 2" >> $pg_bld_replica_dir/postgresql.conf echo "synchronous_standby_names='replica1'" >> $pg_bld_master_dir/postgresql.conf - echo "primary_conninfo = 'host=localhost port=$pg_bld_port user=$pg_db_user dbname=postgres application_name=replica1'" >> $pg_bld_replica_dir/recovery.conf + echo "primary_conninfo = 'host=127.0.0.1 port=$pg_bld_port user=$pg_db_user dbname=postgres application_name=replica1'" >> $pg_bld_replica_dir/recovery.conf echo "polar_replica = on" >> $pg_bld_replica_dir/recovery.conf echo "recovery_target_timeline = 'latest'" >> $pg_bld_replica_dir/recovery.conf echo "primary_slot_name = 'replica1'" >> $pg_bld_replica_dir/recovery.conf @@ -672,7 +672,7 @@ then polar_enable_lazy_checkpoint = off" >> $pg_bld_standby_dir/postgresql.conf fi - echo "primary_conninfo = 'host=localhost port=$pg_bld_port user=$pg_db_user dbname=postgres application_name=standby1'" >> $pg_bld_standby_dir/recovery.conf + echo "primary_conninfo = 'host=127.0.0.1 port=$pg_bld_port user=$pg_db_user dbname=postgres application_name=standby1'" >> $pg_bld_standby_dir/recovery.conf echo "standby_mode = on" >> $pg_bld_standby_dir/recovery.conf echo "recovery_target_timeline = 'latest'" >> $pg_bld_standby_dir/recovery.conf echo "primary_slot_name = 'standby1'" >> $pg_bld_standby_dir/recovery.conf @@ -734,7 +734,7 @@ then fi fi - echo "primary_conninfo = 'host=localhost port=$pg_bld_port user=$pg_db_user dbname=postgres application_name=replica${i}'" >> $pg_bld_replica_dir_n/recovery.conf + echo "primary_conninfo = 'host=127.0.0.1 port=$pg_bld_port user=$pg_db_user dbname=postgres application_name=replica${i}'" >> $pg_bld_replica_dir_n/recovery.conf echo "primary_slot_name = 'replica${i}'" >> $pg_bld_replica_dir_n/recovery.conf # su_eval "env $pg_bld_basedir/bin/psql -h 127.0.0.1 -d postgres -U $pg_db_user -c \"SELECT * FROM pg_create_physical_replication_slot('replica${i}')\"" su_eval "$pg_bld_basedir/bin/pg_ctl -D $pg_bld_replica_dir_n start -w -c" @@ -804,9 +804,9 @@ if [[ $withstandby == "yes" ]]; then su_eval "env $pg_bld_basedir/bin/psql -h 127.0.0.1 -d postgres -p $pg_bld_port -U $pg_db_user -c \"SELECT * FROM pg_create_physical_replication_slot('standby1')\"" sleep 2 - rm -fr $pg_bld_standby_data_dir - cp -frp $pg_bld_data_dir $pg_bld_standby_data_dir - sed -i -E "s/${pg_bld_data_dir//\//\\/}/${pg_bld_standby_data_dir//\//\\/}/" $pg_bld_standby_dir/postgresql.conf + rm -fr $pg_bld_standby_data_dir + cp -frp $pg_bld_data_dir $pg_bld_standby_data_dir + sed -i -E "s/${pg_bld_data_dir//\//\\/}/${pg_bld_standby_data_dir//\//\\/}/" $pg_bld_standby_dir/postgresql.conf su_eval "$pg_bld_basedir/bin/pg_ctl -D $pg_bld_standby_dir start -w -c -o '-p $pg_bld_standby_port'" fi diff --git a/src/backend/px/px_util.c b/src/backend/px/px_util.c index a0fd1e96f1b..ceea948870b 100644 --- a/src/backend/px/px_util.c +++ b/src/backend/px/px_util.c @@ -158,11 +158,13 @@ GeneratePxNodeConfigs(void) for (i = 0; i < count; i++) { item = &items[i]; - if (item->type != POLAR_STANDBY && item->type != POLAR_REPLICA) + if (item->type != POLAR_MASTER && item->type != POLAR_REPLICA && item->type != POLAR_STANDBY) + continue; + if (item->type == POLAR_MASTER && !px_use_master) continue; if (item->type == POLAR_STANDBY && !px_use_standby) continue; - if (item->state != STANDBY_SNAPSHOT_READY) + if (!(item->state == STANDBY_SNAPSHOT_READY || (item->type == POLAR_MASTER && px_use_master))) continue; config = &configs[idx]; @@ -191,19 +193,24 @@ GeneratePxNodeConfigs(void) if (strcmp(item->name, node_name) == 0) { - if (item->type != POLAR_STANDBY && item->type != POLAR_REPLICA) + if (item->type != POLAR_MASTER && item->type != POLAR_REPLICA && item->type != POLAR_STANDBY) { elog(error_level, "node %s is not useable for PX, consider adjust polar_px_nodes", node_name); goto next; } + if (item->type == POLAR_MASTER && !px_use_master) + { + elog(error_level, "node %s is master, but polar_px_use_master is off, consider adjust polar_px_nodes or enable polar_px_use_master", node_name); + goto next; + } if (item->type == POLAR_STANDBY && !px_use_standby) { elog(error_level, "node %s is standby, but polar_px_use_standby is off, consider adjust polar_px_nodes or enable polar_px_use_standby", node_name); goto next; } - if (item->state != STANDBY_SNAPSHOT_READY) + if (!(item->state == STANDBY_SNAPSHOT_READY || (item->type == POLAR_MASTER && !px_use_master))) { - elog(error_level, "node %s is not ready for PX qeury, consider adjust polar_px_nodes", node_name); + elog(error_level, "node %s is not ready for PX query, consider adjust polar_px_nodes", node_name); goto next; } diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index d52d816fb01..5e13a8a9e0a 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -671,6 +671,7 @@ int polar_max_hashagg_mem = 0; int polar_max_setop_mem = 0; int polar_max_subplan_mem = 0; int polar_max_recursiveunion_mem = 0; +int polar_wait_before_shutdown_timeout = 0; static const struct config_enum_entry client_schedule_options[] = { {"round-robin", CLIENT_SCHEDULE_ROUND_ROBIN, false}, @@ -6833,6 +6834,17 @@ static struct config_int ConfigureNamesInt[] = #endif /* POLAR end */ + { + {"polar_wait_before_shutdown_timeout", PGC_SIGHUP, UNGROUPED, + gettext_noop("PolarDB wait before shutdown timeout, in seconds."), + gettext_noop("0 means no wait.") + /* thought the unit is GUC_UNIT_S, to parse it conveniently, we remove it */ + }, + &polar_wait_before_shutdown_timeout, + 0, 0, 300, + NULL, NULL, NULL + }, + /* End-of-list marker */ { {NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL, NULL diff --git a/src/backend/utils/misc/guc_px.c b/src/backend/utils/misc/guc_px.c index f39c110d6e4..cb261be5187 100644 --- a/src/backend/utils/misc/guc_px.c +++ b/src/backend/utils/misc/guc_px.c @@ -1963,6 +1963,16 @@ struct config_bool ConfigureNamesBool_px[] = NULL, NULL, NULL }, + { + {"polar_px_use_master", PGC_USERSET, UNGROUPED, + gettext_noop("Whether PolarDB PX use master"), + NULL + }, + &px_use_master, + false, + NULL, (void (*)(bool, void *))polar_invalid_px_nodes_cache, NULL + }, + { {"polar_px_use_standby", PGC_USERSET, UNGROUPED, gettext_noop("Whether PolarDB PX use standby"), diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 6b895cf7af3..983decb0da7 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -355,8 +355,6 @@ extern char *DatabasePath; /* POLAR */ extern char *polar_database_path; extern PGDLLIMPORT int planner_work_mem; -extern PGDLLIMPORT int work_mem; -extern PGDLLIMPORT int maintenance_work_mem; /* now in utils/init/miscinit.c */ extern void InitPostmasterChild(void); diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 33b0eae79f9..d302522ddd9 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -988,6 +988,7 @@ extern int px_max_slices; extern char *polar_px_nodes; extern char *polar_px_ignore_function; extern PxFunctionOidArray *px_function_oid_array; +extern bool px_use_master; extern bool px_use_standby; extern bool polar_px_ignore_unusable_nodes; extern bool polar_enable_send_node_info; diff --git a/src/include/utils/px_unsync_guc_name.h b/src/include/utils/px_unsync_guc_name.h index 206c4d76106..7df95768c38 100644 --- a/src/include/utils/px_unsync_guc_name.h +++ b/src/include/utils/px_unsync_guc_name.h @@ -540,6 +540,7 @@ "polar_vfs.max_pfsd_io_size", "polar_vfs.pfs_force_mount", "polar_virtual_pid", + "polar_wait_before_shutdown_timeout", "polar_wal_buffer_insert_locks", "polar_wal_snd_reserved_for_superuser", "polar_worker.core_file_outdate_time", @@ -696,6 +697,7 @@ "polar_px_insert_dop_num", "polar_px_optimizer_remove_superfluous_order", "polar_px_update_dop_num", + "polar_px_use_master", "polar_px_use_standby", "polar_px_wait_lock_timeout", "polar_flashback_log_insert_list_max_num",