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

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


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

commit 67e62517022b746a8a89f5b3f5485a988e6ddde5
Author: wangbo <[email protected]>
AuthorDate: Tue Nov 28 14:07:18 2023 +0800

    select coordinator node from user's tag when exec streaming load (#27106) 
(#27677)
---
 .../src/main/java/org/apache/doris/httpv2/rest/LoadAction.java    | 8 +++++++-
 1 file changed, 7 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 9bfbbccfa8a..b358ea60b9a 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
@@ -27,6 +27,7 @@ import org.apache.doris.httpv2.entity.RestBaseResult;
 import org.apache.doris.httpv2.exception.UnauthorizedException;
 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;
@@ -46,6 +47,7 @@ import org.springframework.web.servlet.view.RedirectView;
 
 import java.net.URI;
 import java.util.List;
+import java.util.Set;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -227,7 +229,11 @@ public class LoadAction extends RestBaseController {
     }
 
     private TNetworkAddress selectRedirectBackend(String clusterName) throws 
LoadException {
-        BeSelectionPolicy policy = new 
BeSelectionPolicy.Builder().needLoadAvailable().build();
+        String qualifiedUser = ConnectContext.get().getQualifiedUser();
+        Set<Tag> userTags = 
Env.getCurrentEnv().getAuth().getResourceTags(qualifiedUser);
+        BeSelectionPolicy 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);


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

Reply via email to