yiguolei commented on code in PR #48187: URL: https://github.com/apache/doris/pull/48187#discussion_r1974724539
########## fe/fe-core/src/main/java/org/apache/doris/datasource/FederationBackendPolicy.java: ########## @@ -154,41 +152,36 @@ public void init() throws UserException { } public void init(List<String> preLocations) throws UserException { - Set<Tag> tags = Sets.newHashSet(); - if (ConnectContext.get() != null && ConnectContext.get().getCurrentUserIdentity() != null) { - String qualifiedUser = ConnectContext.get().getCurrentUserIdentity().getQualifiedUser(); - // Some request from stream load(eg, mysql load) may not set user info in ConnectContext - // just ignore it. - if (!Strings.isNullOrEmpty(qualifiedUser)) { - tags = Env.getCurrentEnv().getAuth().getResourceTags(qualifiedUser); - if (tags == UserProperty.INVALID_RESOURCE_TAGS) { - throw new UserException("No valid resource tag for user: " + qualifiedUser); - } - } - } else { - if (LOG.isDebugEnabled()) { - LOG.debug("user info in ExternalFileScanNode should not be null, add log to observer"); - } - } - // scan node is used for query - BeSelectionPolicy policy = new BeSelectionPolicy.Builder() - .needQueryAvailable() + BeSelectionPolicy.Builder builder = new BeSelectionPolicy.Builder(); + builder.needQueryAvailable() .needLoadAvailable() - .addTags(tags) .preferComputeNode(Config.prefer_compute_node_for_external_table) .assignExpectBeNum(Config.min_backend_num_for_external_table) - .addPreLocations(preLocations) - .build(); - init(policy); + .addPreLocations(preLocations); + init(builder.build()); } public void init(BeSelectionPolicy policy) throws UserException { - backends.addAll(policy.getCandidateBackends(Env.getCurrentSystemInfo() - .getBackendsByCurrentCluster().values().asList())); + ConnectContext ctx = ConnectContext.get(); + if (ctx == null) { + if (Config.isCloudMode()) { + throw new AnalysisException("ConnectContext is null"); + } else { + ctx = new ConnectContext(); + ctx.setThreadLocalInfo(); + } + + } + ComputeGroup computeGroup = ctx.getComputeGroup(); + if (Config.isNotCloudMode() && computeGroup == ComputeGroup.INVALID_COMPUTE_GROUP) { + throw new LoadException(ComputeGroup.INVALID_COMPUTE_GROUP_ERR_MSG); Review Comment: 不要使用 == -- 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