dataroaring commented on code in PR #37157:
URL: https://github.com/apache/doris/pull/37157#discussion_r1677097333


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/StorageVaultMgr.java:
##########
@@ -176,7 +179,14 @@ public void createHdfsVault(StorageVault vault) throws 
DdlException {
     }
 
     private void alterSyncVaultTask() {
-        systemInfoService.getAllBackends().forEach(backend -> {
+        List<Backend> bes;
+        try {
+            bes = systemInfoService.getBackendsByCurrentCluster();

Review Comment:
   Need check if backends in current cluster is enough.



##########
fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java:
##########
@@ -180,7 +180,13 @@ public Rebalancer getRebalancer() {
      * update working slots at the beginning of each round
      */
     private boolean updateWorkingSlots() {
-        ImmutableMap<Long, Backend> backends = infoService.getAllBackendsMap();
+        ImmutableMap<Long, Backend> backends;
+        try {
+            backends = infoService.getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/common/proc/TabletsProcDir.java:
##########
@@ -65,10 +65,11 @@ public TabletsProcDir(Table table, MaterializedIndex index) 
{
         this.index = index;
     }
 
-    public List<List<Comparable>> fetchComparableResult(long version, long 
backendId, Replica.ReplicaState state) {
+    public List<List<Comparable>> fetchComparableResult(long version, long 
backendId, Replica.ReplicaState state)
+            throws AnalysisException {
         Preconditions.checkNotNull(table);
         Preconditions.checkNotNull(index);
-        ImmutableMap<Long, Backend> backendMap = 
Env.getCurrentSystemInfo().getIdToBackend();
+        ImmutableMap<Long, Backend> backendMap = 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/NodeAction.java:
##########
@@ -627,7 +627,7 @@ public Object operateBackend(HttpServletRequest request, 
HttpServletResponse res
             } else if ("DROP".equals(action)) {
                 currentSystemInfo.dropBackends(hostInfos);
             } else if ("DECOMMISSION".equals(action)) {
-                ImmutableMap<Long, Backend> backendsInCluster = 
currentSystemInfo.getAllBackendsMap();
+                ImmutableMap<Long, Backend> backendsInCluster = 
currentSystemInfo.getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/StatisticAction.java:
##########
@@ -80,7 +81,13 @@ private int getTblCount(Env env) {
 
     private long getDiskOccupancy(SystemInfoService infoService) {
         long diskOccupancy = 0;
-        List<Backend> backends = infoService.getAllBackends();
+        List<Backend> backends;
+        try {
+            backends = infoService.getBackendsByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/policy/PolicyMgr.java:
##########
@@ -731,7 +731,7 @@ public void alterPolicy(AlterPolicyStmt stmt) throws 
DdlException, AnalysisExcep
         // log alter
         Env.getCurrentEnv().getEditLog().logAlterStoragePolicy(storagePolicy);
         AgentBatchTask batchTask = new AgentBatchTask();
-        for (long backendId : 
Env.getCurrentSystemInfo().getIdToBackend().keySet()) {
+        for (long backendId : 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster().keySet()) {

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/cache/CacheCoordinator.java:
##########
@@ -110,7 +111,7 @@ public void resetBackend() {
         }
         try {
             belock.lock();
-            ImmutableMap<Long, Backend> idToBackend = 
Env.getCurrentSystemInfo().getIdToBackend();
+            ImmutableMap<Long, Backend> idToBackend = 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/common/util/AutoBucketUtils.java:
##########
@@ -50,7 +57,13 @@ private static int getBENum() {
 
     private static int getBucketsNumByBEDisks() {
         SystemInfoService infoService = Env.getCurrentSystemInfo();
-        ImmutableMap<Long, Backend> backends = infoService.getAllBackendsMap();
+        ImmutableMap<Long, Backend> backends;
+        try {
+            backends = infoService.getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking too.



##########
fe/fe-core/src/main/java/org/apache/doris/common/publish/ClusterStatePublisher.java:
##########
@@ -62,8 +63,8 @@ public static ClusterStatePublisher getInstance() {
         return INSTANCE;
     }
 
-    public void publish(ClusterStateUpdate state, Listener listener, int 
timeoutMs) {
-        Collection<Backend> nodesToPublish = 
clusterInfoService.getIdToBackend().values();
+    public void publish(ClusterStateUpdate state, Listener listener, int 
timeoutMs) throws UserException {
+        Collection<Backend> nodesToPublish = 
clusterInfoService.getBackendsWithIdByCurrentCluster().values();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/common/proc/TrashProcDir.java:
##########
@@ -50,7 +50,13 @@ public class TrashProcDir implements ProcDirInterface {
     private List<Backend> backends = Lists.newArrayList();
 
     public TrashProcDir() {
-        ImmutableMap<Long, Backend> backendsInfo = 
Env.getCurrentSystemInfo().getIdToBackend();
+        ImmutableMap<Long, Backend> backendsInfo;
+        try {
+            backendsInfo = 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/metric/SimpleCoreMetricVisitor.java:
##########
@@ -128,8 +131,14 @@ public void visitHistogram(String prefix, String name, 
Histogram histogram) {
     @Override
     public void visitNodeInfo() {
         long feDeadNum = 
Env.getCurrentEnv().getFrontends(null).stream().filter(f -> 
!f.isAlive()).count();
-        long beDeadNum = 
Env.getCurrentSystemInfo().getIdToBackend().values().stream().filter(b -> 
!b.isAlive())
-                .count();
+        long beDeadNum = 0;
+        try {
+            beDeadNum = 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster()
+                    .values().stream().filter(b -> !b.isAlive())

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/TabletStatMgr.java:
##########
@@ -51,7 +52,13 @@ public TabletStatMgr() {
 
     @Override
     protected void runAfterCatalogReady() {
-        ImmutableMap<Long, Backend> backends = 
Env.getCurrentSystemInfo().getIdToBackend();
+        ImmutableMap<Long, Backend> backends;
+        try {
+            backends = 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java:
##########
@@ -57,8 +58,8 @@ public ReplicasProcNode(long tabletId, List<Replica> 
replicas) {
     }
 
     @Override
-    public ProcResult fetchResult() {
-        ImmutableMap<Long, Backend> backendMap = 
Env.getCurrentSystemInfo().getIdToBackend();
+    public ProcResult fetchResult() throws AnalysisException {
+        ImmutableMap<Long, Backend> backendMap = 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/common/publish/TopicPublisherThread.java:
##########
@@ -73,7 +73,13 @@ protected void runAfterCatalogReady() {
         // because it may means workload group/policy is dropped
 
         // step 2: publish topic info to all be
-        Collection<Backend> nodesToPublish = 
clusterInfoService.getIdToBackend().values();
+        Collection<Backend> nodesToPublish;
+        try {
+            nodesToPublish = 
clusterInfoService.getAllBackendsWithIdByAllCluster().values();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/StatisticAction.java:
##########
@@ -89,7 +96,13 @@ private long getDiskOccupancy(SystemInfoService infoService) 
{
 
     private long getRemainDisk(SystemInfoService infoService) {
         long remainDisk = 0;
-        List<Backend> backends = infoService.getAllBackends();
+        List<Backend> backends;
+        try {
+            backends = infoService.getBackendsByCurrentCluster();
+        } catch (UserException e) {

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/load/StreamLoadRecordMgr.java:
##########
@@ -239,7 +240,13 @@ private void writeUnlock() {
 
     @Override
     protected void runAfterCatalogReady() {
-        ImmutableMap<Long, Backend> backends = 
Env.getCurrentSystemInfo().getIdToBackend();
+        ImmutableMap<Long, Backend> backends;
+        try {
+            backends = 
Env.getCurrentSystemInfo().getAllBackendsWithIdByAllCluster();
+        } catch (AnalysisException e) {
+            LOG.warn("Failed to load backends from system info", e);
+            return;
+        }

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -2824,7 +2824,7 @@ private void handleShowLastInsert() {
 
     private void handleAdminShowTabletStorageFormat() throws AnalysisException 
{
         List<List<String>> resultRowSet = Lists.newArrayList();
-        for (Backend be : 
Env.getCurrentSystemInfo().getIdToBackend().values()) {
+        for (Backend be : 
Env.getCurrentSystemInfo().getBackendsWithIdByCurrentCluster().values()) {

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/QueryCancelWorker.java:
##########
@@ -33,7 +38,13 @@ public QueryCancelWorker(SystemInfoService 
systemInfoService) {
 
     @Override
     protected void runAfterCatalogReady() {
-        List<Backend> allBackends = systemInfoService.getAllBackends();
+        List<Backend> allBackends;
+        try {
+            allBackends = 
systemInfoService.getAllBackendsWithIdByAllCluster().values().asList();

Review Comment:
   Need checking.



##########
fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java:
##########
@@ -3776,7 +3776,7 @@ private TGetBackendMetaResult 
getBackendMetaImpl(TGetBackendMetaRequest request,
             result.setStatus(new TStatus(TStatusCode.OK));
 
             final SystemInfoService systemInfoService = 
Env.getCurrentSystemInfo();
-            List<Backend> backends = systemInfoService.getAllBackends();
+            List<Backend> backends = 
systemInfoService.getBackendsByCurrentCluster();

Review Comment:
   Need checking.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to