diff --git a/src/bin/gs_guc/pg_guc.cpp b/src/bin/gs_guc/pg_guc.cpp index 74b4943f162fdff9e8ec30333555aa5b1297ebdc..ac9b08647e9e5bcee32bcadf4c4a5de6a82c6eed 100644 --- a/src/bin/gs_guc/pg_guc.cpp +++ b/src/bin/gs_guc/pg_guc.cpp @@ -1023,74 +1023,6 @@ append_string_info(char **optLines, const char *newContext) return optLinesResult; } -/******************************************************************************* - Function : IsLastNotNullReplconninfo - Description : determine if replconninfoX which is being set is the last one valid replconninfo - Input : optLines - postgres.conf info before changing - replconninfoX - replconninfo param name which is being set, eg "replconninfo1" - Output : None - Return : bool -*******************************************************************************/ -static bool IsLastNotNullReplconninfo(char** optLines, char* replconninfoX) -{ - int notNullReplconninfoNums = 0; - bool isReplconninfoXNull = true; - bool matchReplconninfoX = false; - char* p = NULL; - - for (int i = 0; optLines != NULL && optLines[i] != NULL; i++) { - p = optLines[i]; - /* Skip all the blanks at the begin of the optLine */ - while (p != NULL && isspace((unsigned char)*p)) { - ++p; - } - if (p == NULL) { - continue; - } - if (*p == '#') { - ++p; - while (p != NULL && isspace((unsigned char)*p)) { - ++p; - } - /* replconninfoX must be invalid if it is commented*/ - if (p != NULL && strncmp(p, replconninfoX, strlen(replconninfoX)) == 0) { - return false; - } - continue; - } - if (p != NULL && strncmp(p, "replconninfo", strlen("replconninfo")) == 0) { - if (strncmp(p, replconninfoX, strlen(replconninfoX)) == 0) { - matchReplconninfoX = true; - } - p += strlen(replconninfoX); - /* Skip all the blanks between the param and '=' */ - while (p != NULL && isspace((unsigned char)*p)) { - p++; - } - /* Skip '=' */ - if (p != NULL && *p == '=') { - p++; - } - /* Skip all the blanks between the '=' and value */ - while (p != NULL && isspace((unsigned char)*p)) { - p++; - } - if (p != NULL && strncmp(p, "''", strlen("''")) != 0 && - strncmp(p, "\"\"", strlen("\"\"")) != 0) { - ++notNullReplconninfoNums; - if (matchReplconninfoX) { - isReplconninfoXNull = false; - } - } - } - } - /* return true if replconninfoX which is being set is the last one valid replconninfo */ - if (notNullReplconninfoNums == 1 && !isReplconninfoXNull) { - return true; - } - return false; -} - /* * @@GaussDB@@ * Brief : @@ -1182,14 +1114,6 @@ do_gucset(const char *action_type, const char *data_dir) } } - /* Give a warning if the last valid replconninfo is set to a invalid value currently */ - if (strncmp(config_param[i], "replconninfo", strlen("replconninfo")) == 0 && - config_value[i] != NULL && (strlen(config_value[i]) == 0 || strncmp(config_value[i], "''", strlen("''")) == 0) && - IsLastNotNullReplconninfo(opt_lines, config_param[i])) { - write_stderr("\nWARNING: This is the last valid replConnInfo, once set to null, " - "the host role will be changed to Normal if the local_role is primary now.\n"); - } - /* find the line where guc parameter in */ lines_index = find_gucoption(opt_lines, config_param[i], NULL, NULL, &optvalue_off, &optvalue_len); /* get the type of gs_guc execution */ diff --git a/src/common/backend/utils/misc/guc.cpp b/src/common/backend/utils/misc/guc.cpp index b5cd65b4558c3eb0e90d1ae1f543f2c6a282fd1b..b9177bb385f463fe5f272362ca344cb5160021e4 100644 --- a/src/common/backend/utils/misc/guc.cpp +++ b/src/common/backend/utils/misc/guc.cpp @@ -17699,22 +17699,6 @@ static bool check_replconninfo(char** newval, void** extra, GucSource source) return true; } -/* - * @@GaussDB@@ - * Brief : Determine if all eight replconninfos are empty. - * Description : - * Notes : - */ -static inline bool GetReplCurArrayIsNull() -{ - for (int i = 1; i < MAX_REPLNODE_NUM; i++) { - if (t_thrd.postmaster_cxt.ReplConnArray[i] != NULL) { - return false; - } - } - return true; -} - /* * @@GaussDB@@ * Brief : Parse replconninfo1. @@ -17736,12 +17720,6 @@ static void assign_replconninfo1(const char* newval, void* extra) if (u_sess->attr.attr_storage.ReplConnInfoArr[1] != NULL && newval != NULL && strcmp(u_sess->attr.attr_storage.ReplConnInfoArr[1], newval) != 0) { t_thrd.postmaster_cxt.ReplConnChanged[1] = true; - // perceive single --> primary_standby - if (t_thrd.postmaster_cxt.HaShmData != NULL && - t_thrd.postmaster_cxt.HaShmData->current_mode == NORMAL_MODE && - !GetReplCurArrayIsNull()) { - t_thrd.postmaster_cxt.HaShmData->current_mode = PRIMARY_MODE; - } } } diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index d25ae836ef3873ee34b5e0a9f79882e4262b0e06..cb1224ace5916f06f8928ca9249d67ed2d968822 100755 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -9496,13 +9496,6 @@ static void check_and_reset_ha_listen_port(void) signal_child(g_instance.pid_cxt.RemoteServicePID, SIGTERM); ListenSocketRegulation(); - - if (t_thrd.postmaster_cxt.HaShmData != NULL && - t_thrd.postmaster_cxt.HaShmData->repl_list_num == 0 && - t_thrd.postmaster_cxt.HaShmData->current_mode == PRIMARY_MODE) { - t_thrd.postmaster_cxt.HaShmData->current_mode = NORMAL_MODE; - SetServerMode(NORMAL_MODE); - } } return;