924060929 commented on code in PR #70858:
URL: https://github.com/apache/doris/pull/70858#discussion_r4662646560
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java:
##########
@@ -352,9 +352,8 @@ public AbstractInsertExecutor initPlan(ConnectContext ctx,
StmtExecutor stmtExec
}
stmtExecutor.setProfileType(ProfileType.LOAD);
// We exposed @StmtExecutor#cancel as a unified entry point for
statement interruption,
- // so we need to set this here
+ // so executeSingleInsert publishes the coordinator at its common
execution boundary.
Review Comment:
This is a cherry-pick of #68283. Empty overwrite cancellation in
`executeEmptyInsert()` is a preexisting limitation outside the scope of #68283,
and we want to keep this backport aligned with master.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/AbstractInsertExecutor.java:
##########
@@ -267,13 +267,32 @@ private void checkStrictModeAndFilterRatio() throws
Exception {
*/
public void executeSingleInsert(StmtExecutor executor) throws Exception {
try {
+ // Every statement-owned insert coordinator is published at the
common execution boundary.
+ // Cancellation retained during planning is replayed before any
executor-specific setup or dispatch.
+ executor.setCoord(coordinator);
+ // Publication synchronously replays any cancellation retained
during planning. Fence on that
+ // terminal status before executor-specific setup runs, so a later
setup failure cannot mask the
+ // original timeout/cancel reason.
+ Status execStatus = coordinator.getExecStatus();
+ if (!execStatus.ok()) {
+ throw new UserException(execStatus.getErrorMsg());
+ }
+ // Pre-execution work may register external resources, so it must
share the transaction cleanup scope.
beforeExec();
executor.updateProfile(false);
execImpl(executor);
checkStrictModeAndFilterRatio();
for (InsertExecutorListener listener : listeners) {
listener.beforeComplete(this, executor, jobId);
}
+ // Every transaction-owning executor commits inside onComplete().
Re-fence the first terminal
+ // status here so a cancellation/TIMEOUT that landed after
execImpl()'s last status read cannot
+ // be committed by a path such as row-level UPDATE/DELETE/MERGE,
which has no command-level
+ // cancellation listener of its own.
+ Status preCommitStatus = coordinator.getExecStatus();
Review Comment:
This is a cherry-pick of #68283. Making cancellation strictly atomic with
transaction commit in `GlobalTransactionMgr` / external metastores is a
preexisting limitation and out of scope for #68283; the pre-commit check here
intentionally mirrors master.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/AbstractInsertExecutor.java:
##########
@@ -267,13 +267,32 @@ private void checkStrictModeAndFilterRatio() throws
Exception {
*/
public void executeSingleInsert(StmtExecutor executor) throws Exception {
try {
+ // Every statement-owned insert coordinator is published at the
common execution boundary.
+ // Cancellation retained during planning is replayed before any
executor-specific setup or dispatch.
+ executor.setCoord(coordinator);
+ // Publication synchronously replays any cancellation retained
during planning. Fence on that
+ // terminal status before executor-specific setup runs, so a later
setup failure cannot mask the
+ // original timeout/cancel reason.
+ Status execStatus = coordinator.getExecStatus();
+ if (!execStatus.ok()) {
+ throw new UserException(execStatus.getErrorMsg());
Review Comment:
This matches #68283 on master. Keeping the exact error handling behavior to
stay consistent with master in this backport.
##########
fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java:
##########
@@ -795,8 +799,12 @@ public void exec() throws Exception {
// AllBackendComputeGroup may assocatiate with multiple
workload groups
queryQueue = wgs.get(0).getQueryQueue();
queueToken =
queryQueue.getToken(context.getSessionVariable().wgQuerySlotCount);
- queueToken.get(DebugUtil.printId(queryId),
- this.queryOptions.getExecutionTimeout() * 1000);
+ try {
+ queueToken.get(DebugUtil.printId(queryId),
Review Comment:
This is a cherry-pick of #68283. The queue-token publication race in
`Coordinator.exec()` / `NereidsCoordinator.enqueue()` is a preexisting
limitation not introduced by this PR, and is out of scope for this backport.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]