github-actions[bot] commented on code in PR #64392:
URL: https://github.com/apache/doris/pull/64392#discussion_r3393038896
##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -599,6 +599,45 @@ public boolean profileHasBeenStored() {
return !Strings.isNullOrEmpty(profileStoragePath);
}
+ public String getProfileCompletionState() {
+ if (profileHasBeenStored()) {
+ String storedState =
summaryProfile.getSummary().getInfoString(SummaryProfile.PROFILE_COMPLETION_STATE);
+ if (!Strings.isNullOrEmpty(storedState)) {
+ return storedState;
+ }
+ return SummaryProfile.PROFILE_COMPLETION_STATE_UNKNOWN;
+ }
+
+ if (!isQueryFinished) {
+ return SummaryProfile.PROFILE_COMPLETION_STATE_RUNNING;
+ }
+
+ for (int i = 0; i < executionProfiles.size(); i++) {
+ ExecutionProfile executionProfile = executionProfiles.get(i);
+ if (!executionProfile.isCompleted()) {
Review Comment:
This is a separate concurrency path from the already-raised
`executionProfiles` ArrayList issue. This new endpoint still calls
`ExecutionProfile.isCompleted()` while BE reports are merged asynchronously on
`profile-write-pool` (`QeProcessorImpl.processQueryProfile()` ->
`ExecutionProfile.updateProfile()`). `isCompleted()` reads each fragment
`RuntimeProfile` through `isEmpty()`, `getChildList().size()`, and an
enhanced-for over `getChildList()`, but `RuntimeProfile.addChild()` mutates
that same `LinkedList` under `childLock` as reports arrive. A
`/rest/v1/query_profile` request racing with a profile report can therefore
still throw `ConcurrentModificationException` or observe a partially-mutated
child list even though the outer `executionProfiles` loop was changed to
index-based. Please make the completion check take a locked snapshot/use a
locked RuntimeProfile helper, or maintain a thread-safe completion flag from
the report path.
##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -599,6 +599,45 @@ public boolean profileHasBeenStored() {
return !Strings.isNullOrEmpty(profileStoragePath);
}
+ public String getProfileCompletionState() {
+ if (profileHasBeenStored()) {
+ String storedState =
summaryProfile.getSummary().getInfoString(SummaryProfile.PROFILE_COMPLETION_STATE);
+ if (!Strings.isNullOrEmpty(storedState)) {
+ return storedState;
+ }
+ return SummaryProfile.PROFILE_COMPLETION_STATE_UNKNOWN;
+ }
+
+ if (!isQueryFinished) {
+ return SummaryProfile.PROFILE_COMPLETION_STATE_RUNNING;
+ }
+
+ for (int i = 0; i < executionProfiles.size(); i++) {
+ ExecutionProfile executionProfile = executionProfiles.get(i);
+ if (!executionProfile.isCompleted()) {
+ return SummaryProfile.PROFILE_COMPLETION_STATE_COLLECTING;
+ }
+ }
+ return SummaryProfile.PROFILE_COMPLETION_STATE_COMPLETE;
+ }
+
+ private String getProfileCompletionStateForStorage() {
+ if (!isQueryFinished) {
+ return SummaryProfile.PROFILE_COMPLETION_STATE_RUNNING;
+ }
+
+ for (int i = 0; i < executionProfiles.size(); i++) {
+ ExecutionProfile executionProfile = executionProfiles.get(i);
+ if (!executionProfile.isCompleted()) {
+ return SummaryProfile.PROFILE_COMPLETION_STATE_INCOMPLETE;
+ }
+ }
+ return SummaryProfile.PROFILE_COMPLETION_STATE_COMPLETE;
+
+ private void updateProfileCompletionStateForStorage() {
Review Comment:
`getProfileCompletionStateForStorage()` is missing its closing brace before
this method starts, so `updateProfileCompletionStateForStorage()` is parsed
inside the previous method and FE cannot compile. Add the brace after the
`COMPLETE` return.
```suggestion
}
private void updateProfileCompletionStateForStorage() {
```
--
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]