924060929 commented on code in PR #66530:
URL: https://github.com/apache/doris/pull/66530#discussion_r3819488693
##########
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:
Fixed on current head `8205df5fc9a7a82bb7f2091424e4cca55c631904`. Each MTMV
execution now owns cleanup in its `finally`: it unregisters the execution
query, closes that execution's `StatementContext`, and restores the task
context (or removes the thread-local fallback).
`testReleaseEveryMTMVExecutionContext` covers two successive execution
contexts, and `testRestorePinnedSnapshotAndFinishCallbacksBetweenMTMVChunks`
covers cleanup/restoration between chunks. `TaskProcessorTest`: 7/7 passed;
full `./build.sh --fe` 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();
+ try {
+ if (connectContext != null) {
+ StatementContext statementContext =
connectContext.getStatementContext();
+ if (statementContext != null) {
+ statementContext.close();
Review Comment:
Fixed on current head `8205df5fc9a7a82bb7f2091424e4cca55c631904`.
`TaskProcessor.closeTaskContext()` now calls
`QeProcessorImpl.unregisterQuery(queryId)` before closing the
`StatementContext`, with thread-local removal in the outer `finally`.
`testRunQueryFinishCallbacksForTaskContext` verifies the registered callback is
run and removed for the task context. `TaskProcessorTest`: 7/7 passed; full
`./build.sh --fe` passed.
--
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]