Skip to content

Commit a6b823a

Browse files
committed
pr + 1
1 parent 43eb1fb commit a6b823a

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

fe/fe-core/src/main/java/org/apache/doris/cloud/load/CloudBrokerLoadJob.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ private void setCloudClusterId() throws MetaNotFoundException {
9595
try {
9696
clusterName = context.getCloudCluster();
9797
} catch (ComputeGroupException e) {
98-
LOG.warn("error happens when get cloud cluster", e);
99-
throw new MetaNotFoundException("error happens when get cloud cluster " + e);
98+
LOG.warn("failed to get compute group name", e);
99+
throw new MetaNotFoundException("failed to get compute group name " + e);
100100
}
101101
if (Strings.isNullOrEmpty(clusterName)) {
102-
LOG.warn("can not find a valid compute group");
103-
throw new MetaNotFoundException("can not find a valid compute group");
102+
LOG.warn("compute group name is empty");
103+
throw new MetaNotFoundException("compute group name is empty");
104104
}
105105

106106
this.cloudClusterId = ((CloudSystemInfoService) Env.getCurrentSystemInfo())
107107
.getCloudClusterIdByName(clusterName);
108108
if (Strings.isNullOrEmpty(this.cloudClusterId)) {
109-
LOG.warn("can not find cluster: {}", clusterName);
110-
throw new MetaNotFoundException("can not find cluster: " + clusterName);
109+
LOG.warn("can not find compute group: {}", clusterName);
110+
throw new MetaNotFoundException("can not find compute group: " + clusterName);
111111
}
112112
sessionVariables.put(CLOUD_CLUSTER_ID, this.cloudClusterId);
113113
}
@@ -122,6 +122,7 @@ private AutoCloseConnectContext buildConnectContext() throws UserException {
122122
throw new UserException("cluster name is empty, cluster id is: " + cloudClusterId);
123123
}
124124

125+
// NOTE: set user info in context in for auth check in CloudReplica
125126
if (ConnectContext.get() == null) {
126127
ConnectContext connectContext = new ConnectContext();
127128
connectContext.setCloudCluster(clusterName);

fe/fe-core/src/main/java/org/apache/doris/cloud/load/CloudLoadLoadingTask.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@
2525
import org.apache.doris.cloud.system.CloudSystemInfoService;
2626
import org.apache.doris.common.UserException;
2727
import org.apache.doris.common.profile.Profile;
28-
import org.apache.doris.common.util.DebugUtil;
2928
import org.apache.doris.load.BrokerFileGroup;
3029
import org.apache.doris.load.loadv2.LoadLoadingTask;
3130
import org.apache.doris.load.loadv2.LoadTaskCallback;
3231
import org.apache.doris.qe.AutoCloseConnectContext;
3332
import org.apache.doris.qe.ConnectContext;
3433

3534
import com.google.common.base.Strings;
36-
import org.apache.commons.lang3.StringUtils;
3735
import org.apache.logging.log4j.LogManager;
3836
import org.apache.logging.log4j.Logger;
3937

@@ -66,6 +64,7 @@ private AutoCloseConnectContext buildConnectContext() throws UserException {
6664
throw new UserException("cluster name is empty, cluster id is: " + this.cloudClusterId);
6765
}
6866

67+
// NOTE: set user info here for the following text auth check.
6968
if (ConnectContext.get() == null) {
7069
ConnectContext connectContext = new ConnectContext();
7170
connectContext.setCloudCluster(clusterName);
@@ -83,11 +82,6 @@ private AutoCloseConnectContext buildConnectContext() throws UserException {
8382
@Override
8483
protected void executeOnce() throws Exception {
8584
try (AutoCloseConnectContext r = buildConnectContext()) {
86-
if (ConnectContext.get().getCurrentUserIdentity() == null || StringUtils.isEmpty(
87-
ConnectContext.get().getCurrentUserIdentity().getQualifiedUser())) {
88-
LOG.warn("user is empty for cloud load job {}, job user is {} ", DebugUtil.printId(this.getLoadId()),
89-
this.userInfo.getQualifiedUser());
90-
}
9185
super.executeOnce();
9286
}
9387
}

fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,26 +1408,32 @@ public String getCloudCluster(boolean updateErr) throws ComputeGroupException {
14081408
String sessionCluster = getSessionVariable().getCloudCluster();
14091409
if (!Strings.isNullOrEmpty(sessionCluster)) {
14101410
choseWay = "use session";
1411-
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'",
1412-
sessionCluster, getCurrentUserIdentity(), choseWay);
1411+
if (LOG.isDebugEnabled()) {
1412+
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'",
1413+
sessionCluster, getCurrentUserIdentity(), choseWay);
1414+
}
14131415
return sessionCluster;
14141416
}
14151417

14161418
// 2 get cluster from user
14171419
String userPropCluster = getDefaultCloudClusterFromUser();
14181420
if (!StringUtils.isEmpty(userPropCluster)) {
14191421
choseWay = "user property";
1420-
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'", userPropCluster,
1421-
getCurrentUserIdentity(), choseWay);
1422+
if (LOG.isDebugEnabled()) {
1423+
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'", userPropCluster,
1424+
getCurrentUserIdentity(), choseWay);
1425+
}
14221426
return userPropCluster;
14231427
}
14241428

14251429
// 3 get cluster from a cached variable in connect context
14261430
// this value comes from a cluster selection policy
14271431
if (!Strings.isNullOrEmpty(this.cloudCluster)) {
14281432
choseWay = "user selection policy";
1429-
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'",
1430-
cloudCluster, getCurrentUserIdentity(), choseWay);
1433+
if (LOG.isDebugEnabled()) {
1434+
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'",
1435+
cloudCluster, getCurrentUserIdentity(), choseWay);
1436+
}
14311437
return cloudCluster;
14321438
}
14331439

@@ -1455,8 +1461,10 @@ public String getCloudCluster(boolean updateErr) throws ComputeGroupException {
14551461
this.cloudCluster = policyCluster;
14561462
}
14571463

1458-
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'", this.cloudCluster,
1459-
getCurrentUserIdentity(), choseWay);
1464+
if (LOG.isDebugEnabled()) {
1465+
LOG.debug("finally set context compute group name {} for user {} with chose way '{}'", this.cloudCluster,
1466+
getCurrentUserIdentity(), choseWay);
1467+
}
14601468

14611469
return this.cloudCluster;
14621470
}

0 commit comments

Comments
 (0)