FrankChen021 opened a new pull request, #19886:
URL: https://github.com/apache/druid/pull/19886

   ## Summary
   
   - Stabilize the cumulative virtual storage metric assertions in 
`QueryVirtualStorageTest.testQueryPartials`.
   - Replace race-prone `waitForNextEvent` calls with 
`LatchableEmitter.waitForEventAggregate` waits where the test reads cumulative 
metric totals.
   - Preserve the existing metric thresholds and avoid sleeps, timeout 
increases, or weakened assertions.
   
   ## Root cause
   
   `StorageMonitor` emits virtual storage metrics on periodic monitor ticks and 
resets the interval statistics after each tick. The test previously waited for 
only one future matching event with `waitForNextEvent`, then read a cumulative 
total. If that event represented an interval before the final segment load 
completed, the test could observe 23 loads even though a later metric event 
would bring the cumulative total to the required 24.
   
   `waitForEventAggregate` evaluates already-processed matching events and 
continues collecting future matching events until the requested cumulative 
threshold is reached. The fix therefore removes the timing race while retaining 
the expected thresholds.
   
   ## Evidence
   
   - [PR #19879 failed unit 
job](https://github.com/apache/druid/actions/runs/30932077038/job/92069160586): 
`QueryVirtualStorageTest.testQueryPartials` failed at the first load assertion 
with `expected 24 but only got 23`.
   - [Independent PR #19876 
run](https://github.com/apache/druid/actions/runs/30939895864): the same 
failure occurred on an unrelated commit.
   - [Later PR #19876 
run](https://github.com/apache/druid/actions/runs/30958625134): the same test 
passed, demonstrating intermittent behavior across unrelated commits.
   
   This is a test-stability fix found while validating the JUnit 5 migration. 
It does not migrate JUnit, change production behavior, or change the expected 
metric thresholds. Related to 
[#13948](https://github.com/apache/druid/issues/13948).
   
   ## Validation
   
   - `mvn -ntp test -pl embedded-tests -am 
-Dtest="org.apache.druid.testing.embedded.query.QueryVirtualStorageTest#testQueryPartials"
 -Dsurefire.failIfNoSpecifiedTests=false -Pskip-static-checks 
-Dweb.console.skip=true -T1C` — 1 test, 0 failures, 0 errors, 0 skipped; full 
reactor `BUILD SUCCESS`.
   - `mvn -ntp -pl embedded-tests -am -DskipTests -Dweb.console.skip=true 
-Dcheckstyle.skip=false -Dspotbugs.skip=false checkstyle:check spotbugs:check 
-T1C` — `BUILD SUCCESS`; Checkstyle reported 0 violations and SpotBugs reported 
no bugs/errors.
   - `git diff --check` — passed.
   


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