Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Sep 17, 2024
1 parent f91a136 commit 4e5c964
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* Used to return the cluster information for the manager.
*/
@RestController
@RequestMapping("/rest/v2/manager/cluster")
@RequestMapping(path={"/rest/v2/manager/cluster", "/rest/v2/manager/compute_group"})
public class ClusterAction extends RestBaseController {

// Returns mysql and http connection information for the cluster.
Expand All @@ -54,7 +54,7 @@ public class ClusterAction extends RestBaseController {
// ""
// ]
// }
@RequestMapping(path = "/cluster_info/conn_info", method = RequestMethod.GET)
@RequestMapping(path = {"/cluster_info/conn_info", "/compute_group_info/conn_info"}, method = RequestMethod.GET)
public Object clusterInfo(HttpServletRequest request, HttpServletResponse response) {
executeCheckPassword(request, response);
checkGlobalAuth(ConnectContext.get().getCurrentUserIdentity(), PrivPredicate.ADMIN);
Expand Down Expand Up @@ -85,7 +85,8 @@ public static class BeClusterInfo {
public volatile long lastFragmentUpdateTime = 0;
}

@RequestMapping(path = "/cluster_info/cloud_cluster_status", method = RequestMethod.GET)
@RequestMapping(path = {"/cluster_info/cloud_cluster_status", "/compute_group_info/compute_group_status"},
method = RequestMethod.GET)
public Object cloudClusterInfo(HttpServletRequest request, HttpServletResponse response) {
executeCheckPassword(request, response);
checkGlobalAuth(ConnectContext.get().getCurrentUserIdentity(), PrivPredicate.ADMIN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ class Suite implements GroovyInterceptable {

void getBackendIpHttpPort(Map<String, String> backendId_to_backendIP, Map<String, String> backendId_to_backendHttpPort) {
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_backendHttpPort.put(String.valueOf(backend[0]), String.valueOf(backend[4]));
Expand Down Expand Up @@ -1475,6 +1476,62 @@ class Suite implements GroovyInterceptable {
}
}

void waitAddFeFinished(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()
for (frontend: frontends) {
if (frontend == "$host:$port") {
return true;
}
}
return false;
});
}

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()
for (frontend: frontends) {
if (frontend == "$host:$port") {
return false;
}
}
return true;
});
}

void waitAddBeFinished(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 = [:]
(ipList, portList) = getBEHostAndHTTPPort()
ipList.each { beid, ip ->
if (ip == host && portList[beid] as int == port) {
return true;
}
}
return false;
});
}

void waiteDropBeFinished(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 = [:]
(ipList, portList) = getBEHostAndHTTPPort()
ipList.each { beid, ip ->
if (ip == host && portList[beid] as int == port) {
return false;
}
}
return true;
});
}

void waiteCreateTableFinished(String tableName) {
Thread.sleep(2000);
String showCreateTable = "SHOW CREATE TABLE ${tableName}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,21 @@ class DebugPoint {
def disableDebugPointForAllFEs(String name) {
operateDebugPointForAllFEs { host, port ->
logger.info("disable debug point ${name} for FE $host:$port")
if (port == -1) {
logger.info("skip for BE $host:$port")
return
}
disableDebugPoint(host, port, NodeType.FE, name)
}
}

def clearDebugPointsForAllFEs() {
operateDebugPointForAllFEs { host, port ->
logger.info("clear debug point for FE $host:$port")
if (port == -1) {
logger.info("skip for BE $host:$port")
return
}
clearDebugPoints(host, port, NodeType.FE)
}
}
Expand Down
8 changes: 6 additions & 2 deletions regression-test/suites/node_p0/test_backend.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ suite("test_backend", "nonConcurrent") {
logger.info("result:${result}")

sql """ALTER SYSTEM ADD BACKEND "${address}:${notExistPort}";"""
waitAddBeFinished(address, notExistPort)

result = sql """SHOW BACKENDS;"""
logger.info("result:${result}")

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

result = sql """SHOW BACKENDS;"""
logger.info("result:${result}")

sql """ALTER SYSTEM DROPP BACKEND "${address}:${notExistPort}";"""
waitDropBeFinished(address, notExistPort)

result = sql """SHOW BACKENDS;"""
logger.info("result:${result}")
Expand Down
4 changes: 4 additions & 0 deletions regression-test/suites/node_p0/test_frontend.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@ suite("test_frontend") {
logger.debug("result:${result}")

sql """ALTER SYSTEM ADD FOLLOWER "${address}:${notExistPort}";"""
waitAddFeFinished(address, notExistPort);
result = sql """SHOW FRONTENDS;"""
logger.debug("result:${result}")

sql """ALTER SYSTEM DROP FOLLOWER "${address}:${notExistPort}";"""
waitDropFeFinished(address, notExistPort);
result = sql """SHOW FRONTENDS;"""
logger.debug("result:${result}")

sql """ALTER SYSTEM ADD OBSERVER "${address}:${notExistPort}";"""
waitAddFeFinished(address, notExistPort);
result = sql """SHOW FRONTENDS;"""
logger.debug("result:${result}")

sql """ALTER SYSTEM DROP OBSERVER "${address}:${notExistPort}";"""
waitDropFeFinished(address, notExistPort);
result = sql """SHOW FRONTENDS;"""
logger.debug("result:${result}")
}
Expand Down

0 comments on commit 4e5c964

Please sign in to comment.