Skip to content

CBG-5354 fix flake: TestDeltaReplicationWithBypassRevCacheAndInflightRevChanged#8302

Open
torcolvin wants to merge 1 commit into
mainfrom
CBG-5354
Open

CBG-5354 fix flake: TestDeltaReplicationWithBypassRevCacheAndInflightRevChanged#8302
torcolvin wants to merge 1 commit into
mainfrom
CBG-5354

Conversation

@torcolvin
Copy link
Copy Markdown
Collaborator

CBG-5354 fix flake: TestDeltaReplicationWithBypassRevCacheAndInflightRevChanged and TestDeltaReplicationWithBypassRevCacheSendDeltaWhenInFlightRevChanged

In some cases, version2 is not set when the changesEntryCallback.

If a continuous replication is run:

  1. version1 is written
  2. change with for version1
  3. version2 is written

There is a race between when "version2" is assigned in go and when the next changes message can get sent. version2 could be nil when changesEntryCallback was invoked. Use a single shot replication to avoid the race so that version2 is written before the changes message with version2 is sent.

Reproducible with SG_TEST_BACKING_STORE=couchbase and running these tests a lot.

…RevChanged

In some cases, version2 is not set when the changesEntryCallback.

If a continuous replication is run:

1. version1 is written
2. change with for version1
3. version2 is written

There is a race between when "version2" is assigned in go and when the next changes message can get sent.

Use a single shot replication to avoid the race.
Copilot AI review requested due to automatic review settings May 27, 2026 15:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a flake in two delta-sync tests by replacing the continuous pull replication with two sequential one-shot pulls so that version2 is reliably assigned before the changes message referencing it is sent. Also adds a debug log in the changesEntryCallback to aid diagnosing future races.

Changes:

  • Restructure both tests to: pull version1 (one-shot), write version2, then start a second pull, avoiding the race between assigning version2 in Go and the continuous replication sending the changes message for it.
  • Hoist ctx from t.Context() to rt.Context() earlier in the test so it is in scope of the changesEntryCallback closure.
  • Add a base.DebugfCtx log inside the changes entry callback to surface what was found vs. expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants