This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d9b6462bf6 [improve](group_commit) optimize group commit select be 
logic #28190
9d9b6462bf6 is described below

commit 9d9b6462bf64d64e8d012eba1a401f12098ffe46
Author: HHoflittlefish777 <[email protected]>
AuthorDate: Sat Dec 9 05:09:52 2023 +0800

    [improve](group_commit) optimize group commit select be logic #28190
    
    Group commit choose be always first no decommissioned be in all be.
    
    Choose be with selectBackendIdsByPolicy like common stream load and do not 
choose decommissioned be may be better.
---
 .../org/apache/doris/httpv2/rest/LoadAction.java    | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/LoadAction.java 
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/LoadAction.java
index 32757f2894f..21778862166 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/LoadAction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/LoadAction.java
@@ -335,9 +335,17 @@ public class LoadAction extends RestBaseController {
     private TNetworkAddress selectRedirectBackend(String clusterName, boolean 
groupCommit) throws LoadException {
         Backend backend = null;
         BeSelectionPolicy policy = null;
+        String qualifiedUser = ConnectContext.get().getQualifiedUser();
+        Set<Tag> userTags = 
Env.getCurrentEnv().getAuth().getResourceTags(qualifiedUser);
+        policy = new BeSelectionPolicy.Builder()
+                .addTags(userTags)
+                .needLoadAvailable().build();
+        List<Long> backendIds = 
Env.getCurrentSystemInfo().selectBackendIdsByPolicy(policy, 1);
+        if (backendIds.isEmpty()) {
+            throw new 
LoadException(SystemInfoService.NO_BACKEND_LOAD_AVAILABLE_MSG + ", policy: " + 
policy);
+        }
         if (groupCommit) {
-            List<Long> allBackendIds = 
Env.getCurrentSystemInfo().getAllBackendIds(true);
-            for (Long backendId : allBackendIds) {
+            for (Long backendId : backendIds) {
                 Backend candidateBe = 
Env.getCurrentSystemInfo().getBackend(backendId);
                 if (!candidateBe.isDecommissioned()) {
                     backend = candidateBe;
@@ -345,15 +353,6 @@ public class LoadAction extends RestBaseController {
                 }
             }
         } else {
-            String qualifiedUser = ConnectContext.get().getQualifiedUser();
-            Set<Tag> userTags = 
Env.getCurrentEnv().getAuth().getResourceTags(qualifiedUser);
-            policy = new BeSelectionPolicy.Builder()
-                    .addTags(userTags)
-                    .needLoadAvailable().build();
-            List<Long> backendIds = 
Env.getCurrentSystemInfo().selectBackendIdsByPolicy(policy, 1);
-            if (backendIds.isEmpty()) {
-                throw new 
LoadException(SystemInfoService.NO_BACKEND_LOAD_AVAILABLE_MSG + ", policy: " + 
policy);
-            }
             backend = Env.getCurrentSystemInfo().getBackend(backendIds.get(0));
         }
         if (backend == null) {


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

Reply via email to