Skip to content

[fix][test] Fix flaky OneWayReplicatorDeduplicationTest.testDeduplication#39

Closed
Praveenkumar76 wants to merge 1 commit intomasterfrom
fix/flaky-deduplication-test
Closed

[fix][test] Fix flaky OneWayReplicatorDeduplicationTest.testDeduplication#39
Praveenkumar76 wants to merge 1 commit intomasterfrom
fix/flaky-deduplication-test

Conversation

@Praveenkumar76
Copy link
Copy Markdown
Collaborator

@Praveenkumar76 Praveenkumar76 commented May 5, 2026

Fixes apache#25141

Motivation

OneWayReplicatorDeduplicationTest.testDeduplication is flaky because MessageDeduplication.takeSnapshot is designed to drop concurrent snapshot requests if an existing snapshot operation is already in progress. The test relies on specific positions being persisted, but if a manual trigger is dropped due to this intentional "lossy" design, the test fails with a ConditionTimeoutException while waiting for the state to update.

Modifications

  • Modified OneWayReplicatorDeduplicationTest to set brokerDeduplicationSnapshotIntervalSeconds to 1 second in the test configuration.

  • By increasing the frequency of the background snapshot monitor, the system is guaranteed to capture and persist the deduplication state frequently enough to satisfy the test's assertions, even if a specific manual trigger request is skipped due to a race condition.

Verifying this change

  • Verified that the flaky test now runs consistently without failures.
  • Confirmed that the 1-second background interval provides a sufficient "safety net" to persist the state when concurrent manual triggers are dropped.
  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as:

  • org.apache.pulsar.broker.service.OneWayReplicatorDeduplicationTest.testDeduplication

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

@Praveenkumar76 Praveenkumar76 self-assigned this May 5, 2026
@Praveenkumar76 Praveenkumar76 force-pushed the fix/flaky-deduplication-test branch from 2cc1fee to 57403b2 Compare May 6, 2026 07:08
@Praveenkumar76 Praveenkumar76 changed the title [fix][broker] Fix flaky OneWayReplicatorDeduplicationTest by coalescing snapshot requests [fix][test] Fix flaky OneWayReplicatorDeduplicationTest.testDeduplication May 6, 2026
Copy link
Copy Markdown
Collaborator

@sandeep-mst sandeep-mst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
@Praveenkumar76 Assuming that the fix is tested well and is working as expected. As it's flaky, you should run it multiple times.

@Praveenkumar76
Copy link
Copy Markdown
Collaborator Author

yeah, I ran it multiple times locally, before raising and it looks stable

@Praveenkumar76 Praveenkumar76 deleted the fix/flaky-deduplication-test branch May 6, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Flaky-test: OneWayReplicatorDeduplicationTest.testDeduplication

2 participants