This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new a135b049906 branch-3.0: [fix](cloud) Add more log for backend and
disable cloud cluster status (#42901)
a135b049906 is described below
commit a135b049906eccababf31588398af252f93af39d
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 7 14:09:16 2024 +0800
branch-3.0: [fix](cloud) Add more log for backend and disable cloud cluster
status (#42901)
PR Body: api request from non-master
Cherry-picked from #42442
Co-authored-by: deardeng <[email protected]>
---
.../doris/httpv2/rest/manager/ClusterAction.java | 68 ++++++++++++++++------
.../main/java/org/apache/doris/system/Backend.java | 13 ++---
2 files changed, 54 insertions(+), 27 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/ClusterAction.java
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/ClusterAction.java
index 95934d31dee..5d5b083664e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/ClusterAction.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/ClusterAction.java
@@ -28,6 +28,9 @@ import org.apache.doris.qe.ConnectContext;
import org.apache.doris.system.Frontend;
import com.google.common.collect.Maps;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@@ -44,6 +47,7 @@ import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping(path = {"/rest/v2/manager/cluster",
"/rest/v2/manager/compute_group"})
public class ClusterAction extends RestBaseController {
+ private static final Logger LOG =
LogManager.getLogger(ClusterAction.class);
// Returns mysql and http connection information for the cluster.
// {
@@ -83,32 +87,58 @@ public class ClusterAction extends RestBaseController {
public volatile int brpcPort;
public volatile long currentFragmentNum = 0;
public volatile long lastFragmentUpdateTime = 0;
+
+ @Override
+ public String toString() {
+ return "BeClusterInfo{"
+ + "host='" + host + '\''
+ + ", heartbeatPort=" + heartbeatPort
+ + ", bePort=" + bePort
+ + ", httpPort=" + httpPort
+ + ", brpcPort=" + brpcPort
+ + ", currentFragmentNum=" + currentFragmentNum
+ + ", lastFragmentUpdateTime=" + lastFragmentUpdateTime
+ + '}';
+ }
}
@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);
+ ResponseEntity ret = null;
+ try {
+ if (!Env.getCurrentEnv().isMaster()) {
+ ret = ResponseEntityBuilder.badRequest("this api just use in
cloud master fe");
+ } else {
+ executeCheckPassword(request, response);
+ checkGlobalAuth(ConnectContext.get().getCurrentUserIdentity(),
PrivPredicate.ADMIN);
- // Key: cluster_name Value: be status
- Map<String, List<BeClusterInfo>> result = Maps.newHashMap();
+ // Key: cluster_name Value: be status
+ Map<String, List<BeClusterInfo>> result = Maps.newHashMap();
- ((CloudSystemInfoService)
Env.getCurrentSystemInfo()).getCloudClusterIdToBackend()
- .forEach((clusterId, backends) -> {
- List<BeClusterInfo> bis = backends.stream().map(backend ->
{
- BeClusterInfo bi = new BeClusterInfo();
- bi.host = backend.getHost();
- bi.heartbeatPort = backend.getHeartbeatPort();
- bi.bePort = backend.getBePort();
- bi.httpPort = backend.getHttpPort();
- bi.brpcPort = backend.getBrpcPort();
- bi.currentFragmentNum =
backend.getBackendStatus().currentFragmentNum;
- bi.lastFragmentUpdateTime =
backend.getBackendStatus().lastFragmentUpdateTime;
- return bi; }).collect(Collectors.toList());
- result.put(clusterId, bis);
- });
+ ((CloudSystemInfoService)
Env.getCurrentSystemInfo()).getCloudClusterIdToBackend()
+ .forEach((clusterId, backends) -> {
+ List<BeClusterInfo> bis =
backends.stream().map(backend -> {
+ BeClusterInfo bi = new BeClusterInfo();
+ bi.host = backend.getHost();
+ bi.heartbeatPort = backend.getHeartbeatPort();
+ bi.bePort = backend.getBePort();
+ bi.httpPort = backend.getHttpPort();
+ bi.brpcPort = backend.getBrpcPort();
+ bi.currentFragmentNum =
backend.getBackendStatus().currentFragmentNum;
+ bi.lastFragmentUpdateTime =
backend.getBackendStatus().lastFragmentUpdateTime;
+ return bi;
+ }).collect(Collectors.toList());
+ result.put(clusterId, bis);
+ });
- return ResponseEntityBuilder.ok(result);
+ ret = ResponseEntityBuilder.ok(result);
+ }
+ } finally {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("request {}, response {}", request.getRequestURI(),
ret);
+ }
+ }
+ return ret;
}
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java
b/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java
index b0304648b73..da55ecee0de 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java
@@ -797,13 +797,8 @@ public class Backend implements Writable {
public String toString() {
return "Backend [id=" + id + ", host=" + host + ", heartbeatPort=" +
heartbeatPort + ", alive=" + isAlive.get()
+ ", lastStartTime=" +
TimeUtils.longToTimeString(lastStartTime) + ", process epoch=" + lastStartTime
- + ", isDecommissioned=" + isDecommissioned + ", tags: " +
tagMap + "]";
- }
-
- public String getHealthyStatus() {
- return "Backend [id=" + id + ", isDecommission: " + isDecommissioned
- + ", backendStatus: " + backendStatus + ", isAlive: " +
isAlive.get() + ", lastUpdateTime: "
- + TimeUtils.longToTimeString(lastUpdateMs);
+ + ", isDecommissioned=" + isDecommissioned + ", tags: " +
tagMap + "]"
+ + ", backendStatus: " + backendStatus;
}
/**
@@ -945,7 +940,9 @@ public class Backend implements Writable {
public String toString() {
return "[" + "lastSuccessReportTabletsTime='" +
lastSuccessReportTabletsTime + '\''
+ ", lastStreamLoadTime=" + lastStreamLoadTime + ",
isQueryDisabled=" + isQueryDisabled
- + ", isLoadDisabled=" + isLoadDisabled + "]";
+ + ", isLoadDisabled=" + isLoadDisabled
+ + ", currentFragmentNum=" + currentFragmentNum
+ + ", lastFragmentUpdateTime=" + lastFragmentUpdateTime +
"]";
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]