924060929 commented on code in PR #66530:
URL: https://github.com/apache/doris/pull/66530#discussion_r3781664494
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -354,13 +355,25 @@ private void exec(Set<String> refreshPartitionNames,
throw new JobException(ctx.getState().getErrorMessage());
}
} finally {
- if (executor != null) {
- AuditLogHelper.logAuditLog(ctx,
getDummyStmt(refreshPartitionNames),
- executor.getParsedStmt(),
executor.getQueryStatisticsForAuditLog(), true);
+ try {
+ if (executor != null) {
+ AuditLogHelper.logAuditLog(ctx,
getDummyStmt(refreshPartitionNames),
+ executor.getParsedStmt(),
executor.getQueryStatisticsForAuditLog(), true);
+ }
+ } finally {
+ closeExecutionContext(ctx);
}
}
}
+ private static void closeExecutionContext(ConnectContext ctx) {
+ try {
+ ctx.getStatementContext().close();
+ } finally {
+ ConnectContext.remove();
Review Comment:
Fixed in 26f6d5dfba6. The task context now owns the snapshot pin captured by
: those snapshots are installed on the task , every chunk execution receives
that parent context, and the child cleanup restores it before the next .
Therefore both bookkeeping and the actual scan continue to observe S1 even if
the source advances to S2 between chunks. exercises two successive child
contexts and verifies still resolves the pinned snapshot after each child.
Local result: TaskProcessorTest 5/5 passed; the master FE Maven reactor and
Checkstyle passed.
##########
fe/fe-core/src/main/java/org/apache/doris/job/executor/TaskProcessor.java:
##########
@@ -82,6 +84,22 @@ private void runTask(AbstractTask task) {
task.runTask();
} catch (Exception e) {
log.warn("Execute task error, task id: {}", task.getTaskId(), e);
+ } finally {
+ closeTaskContext();
+ }
+ }
+
+ private void closeTaskContext() {
+ ConnectContext connectContext = ConnectContext.get();
Review Comment:
Completed the per-execution cleanup in 26f6d5dfba6. Each MTMV child context
now calls the idempotent before closing its , so connector query-finish
callbacks are cleared even on empty/pre-coordinator exit paths; cleanup then
restores the task context rather than leaving or overwriting the child
thread-local. The two-child regression verifies both registered finish
callbacks run and the parent context is restored after each child.
TaskProcessorTest passed 5/5.
--
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]