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


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -704,6 +724,13 @@ public void queryRetry(TUniqueId queryId) throws Exception 
{
                         DebugUtil.printId(queryId), randomMillis);
                 Thread.sleep(randomMillis);
                 context.getState().reset();
+                // The terminal branches above have thrown; another attempt 
will now run.
+                if (finishProfileInQueryRetry) {
+                    profile.clearExecutionProfiles();
+                }
+                // Replanning may fail before a new planner is assigned. Do 
not publish the old plan.
+                planner = null;

Review Comment:
   [P2] Clear the abandoned coordinator before replanning an INSERT. 
`executeSingleInsert()` leaves the first attempt's `coord` attached after an 
E-230. If the next attempt fails during planning before installing a new 
coordinator, the outer `queryRetry` finalizer calls `getSummaryInfo(true)`, 
which prefers that old coordinator's status and BE counts over the current 
error. A failed INSERT can therefore retain `Task State: OK` and the prior BE 
topology. Reset `coord` at this boundary and assert the terminal 
planning-failure summary.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -1422,7 +1467,27 @@ public void updateProfile(boolean isFinished) {
         // and ensure the sql is finished normally. For example, if update 
profile
         // failed, the insert stmt should be success
         try {
-            profile.updateSummary(getSummaryInfo(isFinished), isFinished, 
this.planner);
+            // INSERT ends its attempt before execute() restores SET_VAR. 
Publish those effective
+            // settings now, but let queryRetry decide when the shared 
statement is finished.
+            if (isFinished && isInQueryRetry && profileType == 
ProfileType.LOAD) {
+                finishProfileInQueryRetry = true;
+                isFinished = false;
+            }
+            Map<String, String> summaryInfo;
+            if (isFinished && finishProfileInQueryRetry && profileType == 
ProfileType.LOAD
+                    && !profile.getExecutionProfiles().isEmpty()) {

Review Comment:
   [P2] Preserve effective settings for an empty INSERT too. An INSERT whose 
sink child is an empty relation skips `execImpl`, so it never adds an 
`ExecutionProfile`. Its attempt publishes the summary while `SET_VAR` values 
are active, but after `execute()` restores the session this condition fails and 
the outer finalizer rebuilds the whole summary from defaults. The retained 
profile can show the wrong parallel-instance setting for that INSERT. Use the 
terminal-only update whenever an attempt already published its effective 
summary, and test the empty path.



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