924060929 commented on code in PR #61828:
URL: https://github.com/apache/doris/pull/61828#discussion_r3449735805
##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -567,6 +567,7 @@ public boolean shouldStoreToStorage() {
}
if (!hasReportingProfile) {
+ summaryProfile.markCollectionCompleted();
Review Comment:
The marker is set at the same point where the existing
`shouldStoreToStorage()` already decides to persist and release the profile. If
`isCompleted()` has a false-positive (child count vs distinct BE count), then
profile storage itself has the same race — the marker doesn't make it worse.
Fixing the `isCompleted()` predicate to track distinct reporting backends would
be a separate improvement to the existing profile lifecycle, not something
scoped to this PR.
##########
regression-test/suites/query_profile/test_profile_collection_completed.groovy:
##########
@@ -0,0 +1,89 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+/**
+ * Verifies that the "Is Profile Collection Completed: true" field
+ * appears in the profile text once all BE fragment profiles have
+ * been collected (or the collection timeout has elapsed).
+ */
+suite("test_profile_collection_completed") {
+
+ def getProfileText = { String queryId ->
+ def addr = context.config.feHttpAddress
+ def user = context.config.feHttpUser ?: "root"
+ def pass = context.config.feHttpPassword ?: ""
+ def encoding =
Base64.getEncoder().encodeToString("${user}:${pass}".getBytes("UTF-8"))
+ def conn = new
URL("http://${addr}/api/profile/text?query_id=${queryId}").openConnection()
+ conn.setRequestMethod("GET")
+ conn.setRequestProperty("Authorization", "Basic ${encoding}")
+ conn.setConnectTimeout(5000)
+ conn.setReadTimeout(10000)
+ try {
+ return conn.getInputStream().getText()
+ } catch (Exception e) {
+ return ""
+ }
+ }
+
+ // Poll until the completion marker appears, or timeout after 10 s.
+ def waitForCompletionMarker = { String queryId ->
+ def marker = "Is Profile Collection Completed: true"
+ def maxAttempts = 33 // 33 × 300 ms ≈ 10 s
Review Comment:
Good point. In practice the normal path (all BEs report promptly) will set
the marker well within the 10s window — the test is not meant to exercise the
timeout path. But I'll increase the wait budget to 30s to add margin and avoid
flakiness.
##########
regression-test/suites/query_profile/test_profile_collection_completed.groovy:
##########
@@ -0,0 +1,89 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+/**
+ * Verifies that the "Is Profile Collection Completed: true" field
+ * appears in the profile text once all BE fragment profiles have
+ * been collected (or the collection timeout has elapsed).
+ */
+suite("test_profile_collection_completed") {
+
+ def getProfileText = { String queryId ->
+ def addr = context.config.feHttpAddress
+ def user = context.config.feHttpUser ?: "root"
Review Comment:
The existing profile text tests in this repo (profile_size_limit.groovy,
s3_load_profile_test.groovy, ann_index tests, etc.) all use the same hardcoded
root auth pattern with \`/api/profile/text\`. This test follows the established
convention. Adding cloud-mode credential selection would be a cross-cutting
improvement for all profile text tests, not specific to this PR.
--
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]