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

wangbo pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new c89ccaec419 select coordinator node from user's tag when exec 
streaming load (#27106) (#27680)
c89ccaec419 is described below

commit c89ccaec4192a772fc6fa8bb1bcfc3b1d13b4c06
Author: wangbo <[email protected]>
AuthorDate: Tue Nov 28 14:07:55 2023 +0800

    select coordinator node from user's tag when exec streaming load (#27106) 
(#27680)
---
 .../src/main/java/org/apache/doris/httpv2/rest/LoadAction.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 b5ca33b0583..09988aad1ba 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
@@ -26,6 +26,7 @@ import org.apache.doris.httpv2.entity.ResponseEntityBuilder;
 import org.apache.doris.httpv2.entity.RestBaseResult;
 import org.apache.doris.mysql.privilege.PrivPredicate;
 import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.resource.Tag;
 import org.apache.doris.service.ExecuteEnv;
 import org.apache.doris.system.Backend;
 import org.apache.doris.system.BeSelectionPolicy;
@@ -44,6 +45,7 @@ import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.view.RedirectView;
 
 import java.util.List;
+import java.util.Set;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -196,7 +198,12 @@ public class LoadAction extends RestBaseController {
     }
 
     private TNetworkAddress selectRedirectBackend(String clusterName) throws 
LoadException {
-        BeSelectionPolicy policy = new 
BeSelectionPolicy.Builder().setCluster(clusterName).needLoadAvailable().build();
+        String qualifiedUser = ConnectContext.get().getQualifiedUser();
+        Set<Tag> userTags = 
Env.getCurrentEnv().getAuth().getResourceTags(qualifiedUser);
+        BeSelectionPolicy policy = new BeSelectionPolicy.Builder()
+                .setCluster(clusterName)
+                .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);


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

Reply via email to