This is an automated email from the ASF dual-hosted git repository. dataroaring 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 8bf3ff4ea2d [Enhancement](Group commit) Remove the redundant `iscloud` parameter (#40120) 8bf3ff4ea2d is described below commit 8bf3ff4ea2dace707af3c1f64e42f7df089630c0 Author: abmdocrt <yukang.lian2...@gmail.com> AuthorDate: Tue Sep 3 10:54:24 2024 +0800 [Enhancement](Group commit) Remove the redundant `iscloud` parameter (#40120) `isCloud` parameter is redundant because we can use `Config.isCloud()` to replace it. --- .../doris/cloud/planner/CloudGroupCommitPlanner.java | 14 -------------- .../main/java/org/apache/doris/httpv2/rest/LoadAction.java | 11 +++++------ .../java/org/apache/doris/load/GroupCommitManager.java | 10 +++++----- .../commands/insert/OlapGroupCommitInsertExecutor.java | 2 +- .../java/org/apache/doris/planner/GroupCommitPlanner.java | 2 +- .../main/java/org/apache/doris/qe/MasterOpExecutor.java | 7 +++---- .../java/org/apache/doris/service/FrontendServiceImpl.java | 2 +- gensrc/thrift/FrontendService.thrift | 1 - 8 files changed, 16 insertions(+), 33 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/cloud/planner/CloudGroupCommitPlanner.java b/fe/fe-core/src/main/java/org/apache/doris/cloud/planner/CloudGroupCommitPlanner.java index 782f78e6bc4..0388ca5c5d6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/cloud/planner/CloudGroupCommitPlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/planner/CloudGroupCommitPlanner.java @@ -18,13 +18,9 @@ package org.apache.doris.cloud.planner; import org.apache.doris.catalog.Database; -import org.apache.doris.catalog.Env; import org.apache.doris.catalog.OlapTable; -import org.apache.doris.common.DdlException; -import org.apache.doris.common.LoadException; import org.apache.doris.common.UserException; import org.apache.doris.planner.GroupCommitPlanner; -import org.apache.doris.qe.ConnectContext; import org.apache.doris.thrift.TUniqueId; import org.apache.logging.log4j.LogManager; @@ -41,14 +37,4 @@ public class CloudGroupCommitPlanner extends GroupCommitPlanner { throws UserException, TException { super(db, table, targetColumnNames, queryId, groupCommit); } - - @Override - protected void selectBackends(ConnectContext ctx) throws DdlException { - try { - backend = Env.getCurrentEnv().getGroupCommitManager() - .selectBackendForGroupCommit(this.table.getId(), ctx, true); - } catch (LoadException e) { - throw new DdlException("No suitable backend"); - } - } } 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 c9681eb7849..1f1c5d965c2 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 @@ -434,7 +434,7 @@ public class LoadAction extends RestBaseController { throw new LoadException(SystemInfoService.NO_BACKEND_LOAD_AVAILABLE_MSG + ", policy: " + policy); } if (groupCommit) { - backend = selectBackendForGroupCommit("", request, tableId, false); + backend = selectBackendForGroupCommit("", request, tableId); } else { backend = Env.getCurrentSystemInfo().getBackend(backendIds.get(0)); } @@ -449,7 +449,7 @@ public class LoadAction extends RestBaseController { throws LoadException { Backend backend = null; if (groupCommit) { - backend = selectBackendForGroupCommit(clusterName, req, tableId, true); + backend = selectBackendForGroupCommit(clusterName, req, tableId); } else { backend = StreamLoadHandler.selectBackend(clusterName); } @@ -665,8 +665,7 @@ public class LoadAction extends RestBaseController { return headers.toString(); } - private Backend selectBackendForGroupCommit(String clusterName, HttpServletRequest req, long tableId, - boolean isCloud) + private Backend selectBackendForGroupCommit(String clusterName, HttpServletRequest req, long tableId) throws LoadException { ConnectContext ctx = new ConnectContext(); ctx.setEnv(Env.getCurrentEnv()); @@ -676,14 +675,14 @@ public class LoadAction extends RestBaseController { // TMasterOpRequest(FrontendService.thrift) ctx.setQualifiedUser(Auth.ADMIN_USER); ctx.setThreadLocalInfo(); - if (isCloud) { + if (Config.isCloudMode()) { ctx.setCloudCluster(clusterName); } Backend backend = null; try { backend = Env.getCurrentEnv().getGroupCommitManager() - .selectBackendForGroupCommit(tableId, ctx, isCloud); + .selectBackendForGroupCommit(tableId, ctx); } catch (DdlException e) { throw new LoadException(e.getMessage(), e); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java b/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java index e4dd77e3e20..717cf0c6103 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java @@ -186,14 +186,14 @@ public class GroupCommitManager { return size; } - public Backend selectBackendForGroupCommit(long tableId, ConnectContext context, boolean isCloud) + public Backend selectBackendForGroupCommit(long tableId, ConnectContext context) throws LoadException, DdlException { // If a group commit request is sent to the follower FE, we will send this request to the master FE. master FE // can select a BE and return this BE id to follower FE. if (!Env.getCurrentEnv().isMaster()) { try { long backendId = new MasterOpExecutor(context) - .getGroupCommitLoadBeId(tableId, context.getCloudCluster(), isCloud); + .getGroupCommitLoadBeId(tableId, context.getCloudCluster()); return Env.getCurrentSystemInfo().getBackend(backendId); } catch (Exception e) { throw new LoadException(e.getMessage()); @@ -201,11 +201,11 @@ public class GroupCommitManager { } else { // Master FE will select BE by itself. return Env.getCurrentSystemInfo() - .getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster(), isCloud)); + .getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster())); } } - public long selectBackendForGroupCommitInternal(long tableId, String cluster, boolean isCloud) + public long selectBackendForGroupCommitInternal(long tableId, String cluster) throws LoadException, DdlException { // Understanding Group Commit and Backend Selection Logic // @@ -237,7 +237,7 @@ public class GroupCommitManager { // a BE is chosen at random. This BE is then recorded along with the mapping of table A and its load level. // This approach ensures that group commits can effectively batch data together // while managing the load on each BE efficiently. - return isCloud ? selectBackendForCloudGroupCommitInternal(tableId, cluster) + return Config.isCloudMode() ? selectBackendForCloudGroupCommitInternal(tableId, cluster) : selectBackendForLocalGroupCommitInternal(tableId); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapGroupCommitInsertExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapGroupCommitInsertExecutor.java index a44528e93b3..239328ce93d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapGroupCommitInsertExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapGroupCommitInsertExecutor.java @@ -120,7 +120,7 @@ public class OlapGroupCommitInsertExecutor extends OlapInsertExecutor { } try { this.coordinator.setGroupCommitBe(Env.getCurrentEnv().getGroupCommitManager() - .selectBackendForGroupCommit(table.getId(), ctx, false)); + .selectBackendForGroupCommit(table.getId(), ctx)); } catch (LoadException | DdlException e) { throw new RuntimeException(e); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java index bc3759d4e62..234f8e99a88 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/GroupCommitPlanner.java @@ -148,7 +148,7 @@ public class GroupCommitPlanner { protected void selectBackends(ConnectContext ctx) throws DdlException { try { backend = Env.getCurrentEnv().getGroupCommitManager() - .selectBackendForGroupCommit(this.table.getId(), ctx, false); + .selectBackendForGroupCommit(this.table.getId(), ctx); } catch (LoadException e) { throw new DdlException("No suitable backend"); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java index eaab01df556..edc174d9d2f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java @@ -102,8 +102,8 @@ public class MasterOpExecutor { waitOnReplaying(); } - public long getGroupCommitLoadBeId(long tableId, String cluster, boolean isCloud) throws Exception { - result = forward(buildGetGroupCommitLoadBeIdParmas(tableId, cluster, isCloud)); + public long getGroupCommitLoadBeId(long tableId, String cluster) throws Exception { + result = forward(buildGetGroupCommitLoadBeIdParmas(tableId, cluster)); waitOnReplaying(); return result.groupCommitLoadBeId; } @@ -244,12 +244,11 @@ public class MasterOpExecutor { return params; } - private TMasterOpRequest buildGetGroupCommitLoadBeIdParmas(long tableId, String cluster, boolean isCloud) { + private TMasterOpRequest buildGetGroupCommitLoadBeIdParmas(long tableId, String cluster) { final TGroupCommitInfo groupCommitParams = new TGroupCommitInfo(); groupCommitParams.setGetGroupCommitLoadBeId(true); groupCommitParams.setGroupCommitLoadTableId(tableId); groupCommitParams.setCluster(cluster); - groupCommitParams.setIsCloud(isCloud); final TMasterOpRequest params = new TMasterOpRequest(); // node ident diff --git a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java index 99bcadee120..cc613cb5d8c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java +++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java @@ -1041,7 +1041,7 @@ public class FrontendServiceImpl implements FrontendService.Iface { final TMasterOpResult result = new TMasterOpResult(); try { result.setGroupCommitLoadBeId(Env.getCurrentEnv().getGroupCommitManager() - .selectBackendForGroupCommitInternal(info.groupCommitLoadTableId, info.cluster, info.isCloud)); + .selectBackendForGroupCommitInternal(info.groupCommitLoadTableId, info.cluster)); } catch (LoadException | DdlException e) { throw new TException(e.getMessage()); } diff --git a/gensrc/thrift/FrontendService.thrift b/gensrc/thrift/FrontendService.thrift index 2dcdf9b7180..2cad1a55e42 100644 --- a/gensrc/thrift/FrontendService.thrift +++ b/gensrc/thrift/FrontendService.thrift @@ -545,7 +545,6 @@ struct TGroupCommitInfo{ 1: optional bool getGroupCommitLoadBeId 2: optional i64 groupCommitLoadTableId 3: optional string cluster - 4: optional bool isCloud 5: optional bool updateLoadData 6: optional i64 tableId 7: optional i64 receiveData --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org