Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Sep 18, 2024
1 parent f8e171f commit 5b93c88
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,10 @@ public void addBackends(List<HostInfo> hostInfos, Map<String, String> tagMap) th

String computeGroupId = tryCreateComputeGroup(clusterName,
RandomIdentifierGenerator.generateRandomIdentifier(8));
String cloudUniqueId = "1:" + Config.cluster_id + ":"
+ RandomIdentifierGenerator.generateRandomIdentifier(8);
String instanceId = Config.cluster_id == -1 ? ((CloudEnv) Env.getCurrentEnv()).getCloudInstanceId()
: String.valueOf(Config.cluster_id);

String cloudUniqueId = "1:" + instanceId + ":" + RandomIdentifierGenerator.generateRandomIdentifier(8);
alterBackendCluster(hostInfos, computeGroupId, cloudUniqueId, Cloud.AlterClusterRequest.Operation.ADD_NODE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,18 @@ class Suite implements GroovyInterceptable {
return;
}

void getBackendIpHeartbeatPort(Map<String, String> backendId_to_backendIP,
Map<String, String> backendId_to_backendHeartbeatPort) {
List<List<Object>> backends = sql("show backends");
logger.info("Content of backends: ${backends}")
for (List<Object> backend : backends) {
backendId_to_backendIP.put(String.valueOf(backend[0]), String.valueOf(backend[1]));
backendId_to_backendHeartbeatPort.put(String.valueOf(backend[0]), String.valueOf(backend[2]));
}
return;
}


void getBackendIpHttpAndBrpcPort(Map<String, String> backendId_to_backendIP,
Map<String, String> backendId_to_backendHttpPort, Map<String, String> backendId_to_backendBrpcPort) {

Expand Down Expand Up @@ -1481,55 +1493,60 @@ class Suite implements GroovyInterceptable {
Awaitility.await().atMost(60, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).and()
.pollInterval(100, TimeUnit.MILLISECONDS).await().until(() -> {
def frontends = getFrontendIpHttpPort()
boolean matched = false
for (frontend: frontends) {
if (frontend == "$host:$port") {
return true;
matched = true;
}
}
return false;
return matched;
});
}

void waitDropFeFinished(String host, int port) {
Awaitility.await().atMost(60, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).and()
.pollInterval(100, TimeUnit.MILLISECONDS).await().until(() -> {
def frontends = getFrontendIpHttpPort()
boolean matched = false
for (frontend: frontends) {
if (frontend == "$host:$port") {
return false;
matched = true
}
}
return true;
return !matched;
});
}

void waitAddBeFinished(String host, int port) {
logger.info("waiting ${host}:${port} added");
Awaitility.await().atMost(60, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).and()
.pollInterval(100, TimeUnit.MILLISECONDS).await().until(() -> {
def ipList = [:]
def portList = [:]
getBackendIpHttpPort(ipList, portList)
getBackendIpHeartbeatPort(ipList, portList)
boolean matched = false
ipList.each { beid, ip ->
if (ip == host && portList[beid] as int == port) {
return true;
if (ip.equals(host) && ((portList[beid] as int) == port)) {
matched = true;
}
}
return false;
return matched;
});
}

void waiteDropBeFinished(String host, int port) {
void waitDropBeFinished(String host, int port) {
Awaitility.await().atMost(60, TimeUnit.SECONDS).with().pollDelay(100, TimeUnit.MILLISECONDS).and()
.pollInterval(100, TimeUnit.MILLISECONDS).await().until(() -> {
def ipList = [:]
def portList = [:]
getBackendIpHttpPort(ipList, portList)
getBackendIpHeartbeatPort(ipList, portList)
boolean matched = false
ipList.each { beid, ip ->
if (ip == host && portList[beid] as int == port) {
return false;
matched = true;
}
}
return true;
return !matched;
});
}

Expand Down
2 changes: 1 addition & 1 deletion regression-test/suites/node_p0/test_backend.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ suite("test_backend", "nonConcurrent") {
result = sql """SHOW BACKENDS;"""
logger.info("result:${result}")

if (!isCoudMode()) {
if (!isCloudMode()) {
sql """ALTER SYSTEM MODIFY BACKEND "${address}:${notExistPort}" SET ("disable_query" = "true"); """
sql """ALTER SYSTEM MODIFY BACKEND "${address}:${notExistPort}" SET ("disable_load" = "true"); """
}
Expand Down

0 comments on commit 5b93c88

Please sign in to comment.