morningman commented on code in PR #68901:
URL: https://github.com/apache/doris/pull/68901#discussion_r4254757596


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java:
##########
@@ -170,6 +170,9 @@ public void plan(StatementBase queryStmt, 
org.apache.doris.thrift.TQueryOptions
         } finally {
             statementContext.getStopwatch().stop();
             NereidsPlanner.runningPlanNum.decrementAndGet();
+            // Connectors plan the scans of the statement only inside plan(), 
so what they kept for planning, such as
+            // the ranges identical scans share, is not needed once it returns 
or throws.
+            statementContext.endConnectorPlanning();

Review Comment:
   Done in fa99d0d3b0d: `releasePlannerResources()` ends connector planning 
after its release loop and before it rethrows, and `plan()` no longer does it 
itself; `endConnectorPlanning()` is now private, so the planner cleanup is the 
only way in. Within `plan()` the memo goes at the same point as before, since 
`planWithLock`'s `finally` runs after `lockCallback` has distributed and 
translated the plan. The other callers of `planWithLock`, and the SQL cache 
path in `ConnectProcessor` that also releases the planner resources, only 
analyze or optimize; none of them translates a plan, so they keep no memo and 
ending planning there drops nothing. 
`ConnectorStatementScopeTest#releasingPlannerResourcesEndsPlanningWhenAResourceFailsToClose`
 covers a table whose read unlock throws: the memo is gone and the failure 
still reaches the caller. Ending planning only after a successful release makes 
it fail.
   
   On the clarification: right, master drops the memo when the statement ends 
(`closeAll`), so this PR moves that earlier rather than adding the first 
cleanup. The description said master had no bound, meaning no size bound; it 
now says when master drops the memo.
   



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