924060929 commented on code in PR #66913:
URL: https://github.com/apache/doris/pull/66913#discussion_r3821607927
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java:
##########
@@ -904,11 +909,56 @@ public synchronized void releasePlannerResources() {
}
}
+ /**
+ * Returns one closeable resource per statement key and closes it when
this statement is closed.
+ * The supplier is invoked at most once for a key. This is intentionally
independent from planner locks,
+ * whose lifetime ends at the end of Nereids planning.
+ */
+ @SuppressWarnings("unchecked")
+ public synchronized <T extends Closeable> T getOrRegisterStatementResource(
+ Object resourceKey, java.util.function.Supplier<T> supplier) {
+ if (statementResourcesClosed) {
Review Comment:
Fixed on 0cb4ab6df19. ExecuteCommand now opens a fresh empty
statement-resource generation before every COM_STMT_EXECUTE, while
ConnectProcessor still closes that exact generation after the execution. The
retained prepared StatementContext is therefore reusable without carrying
owners across executions. ExecuteCommandTest exercises two executions with
independent Iceberg-style resources, and StatementContextTest covers exact-once
generation cleanup.
--
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]