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


##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -281,6 +281,11 @@ public List<ExecutionProfile> getExecutionProfiles() {
         return this.executionProfiles;
     }
 
+    public synchronized void clearExecutionProfiles() {
+        ProfileManager.getInstance().removeProfile(this);
+        this.executionProfiles.clear();

Review Comment:
   [P2] Clear the abandoned plan's statistics on an outer replan. A cloud scan 
can return E-230 during `getNext()` after `updateProfile(false)` has added the 
first Nereids plan's physical relations. This clears its execution profile but 
leaves `physicalRelations` intact. The successful replan adds its own 
relations, while the final PhysicalPlan appendix prints the retained set; equal 
relation IDs keep failed-plan stats and different IDs show both plans. Reset 
the abandoned plan's relation/statistics state before installing the new plan, 
and test a post-dispatch E-230 retry's rendered profile.



##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -281,6 +281,11 @@ public List<ExecutionProfile> getExecutionProfiles() {
         return this.executionProfiles;
     }
 
+    public synchronized void clearExecutionProfiles() {

Review Comment:
   [P2] Reset per-attempt phase times before an outer cloud replan. This new 
cleanup keeps the same `SummaryProfile`, including `queryPlanFinishTime`, whose 
setter accepts only its first value. The successful retry overwrites 
`queryScheduleFinishTime`, so Schedule Time and Assign Fragment Time subtract 
the first attempt's plan finish from the second attempt's milestones. A 
7-second failed dispatch followed by a 1-second successful schedule can appear 
as at least 8 seconds of scheduling for the final execution. Rebase per-attempt 
phase times on retry while retaining a separate statement-level elapsed clock, 
and cover these values in a replan test.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -704,6 +724,10 @@ 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();

Review Comment:
   [P2] Preserve statement duration when an outer cloud replan retries. This 
clears the failed execution but retains the same `Profile`; the next 
`executeByNereids()` resets both the context start and 
`SummaryProfile.queryBeginTime`. With `auto_profile_threshold_ms=5000`, a 
7-second replan failure followed by a 1-second success is pruned as a 1-second 
query, and TOTAL_TIME reports only the last attempt. The existing threshold 
thread covers inner retries, whose start time is unchanged; this is the 
separate outer path. Keep a statement-level profiling start for retention and 
summary time while preserving the per-attempt timeout clock, and test this 
boundary.



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