FrankChen021 commented on code in PR #20320:
URL: https://github.com/apache/druid/pull/20320#discussion_r3989073605
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/compact/CompactionTestBase.java:
##########
@@ -97,8 +97,8 @@ protected List<Interval> getSegmentIntervals()
protected void verifySegmentsCount(int numExpectedSegments)
{
- // Ensure that Broker has synced latest segments from the Coordinator
- broker.latchableEmitter().waitForNextEvent(event ->
event.hasMetricName("segment/metadataCache/sync/time"));
+ // The Overlord state is verified immediately; the Broker-side
sys.segments view is polled
+ // until it matches, since a single metadata cache sync may still observe
the previous state.
cluster.callApi().verifyNumVisibleSegmentsIs(numExpectedSegments,
dataSource, overlord);
Review Comment:
[P2] Preserve synchronization when the segment count is unchanged
Removing the Broker metadata-cache event wait makes this helper return as
soon as the filtered COUNT(*) equals the Overlord count, but that count can
already be correct in a stale snapshot. This is exercised by
CompactionTaskTest.testCompactionWithQueryGranularityInGranularitySpec: the
second compaction changes query granularity from HOUR to MINUTE while
deliberately keeping two segments. The old two-row sys.segments snapshot can
therefore satisfy the new predicate before the second compaction's segment
metadata is visible, allowing the following query-granularity assertion to
observe HOUR or otherwise making this synchronization flaky. Keep a
post-compaction cache barrier, or poll a condition that identifies the new
segment metadata rather than only its count, while retaining the bounded count
check.
--
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]