github-actions[bot] commented on code in PR #66530:
URL: https://github.com/apache/doris/pull/66530#discussion_r3783024313


##########
fe/fe-connector/fe-connector-paimon/src/main/java/org/apache/doris/connector/paimon/PaimonScanPlanProvider.java:
##########
@@ -278,7 +279,7 @@ static boolean isForceJniScannerEnabled(ConnectorSession 
session) {
      * is a no-op. Package-private static for offline unit testing.
      */
     static String resolveIgnoreSplitType(ConnectorSession session) {
-        if (session == null) {
+        if (session == null || !session.isExternalScanTaskReuseEnabled()) {

Review Comment:
   **[P2] Keep split-type filtering independent of reuse**
   
   With `enable_external_scan_task_reuse=false`, this now returns `NONE` before 
reading `ignore_split_type`. The direct fallback still enters 
`planScanInternal`, so a native-eligible table with 
`ignore_split_type=IGNORE_NATIVE` emits its native ranges (and the forced-JNI 
case similarly defeats `IGNORE_JNI`) instead of honoring the independent 
routing control. Please let this helper fall back only for a null session and 
add a test combining disabled reuse with one of the ignore modes.



##########
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:
   **[P2] Unregister non-MTMV task queries before dropping the context**
   
   `InsertTask.before` gives this context a query id, and external scan 
planning registers read-transaction and scope callbacks under it before 
`planScan`. If planning then fails, or the insert returns before 
`executeSingleInsert`, its normal unregister `finally` is never reached. This 
closes the scope but does not remove or run the global callback entry, so it 
retains the provider/scope indefinitely and can leave a Hive read transaction 
unreleased. The MTMV child path now unregisters explicitly; please do the same 
here and add an InsertTask callback-cleanup test.



-- 
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]

Reply via email to