diff --git a/src/bin/gs_guc/cluster_guc.conf b/src/bin/gs_guc/cluster_guc.conf index ae2c84f924ef08317aef8097dd71295ae58d58f5..11841fdb3cbdb48d49b8230c7ce082cc31ec2f24 100755 --- a/src/bin/gs_guc/cluster_guc.conf +++ b/src/bin/gs_guc/cluster_guc.conf @@ -701,7 +701,6 @@ time_to_target_rpo|int|0,3600|NULL|NULL| disable_memory_protect|bool|0,0|NULL|NULL| segment_buffers|int|16,1073741823|kB|NULL| undo_zone_count|int|0,1048576|NULL|NULL| -cluster_run_mode|enum|cluster_primary,cluster_standby|NULL|NULL| stream_cluster_run_mode|enum|cluster_primary,cluster_standby|NULL|NULL| xlog_file_size|int64|1048576,576460752303423487|B|The value must be an integer multiple of 16777216(16M)| xlog_file_path|string|0,0|NULL|NULL| diff --git a/src/bin/pg_controldata/pg_controldata.cpp b/src/bin/pg_controldata/pg_controldata.cpp index f8fe52c25d347993503fd06625e549c853f8d4fc..67f6dc2f8ac5f3303add5ba96b81b2adc02d960b 100644 --- a/src/bin/pg_controldata/pg_controldata.cpp +++ b/src/bin/pg_controldata/pg_controldata.cpp @@ -98,6 +98,18 @@ static const char* SSClusterState(SSGlobalClusterState state) { return _("unrecognized status code"); } +static const char* SSClusterRunMode(ClusterRunMode run_mode) { + switch (run_mode) { + case RUN_MODE_PRIMARY: + return _("primary cluster"); + case RUN_MODE_STANDBY: + return _("standby cluster"); + default: + break; + } + return _("unrecognized cluster run mode"); +} + static const char* wal_level_str(WalLevel wal_level) { switch (wal_level) { @@ -263,6 +275,7 @@ static void display_last_page(ss_reformer_ctrl_t reformerCtrl, int last_page_id) printf(_("Primary instance ID: %d\n"), reformerCtrl.primaryInstId); printf(_("Recovery instance ID: %d\n"), reformerCtrl.recoveryInstId); printf(_("Cluster status: %s\n"), SSClusterState(reformerCtrl.clusterStatus)); + printf(_("Cluster run mode: %s\n"), SSClusterRunMode(reformerCtrl.clusterRunMode)); } int main(int argc, char* argv[]) diff --git a/src/bin/pg_ctl/pg_ctl.cpp b/src/bin/pg_ctl/pg_ctl.cpp index 1a29954805087367403d477ed9c9a5d1d8313e79..3984fef1a25621d1edc9e65cf2d096e283d8bb8b 100755 --- a/src/bin/pg_ctl/pg_ctl.cpp +++ b/src/bin/pg_ctl/pg_ctl.cpp @@ -2203,7 +2203,7 @@ static void do_failover(uint32 term) exit(1); } /* failover executed only in standby server */ - else if (run_mode != STANDBY_MODE && run_mode != CASCADE_STANDBY_MODE) { + else if (run_mode != STANDBY_MODE && run_mode != CASCADE_STANDBY_MODE && run_mode != MAIN_STANDBY_MODE) { pg_log(PG_WARNING, _(" cannot failover server; " "server is not in standby or cascade standby mode\n")); diff --git a/src/common/backend/utils/misc/guc.cpp b/src/common/backend/utils/misc/guc.cpp index 8092db0a707427783a03fb5686e920474f66268c..4cee8fb94c20d5cdcfb7840aeaa5e35b4eaa438f 100755 --- a/src/common/backend/utils/misc/guc.cpp +++ b/src/common/backend/utils/misc/guc.cpp @@ -852,7 +852,7 @@ static const struct config_enum_entry sync_config_strategy_options[] = { #endif static const struct config_enum_entry cluster_run_mode_options[] = { - {"cluster_primary", RUN_MODE_PRIMARY, false}, + {"cluster_primary", RUN_MODE_PRIMARY, false}, {"cluster_standby", RUN_MODE_STANDBY, false}, {NULL, 0, false}}; @@ -4409,18 +4409,6 @@ static void InitConfigureNamesEnum() NULL, NULL, NULL}, - {{"cluster_run_mode", - PGC_POSTMASTER, - NODE_SINGLENODE, - PRESET_OPTIONS, - gettext_noop("Sets the type of shared storage cluster."), - NULL}, - &g_instance.attr.attr_common.cluster_run_mode, - RUN_MODE_PRIMARY, - cluster_run_mode_options, - NULL, - NULL, - NULL}, {{"stream_cluster_run_mode", PGC_POSTMASTER, NODE_ALL, diff --git a/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp b/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp index b8a5a2c6292fb0335cdb1f1336d23bfce8652a16..92c38eb6d08823327d4a6e13d17de24a15324ed1 100644 --- a/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp +++ b/src/gausskernel/ddes/adapter/ss_dms_recovery.cpp @@ -194,6 +194,7 @@ void SSInitReformerControlPages(void) g_instance.dms_cxt.SSReformerControl.recoveryInstId = INVALID_INSTANCEID; g_instance.dms_cxt.SSReformerControl.version = REFORM_CTRL_VERSION; g_instance.dms_cxt.SSReformerControl.clusterStatus = CLUSTER_NORMAL; + g_instance.dms_cxt.SSReformerControl.clusterRunMode = RUN_MODE_PRIMARY; (void)printf("[SS] Current node:%d initdb first, will become PRIMARY for first-time SS cluster startup.\n", SS_MY_INST_ID); diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index dc04bb74e0bf94d8ca04a1b4404a118a13c277de..dd44c6c127affa98e6fb609a5d4dca075615e2f6 100644 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -1896,7 +1896,7 @@ int PostmasterMain(int argc, char* argv[]) optCtxt.opterr = 1; - check_short_optOfVoid("A:B:bc:C:D:d:EeFf:h:ijk:lM:N:nOo:Pp:Rr:S:sTt:u:W:g:X:-:", argc, argv); + check_short_optOfVoid("A:B:bc:C:D:d:EeFf:h:ijk:lM:N:nOo:Pp:Rr:S:sTt:u:W:g:X:z:-:", argc, argv); /* * Parse command-line options. CAUTION: keep this in sync with @@ -1904,7 +1904,7 @@ int PostmasterMain(int argc, char* argv[]) * common help() function in main/main.c. */ initOptParseContext(&optCtxt); - while ((opt = getopt_r(argc, argv, "A:B:bc:C:D:d:EeFf:h:ijk:lM:N:nOo:Pp:Rr:S:sTt:u:W:g:X:-:", &optCtxt)) != -1) { + while ((opt = getopt_r(argc, argv, "A:B:bc:C:D:d:EeFf:h:ijk:lM:N:nOo:Pp:Rr:S:sTt:u:W:g:X:z:-:", &optCtxt)) != -1) { switch (opt) { case 'A': SetConfigOption("debug_assertions", optCtxt.optarg, PGC_POSTMASTER, PGC_S_ARGV); @@ -2101,6 +2101,18 @@ int PostmasterMain(int argc, char* argv[]) ereport(LOG, (errmsg("Set stop barrierID %s", g_instance.csn_barrier_cxt.stopBarrierId))); } break; + case 'z': + if (0 == strncmp(optCtxt.optarg, "cluster_primary", strlen("cluster_primary")) && + '\0' == optCtxt.optarg[strlen("cluster_primary")]) { + g_instance.attr.attr_common.cluster_run_mode = RUN_MODE_PRIMARY; + } else if (0 == strncmp(optCtxt.optarg, "cluster_standby", strlen("cluster_standby")) && + '\0' == optCtxt.optarg[strlen("cluster_standby")]) { + g_instance.attr.attr_common.cluster_run_mode = RUN_MODE_STANDBY; + } else { + ereport(FATAL, (errmsg("the options of -z is not recognized"))); + } + g_instance.dms_cxt.SSReformerControl.clusterRunMode = (ClusterRunMode)g_instance.attr.attr_common.cluster_run_mode; + break; case 'c': case '-': { char* name = NULL; @@ -9961,6 +9973,23 @@ static void sigusr1_handler(SIGNAL_ARGS) (errmsg("set gaussdb state file: db state(PROMOTING_STATE), server mode(%s)", wal_get_role_string(get_cur_mode())))); + /* + * update cluster_run_mode from pg_control file, + * in case failover has been performed between two dorado cluster. + */ + if (ENABLE_DMS && g_instance.attr.attr_storage.xlog_file_path != 0) { + g_instance.attr.attr_common.cluster_run_mode = g_instance.dms_cxt.SSReformerControl.clusterRunMode; + } + if (ENABLE_DMS && DORADO_STANDBY_CLUSTER_MAINSTANDBY_NODE) { + ereport(LOG, + (errmsg("Failover between two dorado cluster start, change current run mode to primary_cluster"))); + g_instance.attr.attr_common.cluster_run_mode = RUN_MODE_PRIMARY; + g_instance.dms_cxt.SSReformerControl.clusterRunMode = RUN_MODE_PRIMARY; + SSSaveReformerCtrl(); + t_thrd.xlog_cxt.server_mode = PRIMARY_MODE; + SetHaShmemData(); + } + /* promote cascade standby */ if (IsCascadeStandby()) { t_thrd.xlog_cxt.is_cascade_standby = false; @@ -10120,6 +10149,8 @@ static void sigusr1_handler(SIGNAL_ARGS) if (ENABLE_DMS && (mode = CheckSwitchoverSignal())) { SSReadControlFile(REFORM_CTRL_PAGE); if (SS_NORMAL_STANDBY && pmState == PM_RUN && !SS_STANDBY_ONDEMAND_RECOVERY) { + /* update cluster_run_mode in case failover has been performed between two dorado cluster. */ + g_instance.attr.attr_common.cluster_run_mode = g_instance.dms_cxt.SSReformerControl.clusterRunMode; SSDoSwitchover(); } else { ereport(LOG, (errmsg("Current mode is not NORMAL STANDBY, SS switchover command ignored."))); diff --git a/src/gausskernel/storage/access/transam/xlog.cpp b/src/gausskernel/storage/access/transam/xlog.cpp index 8864d886d504dc21339828e010190cc03668a841..2ca67e18f6a589b6e6177cebaabed1ebaaac0ef8 100755 --- a/src/gausskernel/storage/access/transam/xlog.cpp +++ b/src/gausskernel/storage/access/transam/xlog.cpp @@ -9579,6 +9579,11 @@ void StartupXLOG(void) } } + if (SS_PRIMARY_MODE || SS_STANDBY_CLUSTER_MAIN_STANDBY) { + g_instance.dms_cxt.SSReformerControl.clusterRunMode = (ClusterRunMode)g_instance.attr.attr_common.cluster_run_mode; + SSSaveReformerCtrl(); + } + ReadRemainSegsFile(); /* Determine whether it is currently in the switchover of streaming disaster recovery */ checkHadrInSwitchover(); @@ -19359,6 +19364,30 @@ retry: t_thrd.xlog_cxt.RedoDone = IsRedoDonePromoting(); pg_memory_barrier(); + if (DORADO_STANDBY_CLUSTER_MAINSTANDBY_NODE && WalRcvIsDone() && CheckForFailoverTrigger()) { + t_thrd.xlog_cxt.receivedUpto = GetWalRcvWriteRecPtr(NULL); + if (XLByteLT(RecPtr, t_thrd.xlog_cxt.receivedUpto)) { + /* wait xlog redo done */ + continue; + } + + ProcTxnWorkLoad(true); + /* use volatile pointer to prevent code rearrangement */ + volatile WalRcvData *walrcv = t_thrd.walreceiverfuncs_cxt.WalRcv; + SpinLockAcquire(&walrcv->mutex); + walrcv->dummyStandbyConnectFailed = false; + SpinLockRelease(&walrcv->mutex); + + ereport(LOG, (errmsg("RecPtr(%X/%X),receivedUpto(%X/%X)", (uint32)(RecPtr >> 32), + (uint32)RecPtr, (uint32)(t_thrd.xlog_cxt.receivedUpto >> 32), + (uint32)t_thrd.xlog_cxt.receivedUpto))); + + ShutdownWalRcv(); + ShutdownDataRcv(); + + goto triggered; + } + if (IS_SHARED_STORAGE_MODE || SS_CLUSTER_DORADO_REPLICATION) { uint32 disableConnectionNode = pg_atomic_read_u32(&g_instance.comm_cxt.localinfo_cxt.need_disable_connection_node); @@ -19486,7 +19515,9 @@ retry: */ load_server_mode(); - if (DORADO_STANDBY_CLUSTER_MAINSTANDBY_NODE || IS_SS_REPLICATION_MAIN_STANBY_NODE) { + if (DORADO_STANDBY_CLUSTER_MAINSTANDBY_NODE && CheckForFailoverTrigger()) { + goto triggered; + } else if (DORADO_STANDBY_CLUSTER_MAINSTANDBY_NODE || IS_SS_REPLICATION_MAIN_STANBY_NODE) { ProcTxnWorkLoad(false); /* use volatile pointer to prevent code rearrangement */ volatile WalRcvData *walrcv = t_thrd.walreceiverfuncs_cxt.WalRcv; @@ -19524,6 +19555,32 @@ retry: */ t_thrd.xlog_cxt.failedSources |= sources; + if (DORADO_STANDBY_CLUSTER_MAINSTANDBY_NODE && CheckForFailoverTrigger()) { + XLogRecPtr receivedUpto = GetWalRcvWriteRecPtr(NULL); + XLogRecPtr EndRecPtrTemp = t_thrd.xlog_cxt.EndRecPtr; + XLByteAdvance(EndRecPtrTemp, SizeOfXLogRecord); + if (XLByteLT(EndRecPtrTemp, receivedUpto) && !FORCE_FINISH_ENABLED && + t_thrd.xlog_cxt.currentRetryTimes++ < g_retryTimes) { + ereport(WARNING, (errmsg("there are some received xlog have not been redo " + "the tail of last redo lsn:%X/%X, received lsn:%X/%X, retry %d times", + (uint32)(EndRecPtrTemp >> 32), (uint32)EndRecPtrTemp, + (uint32)(receivedUpto >> 32), (uint32)receivedUpto, + t_thrd.xlog_cxt.currentRetryTimes))); + return -1; + } + ereport(LOG, + (errmsg("read record failed when promoting, current lsn (%X/%X), received lsn(%X/%X)," + "sources[%u], failedSources[%u], readSource[%u], readFile[%d], readId[%u]," + "readSeg[%u], readOff[%u], readLen[%u]", + (uint32)(RecPtr >> 32), (uint32)RecPtr, + (uint32)(t_thrd.xlog_cxt.receivedUpto >> 32), + (uint32)t_thrd.xlog_cxt.receivedUpto, sources, t_thrd.xlog_cxt.failedSources, + t_thrd.xlog_cxt.readSource, t_thrd.xlog_cxt.readFile, + (uint32)(t_thrd.xlog_cxt.readSegNo >> 32), (uint32)t_thrd.xlog_cxt.readSegNo, + t_thrd.xlog_cxt.readOff, t_thrd.xlog_cxt.readLen))); + goto triggered; + } + } /* @@ -19646,6 +19703,16 @@ next_record_is_invalid: t_thrd.xlog_cxt.readLen = 0; t_thrd.xlog_cxt.readSource = 0; + return -1; +triggered: + if (t_thrd.xlog_cxt.readFile >= 0) { + close(t_thrd.xlog_cxt.readFile); + } + t_thrd.xlog_cxt.readFile = -1; + t_thrd.xlog_cxt.readLen = 0; + t_thrd.xlog_cxt.readSource = 0; + t_thrd.xlog_cxt.recoveryTriggered = true; + return -1; } diff --git a/src/include/ddes/dms/ss_dms_recovery.h b/src/include/ddes/dms/ss_dms_recovery.h index 0c5dc6547386092943745ebafb5335d5be8fa04f..308ac92d85f0605a566e6e39152c0ae82acadaa2 100644 --- a/src/include/ddes/dms/ss_dms_recovery.h +++ b/src/include/ddes/dms/ss_dms_recovery.h @@ -55,6 +55,7 @@ typedef struct st_reformer_ctrl { int primaryInstId; int recoveryInstId; SSGlobalClusterState clusterStatus; + ClusterRunMode clusterRunMode; pg_crc32c crc; } ss_reformer_ctrl_t; diff --git a/src/test/ha/standby_env.sh b/src/test/ha/standby_env.sh index 6ff7654382c08c637a483c2431333a1fcc17e297..c9e37b85ebee19bf5cb12009ef07f7c6a3f4a90d 100644 --- a/src/test/ha/standby_env.sh +++ b/src/test/ha/standby_env.sh @@ -488,8 +488,12 @@ function check_multi_standby_startup() } function start_standby() { +cluster_mode_param="" +if [-n "$1" ]; then + cluster_mode_param=$1 +fi echo "start standby $standby_data_dir" -$bin_dir/gaussdb --single_node -M standby -p $dn1_standby_port -D $standby_data_dir > ./results/gaussdb.log 2>&1 & +$bin_dir/gaussdb --single_node -M standby -p $dn1_standby_port -D $standby_data_dir $cluster_mode_param > ./results/gaussdb.log 2>&1 & check_standby_startup } @@ -502,15 +506,23 @@ sleep 10 function start_standby2() { + cluster_mode_param="" + if [-n "$1" ]; then + cluster_mode_param=$1 + fi echo "start standby2 $standby2_data_dir" - $bin_dir/gaussdb --single_node -M standby -p $standby2_port -D $standby2_data_dir > ./results/gaussdb.log 2>&1 & + $bin_dir/gaussdb --single_node -M standby -p $standby2_port -D $standby2_data_dir $cluster_mode_param > ./results/gaussdb.log 2>&1 & sleep 10 } function start_standby3() { + cluster_mode_param="" + if [-n "$1" ]; then + cluster_mode_param=$1 + fi echo "start standby3 $standby3_data_dir" - $bin_dir/gaussdb --single_node -M standby -p $standby3_port -D $standby3_data_dir > ./results/gaussdb.log 2>&1 & + $bin_dir/gaussdb --single_node -M standby -p $standby3_port -D $standby3_data_dir $cluster_mode_param > ./results/gaussdb.log 2>&1 & sleep 10 } @@ -523,15 +535,23 @@ function start_standby4() function start_primary_as_primary() { +cluster_mode_param="" +if [-n "$1" ]; then + cluster_mode_param=$1 +fi echo "start primary $primary_data_dir as primary" -$bin_dir/gaussdb --single_node -M primary -p $dn1_primary_port -D $primary_data_dir > ./results/gaussdb.log 2>&1 & +$bin_dir/gaussdb --single_node -M primary -p $dn1_primary_port -D $primary_data_dir $cluster_mode_param > ./results/gaussdb.log 2>&1 & check_primary_startup } function start_primary_as_standby() { +cluster_mode_param="" +if [-n "$1" ]; then + cluster_mode_param=$1 +fi echo "start primary $primary_data_dir as standby" -$bin_dir/gaussdb --single_node -M standby -p $dn1_primary_port -D $primary_data_dir > ./results/gaussdb.log 2>&1 & +$bin_dir/gaussdb --single_node -M standby -p $dn1_primary_port -D $primary_data_dir $cluster_mode_param > ./results/gaussdb.log 2>&1 & check_primary_startup } @@ -544,8 +564,12 @@ check_standby_startup function start_standby2_as_primary() { +cluster_mode_param="" +if [-n "$1" ]; then + cluster_mode_param=$1 +fi echo "start standby $standby2_data_dir as primary" -$bin_dir/gaussdb --single_node -M primary -p $standby2_port -D $standby2_data_dir > ./results/gaussdb.log 2>&1 & +$bin_dir/gaussdb --single_node -M primary -p $standby2_port -D $standby2_data_dir $cluster_mode_param > ./results/gaussdb.log 2>&1 & check_standby2_startup } diff --git a/src/test/ha/util.sh b/src/test/ha/util.sh index 3f832dbd71ec81ebcb5bbf3e1bc7a441f1014d79..7f294aed16d5e06691507a894f25325174bfc7a4 100644 --- a/src/test/ha/util.sh +++ b/src/test/ha/util.sh @@ -194,42 +194,27 @@ function kill_standby_cluster() { function start_primary_cluster() { cluster_dns=($primary_data_dir $standby_data_dir) - for element in ${cluster_dns[@]} - do - gs_guc set -Z datanode -D $element -c "cluster_run_mode=cluster_primary" - done - start_primary_as_primary - start_standby + start_primary_as_primary "-z cluster_primary" + start_standby "-z cluster_primary" } function start_standby_cluster() { cluster_dns=($standby2_data_dir $standby3_data_dir) - for element in ${cluster_dns[@]} - do - gs_guc set -Z datanode -D $element -c "cluster_run_mode=cluster_standby" - done - start_standby2 - start_standby3 + + start_standby2 "-z cluster_standby" + start_standby3 "-z cluster_standby" } function start_primary_cluster_as_standby() { cluster_dns=($primary_data_dir $standby_data_dir) - for element in ${cluster_dns[@]} - do - gs_guc set -Z datanode -D $element -c "cluster_run_mode=cluster_standby" - done - start_primary_as_standby - start_standby + start_primary_as_standby "-z cluster_standby" + start_standby "-z cluster_standby" } function start_standby_cluster_as_primary() { cluster_dns=($standby2_data_dir $standby3_data_dir) - for element in ${cluster_dns[@]} - do - gs_guc set -Z datanode -D $element -c "cluster_run_mode=cluster_primary" - done - start_standby2_as_primary - start_standby3 + start_standby2_as_primary "-z cluster_primary" + start_standby3 "-z cluster_primary" } function stop_primary_cluster() { diff --git a/src/test/regress/output/recovery_2pc_tools.source b/src/test/regress/output/recovery_2pc_tools.source index fc237cfbd84f00be82117d6924149e350b73847a..991902d047068f1e6053bde310ed2e676ffa9c7a 100644 --- a/src/test/regress/output/recovery_2pc_tools.source +++ b/src/test/regress/output/recovery_2pc_tools.source @@ -110,7 +110,6 @@ select name,vartype,unit,min_val,max_val from pg_settings where name <> 'qunit_c checkpoint_warning | integer | s | 0 | 2147483647 client_encoding | string | | | client_min_messages | enum | | | - cluster_run_mode | enum | | | cn_send_buffer_size | integer | kB | 8 | 128 codegen_cost_threshold | integer | | 0 | 2147483647 codegen_strategy | enum | | | diff --git a/src/test/ss/dual_cluster_single_shared_storage/common_function.sh b/src/test/ss/dual_cluster_single_shared_storage/common_function.sh index 489f089429e607e1eae664bfc86925516e73a0d3..42d75e5e7fbfcad8652cc6defe12f2f33a677f9c 100644 --- a/src/test/ss/dual_cluster_single_shared_storage/common_function.sh +++ b/src/test/ss/dual_cluster_single_shared_storage/common_function.sh @@ -58,8 +58,9 @@ function check_dn_startup() function start_dn() { data_dir=$1 - echo "start $data_dir" - nohup $BIN_PATH/gaussdb -D $data_dir & 2>&1 & + run_mode=$2 + echo "start $data_dir, exec gaussdb -D $data_dir $run_mode" + nohup $BIN_PATH/gaussdb -D $data_dir $run_mode & 2>&1 & sleep 10 } @@ -67,43 +68,45 @@ function start_primary_cluster() { primary_dn=$1 standby_dn=$2 ss_data=$3 + run_mode="-z cluster_primary" for node in $@ do if [ ${node} == ${ss_data} ]; then continue fi - gs_guc set -Z datanode -D $node -c "cluster_run_mode=cluster_primary" + run_mode="-z cluster_primary" done export DSS_HOME=${ss_data}/dss_home0 - start_dn $primary_dn + start_dn $primary_dn "$run_mode" export DSS_HOME=${ss_data}/dss_home1 - start_dn $standby_dn + start_dn $standby_dn "$run_mode" } function start_standby_cluster() { main_standby_dn=$1 standby_dn=$2 ss_data=$3 + run_mode="-z cluster_standby" for node in $@ do if [ ${node} == ${ss_data} ]; then continue fi - gs_guc set -Z datanode -D $node -c "cluster_run_mode=cluster_standby" + run_mode="-z cluster_standby" done - start_dn $main_standby_dn - start_dn $standby_dn + start_dn $main_standby_dn "$run_mode" + start_dn $standby_dn "$run_mode" } function assign_dorado_master_parameter() { for id in $@ do + gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "xlog_file_path = '${SS_DATA}/dorado_shared_disk'" gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "xlog_lock_file_path = '${SS_DATA}/shared_lock_primary'" gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "application_name = 'master_${id}'" gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "cross_cluster_replconninfo1='localhost=127.0.0.1 localport=${PGPORT[id]} remotehost=127.0.0.1 remoteport=${STANDBY_PGPORT[0]}'" gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "cross_cluster_replconninfo2='localhost=127.0.0.1 localport=${PGPORT[id]} remotehost=127.0.0.1 remoteport=${STANDBY_PGPORT[1]}'" - gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "cluster_run_mode = 'cluster_primary'" gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "ha_module_debug = off" gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "ss_log_level = 255" gs_guc set -Z datanode -D ${SS_DATA}/dn${id} -c "ss_log_backup_file_count = 100" @@ -120,7 +123,6 @@ function assign_dorado_standby_parameter() gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "application_name = 'standby_${id}'" gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "cross_cluster_replconninfo1='localhost=127.0.0.1 localport=${STANDBY_PGPORT[id]} remotehost=127.0.0.1 remoteport=${PGPORT[0]}'" gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "cross_cluster_replconninfo2='localhost=127.0.0.1 localport=${STANDBY_PGPORT[id]} remotehost=127.0.0.1 remoteport=${PGPORT[1]}'" - gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "cluster_run_mode = 'cluster_standby'" gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "ha_module_debug = off" gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "ss_log_level = 255" gs_guc set -Z datanode -D ${SS_DATA_STANDBY}/dn${id} -c "ss_log_backup_file_count = 100"