zhang-arvin opened a new pull request, #20089: URL: https://github.com/apache/druid/pull/20089
## Description Fixes the segment load/drop race condition in the Broker (issue #18738). When a segment is dropped and immediately reloaded, the Broker's segment watcher can incorrectly remove the newly loaded segment from its view. This happens because the segment removal is triggered by the drop announcement, but the reload announcement may arrive before the removal is actually processed. ## Changes - **BrokerSegmentWatcherConfig**: Added `segmentRemovalDelayMs` configuration to delay segment removal after a drop announcement, allowing time for reload announcements to cancel the removal. - **BrokerServerView**: Uses a scheduled executor to delay segment removal, with cancellation logic when a reload is detected during the delay window. - **BrokerServerViewTest**: Added test cases to verify the delayed removal behavior and cancellation on reload. ## Testing - Unit tests added to cover the race condition scenario - Verified that existing tests continue to pass -- 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]
