github-actions[bot] commented on code in PR #68658:
URL: https://github.com/apache/doris/pull/68658#discussion_r4178626331
##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -281,6 +281,31 @@ public List<ExecutionProfile> getExecutionProfiles() {
return this.executionProfiles;
}
+ public synchronized void clearExecutionProfiles() {
+ ProfileManager.getInstance().removeProfile(this);
+ this.executionProfiles.clear();
+ // Keep the plan for redispatch, but discard rows derived from the
abandoned execution.
+ rowsProducedMap.clear();
+ resetActualRowCounts(physicalPlan);
+ }
+
+ private void resetActualRowCounts(Plan plan) {
+ if (plan == null) {
+ return;
+ }
+ ((AbstractPlan) plan).updateActualRowCount(-1L);
+ for (Plan child : plan.children()) {
+ resetActualRowCounts(child);
+ }
+ }
+
+ public synchronized void clearPlan() {
+ physicalPlan = null;
+ physicalRelations.clear();
+ planNodeMap = Maps.newHashMap();
Review Comment:
[P2] Clear optional summary fields from the abandoned attempt. `clearPlan()`
leaves the shared `SummaryProfile` intact, while its update only overwrites
keys supplied by the next attempt. At profile level 3, a terminal retry that
fails before replanning still displays the first attempt's `Distributed Plan`;
a successful replan with no selected scan ranges still displays its old `Query
Backend Selection`. These survive even if the physical plan is reset. Clear
per-attempt summary fields here, or overwrite them when absent from the new
summary, and test both retry paths.
##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -704,6 +724,11 @@ 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();
+ profile.clearPlan();
Review Comment:
[P2] Clear the executor's abandoned planner before the outer retry. After a
post-dispatch E-230, this clears `Profile` plan state but leaves `this.planner`
pointing at the first Nereids plan. If the next attempt fails before `planner =
new NereidsPlanner(...)` (for example, a follower's `syncJournalIfNeeded`
fails), `queryRetry` finalizes with `updateProfile(true)`, which copies that
abandoned plan and its relations back into the failed second attempt's retained
profile. Reset the executor planner at this boundary, or pass only a planner
created by the current attempt into finalization, and cover an early terminal
retry failure.
--
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]