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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java:
##########
@@ -341,6 +342,13 @@ public AbstractInsertExecutor initPlan(ConnectContext ctx, 
StmtExecutor stmtExec
         throw new AnalysisException("Insert plan failed. Could not get target 
table lock.");
     }
 
+    static void prepareMvccSnapshotsForPlanAttempt(StatementContext 
statementContext, int attempt) {
+        if (attempt > 1) {
+            // Refresh planner metadata while retaining the source fences 
selected by the caller.
+            statementContext.resetMvccSnapshotsForRetry();

Review Comment:
   [P2] Reset retained OPTIONS selectors before replanning an INSERT. When 
attempt 1 scans a Paimon source with `@options('scan.mode'='latest')`, its 
unbound relation retains `TableScanParams.resolvedMapParams` pinned to snapshot 
N. If the target schema changes and the Paimon source commits before attempt 2, 
this reset drops the statement fence and loads N+1, but `initPlanOnce()` reuses 
the same origin relation; `PaimonExternalTable.loadSnapshot()` then calls 
`reuseResolvedMapParams()` with N+1 and throws `Conflicting resolved table scan 
parameters`. Reset resolved scan params on the origin query and its expression 
subqueries before retry analysis, as `ExecuteCommand` does between executions, 
and cover a target-schema retry with an advancing Paimon OPTIONS source.



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