Closed kaituo closed 1 month ago
Attention: Patch coverage is 85.71429%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 80.00%. Comparing base (
da73506
) to head (2b497b9
). Report is 1 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
...ensearch/timeseries/transport/ResultProcessor.java | 85.71% | 0 Missing and 1 partial :warning: |
Overall were we processing results of detector 1 still but then detector 2 already finished and went to scheduleImputeHCTask?
Overall were we processing results of detector 1 still but then detector 2 already finished and went to scheduleImputeHCTask?
scheduleImputeHCTask is detector specific. So when detector 2 is finished, scheduleImputeHCTask will start regardless of detector 1.
Description
This PR
AtomicInteger
calledpagesInFlight
to track the number of pages currently being processed.pagesInFlight
before processing each page and decremented it after processing is completescheduleImputeHCTask
to check bothpagesInFlight.get() == 0
(all pages have been processed) andsentOutPages.get() == receivedPages.get()
(all responses have been received) before scheduling theimputeHC
task.onResponse
that decided when to scheduleimputeHC
, relying instead on the updated counters for accurate synchronization.These changes address the race condition where
sentOutPages
might not have been incremented in time before checking whether to schedule theimputeHC
task. By accurately tracking the number of in-flight pages and sent pages, we ensure thatimputeHC
is executed only after all pages have been fully processed and all responses have been received.Testing done:
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.