Revert "cm两节点部署cm_server.conf参数third_party_gateway_ip支持以逗号分隔"

This reverts commit 943abc13d7d7aa905aaf74ff49c41e5c902442ee.
This commit is contained in:
zhang_xubo 2024-04-23 17:11:04 +08:00
parent 44cbc5a644
commit 29bcb6e032
5 changed files with 8 additions and 34 deletions

View File

@ -1322,25 +1322,11 @@ status_t IsReachableIP(char *ip)
if (ip == nullptr) {
return CM_ERROR;
}
char tmpIp[CM_IP_LENGTH];
int rc = -1;
rc = strcpy_s(tmpIp, CM_IP_LENGTH, ip);
securec_check_errno(rc, (void)rc);
char *saveptr = NULL;
char *token = strtok_r(tmpIp, ",", &saveptr);
char cmd[MAXPGPATH] = {0};
while (token != NULL) {
rc = memset_s(cmd, MAXPGPATH, 0, MAXPGPATH);
securec_check_errno(rc, (void)rc);
rc = snprintf_s(cmd, MAXPGPATH, MAXPGPATH - 1, "timeout 2 ping -c 2 %s > /dev/null 2>&1", token);
securec_check_intval(rc, (void)rc);
rc = system(cmd);
if (rc == 0) {
return CM_SUCCESS;
}
token = strtok_r(NULL, ",", &saveptr);
}
return CM_ERROR;
int rc = snprintf_s(cmd, MAXPGPATH, MAXPGPATH - 1, "timeout 2 ping -c 2 %s > /dev/null 2>&1", ip);
securec_check_intval(rc, (void)rc);
rc = system(cmd);
return rc == 0 ? CM_SUCCESS : CM_ERROR;
}
bool IsIPAddrValid(const char *ipAddr)

View File

@ -74,7 +74,6 @@ agent_network_timeout = 6
dn_arbitrate_mode = quorum
agent_fault_timeout = 60
third_party_gateway_ip = '' # used in 2 nodes cluster for ddb role arbitration with network isolation,
# support multiple iP addresses separated by commas, like '172.0.0.1,172.0.0.2'
# when cms_enable_failover_on2nodes is true.
# default ''. if cms_enable_failover_on2nodes is true, this param must be configured.
cms_enable_failover_on2nodes = false # used in 2 nodes cluster. if true, will use third_party_gateway_ip as an arbitrator,

View File

@ -71,7 +71,6 @@ agent_network_timeout = 6
dn_arbitrate_mode = quorum
delay_arbitrate_max_cluster_timeout = 300 # When resources are in the startup process, delay arbitration of the maximum cluster.
third_party_gateway_ip = '' # used in 2 nodes cluster for ddb role arbitration with network isolation,
# support multiple iP addresses separated by commas, like '172.0.0.1,172.0.0.2'
# when cms_enable_failover_on2nodes is true.
# default ''. if cms_enable_failover_on2nodes is true, this param must be configured.
cms_enable_failover_on2nodes = false # used in 2 nodes cluster. if true, will use third_party_gateway_ip as an arbitrator,

View File

@ -71,7 +71,6 @@ ddb_log_suppress_enable = 1 # Indicates whether to enable the log s
ddb_election_timeout = 3 # DCC election timeout interval [1S,600S]
share_disk_path = ''
third_party_gateway_ip = '' # used in 2 nodes cluster for ddb role arbitration with network isolation,
# support multiple iP addresses separated by commas, like '172.0.0.1,172.0.0.2'
# when cms_enable_failover_on2nodes is true.
# default ''. if cms_enable_failover_on2nodes is true, this param must be configured.
cms_enable_failover_on2nodes = false # used in 2 nodes cluster. if true, will use third_party_gateway_ip as an arbitrator,

View File

@ -352,19 +352,10 @@ void GetTwoNodesArbitrateParams(void) {
}
}
if (g_paramsOn2Nodes.cmsEnableFailoverOn2Nodes) {
char tmpIp[MAXPGPATH];
strcpy_s(tmpIp, MAXPGPATH, g_paramsOn2Nodes.thirdPartyGatewayIp);
char *saveptr = NULL;
char *token = strtok_r(tmpIp, ",", &saveptr);
while (token != NULL) {
if (!IsIPAddrValid(token)) {
write_runlog(ERROR, "parameter \"cms_enable_failover_on2nodes\" is true, "
"but parameter \"third_party_gateway_ip\" is invalid, please check!\n");
exit(1);
}
token = strtok_r(NULL, ",", &saveptr);
}
if (g_paramsOn2Nodes.cmsEnableFailoverOn2Nodes == true && !IsIPAddrValid(g_paramsOn2Nodes.thirdPartyGatewayIp)) {
write_runlog(ERROR, "parameter \"cms_enable_failover_on2nodes\" is true, "
"but parameter \"third_party_gateway_ip\" is invalid, please check!\n");
exit(1);
}
g_paramsOn2Nodes.cmsNetworkIsolationTimeout = (uint32)get_int_value_from_config(configDir,