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 5c8bf511955 Revert "[Enhancement](wal) modify wal api which hard to 
use (#38895)"
5c8bf511955 is described below

commit 5c8bf511955c233e47b7e67c68dd7ea0d0aedd87
Author: Yongqiang YANG <[email protected]>
AuthorDate: Thu Aug 8 16:04:05 2024 +0800

    Revert "[Enhancement](wal) modify wal api which hard to use (#38895)"
    
    This reverts commit 1ceb91e308fd34f0ba6e08b6807aab641ee10f6e.
---
 .../doris/httpv2/rest/CheckWalSizeAction.java      | 50 ++++++++++------------
 1 file changed, 23 insertions(+), 27 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/CheckWalSizeAction.java 
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/CheckWalSizeAction.java
index 6b52ef3f35a..fdc39e8badd 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/CheckWalSizeAction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/CheckWalSizeAction.java
@@ -61,40 +61,36 @@ public class CheckWalSizeAction extends RestBaseController {
         checkGlobalAuth(ConnectContext.get().getCurrentUserIdentity(), 
PrivPredicate.OPERATOR);
 
         String hostPorts = request.getParameter(HOST_PORTS);
-        List<Backend> backends = new ArrayList<>();
         if (Strings.isNullOrEmpty(hostPorts)) {
+            return ResponseEntityBuilder.badRequest("No host:port specified");
+        }
+
+        String[] hostPortArr = hostPorts.split(",");
+        if (hostPortArr.length == 0) {
+            return ResponseEntityBuilder.badRequest("No host:port specified");
+        }
+
+        List<HostInfo> hostInfos = Lists.newArrayList();
+        for (String hostPort : hostPortArr) {
             try {
-                backends = 
Env.getCurrentSystemInfo().getAllBackendsByAllCluster().values().asList();
+                HostInfo hostInfo = SystemInfoService.getHostAndPort(hostPort);
+                hostInfos.add(hostInfo);
             } catch (AnalysisException e) {
-                return ResponseEntityBuilder.okWithCommonError(e.getMessage());
-            }
-        } else {
-            String[] hostPortArr = hostPorts.split(",");
-            if (hostPortArr.length == 0) {
-                return ResponseEntityBuilder.badRequest("No host:port 
specified");
-            }
-            List<HostInfo> hostInfos = new ArrayList<>();
-            for (String hostPort : hostPortArr) {
-                try {
-                    HostInfo hostInfo = 
SystemInfoService.getHostAndPort(hostPort);
-                    hostInfos.add(hostInfo);
-                } catch (AnalysisException e) {
-                    return ResponseEntityBuilder.badRequest(e.getMessage());
-                }
-            }
-            try {
-                backends = getBackends(hostInfos);
-            } catch (DdlException e) {
-                return ResponseEntityBuilder.okWithCommonError(e.getMessage());
+                return ResponseEntityBuilder.badRequest(e.getMessage());
             }
         }
 
-        List<String> backendsList = new ArrayList<>();
-        for (Backend backend : backends) {
-            long size = 
Env.getCurrentEnv().getGroupCommitManager().getAllWalQueueSize(backend);
-            backendsList.add(backend.getHost() + ":" + 
backend.getHeartbeatPort() + ":" + size);
+        try {
+            List<Backend> backends = getBackends(hostInfos);
+            List<String> backendsList = new ArrayList<>();
+            for (Backend backend : backends) {
+                long size = 
Env.getCurrentEnv().getGroupCommitManager().getAllWalQueueSize(backend);
+                backendsList.add(backend.getHost() + ":" + 
backend.getHeartbeatPort() + ":" + size);
+            }
+            return ResponseEntityBuilder.ok(backendsList);
+        } catch (DdlException e) {
+            return ResponseEntityBuilder.okWithCommonError(e.getMessage());
         }
-        return ResponseEntityBuilder.ok(backendsList);
     }
 
     private List<Backend> getBackends(List<HostInfo> hostInfos) throws 
DdlException {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to