You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "FrankChen021 (via GitHub)" <gi...@apache.org> on 2026/08/06 15:15:48 UTC
[PR] test: wait for completed Dart reports in embedded tests (druid)
FrankChen021 opened a new pull request, #19905:
URL: https://github.com/apache/druid/pull/19905
## Summary
- Wait for completed Dart query reports before asserting completion metadata.
- Apply the same synchronization to the single-broker completed-report test and the cross-broker test.
## Root cause
The master CI failure was reported as `expected: not <null>` at `EmbeddedDartReportApiTest.java:348`, which is the assertion that `DartQueryInfo.getDurationMs()` is non-null. The report response itself was present.
The SQL result can be returned before `ControllerHolder.runAsync` finishes deregistration and `DartControllerRegistry` publishes the retained completed report. During that window, the report API can return the running-query snapshot, whose `durationMs` is explicitly null. Cross-broker forwarding can observe the same intermediate state.
Evidence:
- [Failed master job](https://github.com/apache/druid/actions/runs/31102715850/job/92620026819)
- [Same test passed on the immediate parent run](https://github.com/apache/druid/actions/runs/31102703521/job/92619984800)
- [Report metadata is documented as null until known](https://github.com/apache/druid/blob/master/multi-stage-query/src/main/java/org/apache/druid/msq/dart/controller/http/DartQueryInfo.java#L162-L170)
- [Controller deregistration publishes the completed report after query execution](https://github.com/apache/druid/blob/master/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerHolder.java#L205-L220)
## Fix
Poll the report API until each requested broker returns a report with non-null `durationMs`, using one shared timeout for the multi-broker check. This synchronizes the test with the API's completed-report state without adding a fixed sleep.
## Validation
```
mvn -ntp test -pl embedded-tests -am \
-Dtest="org.apache.druid.testing.embedded.msq.EmbeddedDartReportApiTest" \
-Dsurefire.failIfNoSpecifiedTests=false \
-Pskip-static-checks -Dweb.console.skip=true -T1C
```
Result: 7 tests passed, 0 failures, 0 errors.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] test: fix flaky test EmbeddedDartReportApiTest (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 commented on code in PR #19905:
URL: https://github.com/apache/druid/pull/19905#discussion_r3813638986
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/msq/EmbeddedDartReportApiTest.java:
##########
@@ -606,6 +605,48 @@ private GetQueryReportResponse waitForReport(String sqlQueryId)
throw new ISE("Timed out after[%,d] ms waiting for query to be in RUNNING state", timeout);
}
+ /**
+ * Polls the report API on the specified brokers until completed reports are available from all of them.
+ */
+ private List<GetQueryReportResponse> waitForCompletedReports(
+ final String sqlQueryId,
+ final EmbeddedBroker... targetBrokers
+ )
+ {
+ final long timeout = 30_000;
+ final long deadline = System.currentTimeMillis() + timeout;
+
+ while (System.currentTimeMillis() < deadline) {
Review Comment:
Addressed in b369eaf8fb by using `cluster.callApi().waitForResult()` while preserving the 30-second timeout and 100 ms retry interval. The two affected tests pass on JDK 25.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] test: fix flaky test EmbeddedDartReportApiTest (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #19905:
URL: https://github.com/apache/druid/pull/19905#discussion_r3772337534
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/msq/EmbeddedDartReportApiTest.java:
##########
@@ -606,6 +605,48 @@ private GetQueryReportResponse waitForReport(String sqlQueryId)
throw new ISE("Timed out after[%,d] ms waiting for query to be in RUNNING state", timeout);
}
+ /**
+ * Polls the report API on the specified brokers until completed reports are available from all of them.
+ */
+ private List<GetQueryReportResponse> waitForCompletedReports(
+ final String sqlQueryId,
+ final EmbeddedBroker... targetBrokers
+ )
+ {
+ final long timeout = 30_000;
+ final long deadline = System.currentTimeMillis() + timeout;
+
+ while (System.currentTimeMillis() < deadline) {
Review Comment:
Instead of sleep, consider using `cluster.callApi().waitForResult()`.
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] test: fix flaky test EmbeddedDartReportApiTest (druid)
Posted by "FrankChen021 (via GitHub)" <gi...@apache.org>.
FrankChen021 merged PR #19905:
URL: https://github.com/apache/druid/pull/19905
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org