Conversation
…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.
Contributor
There was a problem hiding this comment.
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
version2in Go and the continuous replication sending the changes message for it. - Hoist
ctxfromt.Context()tort.Context()earlier in the test so it is in scope of thechangesEntryCallbackclosure. - Add a
base.DebugfCtxlog inside the changes entry callback to surface what was found vs. expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CBG-5354 fix flake: TestDeltaReplicationWithBypassRevCacheAndInflightRevChanged and TestDeltaReplicationWithBypassRevCacheSendDeltaWhenInFlightRevChanged
In some cases, version2 is not set when the changesEntryCallback.
If a continuous replication is run:
There is a race between when "version2" is assigned in go and when the next changes message can get sent.
version2could be nil whenchangesEntryCallbackwas 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=couchbaseand running these tests a lot.