github-actions[bot] commented on code in PR #66530:
URL: https://github.com/apache/doris/pull/66530#discussion_r3781442961
##########
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:
**[P1] Preserve the pinned snapshot between refresh chunks**
After chunk 1, this removes the only thread-local context, but chunk 2 calls
`generatePartitionSnapshots(...)` before `exec(...)` installs its next context.
For a plugin-driven external pct table, `MvccUtil.getSnapshotFromContext` then
returns empty and `getOrMaterialize` records the latest snapshot (say S2),
while `exec` injects the task-level pin captured in `beforeMTMVRefresh` and
scans S1. The task subsequently persists S2 as refreshed even though S2 was
never materialized, so later refreshes can skip that update. Please make the
between-chunk bookkeeping consume the task's explicit pinned snapshots (or keep
a task-level pinned context) and add a two-chunk test that advances the source
between chunks.
--
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]