Repository navigation
Conversation
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.
Summary
Fixes #799.
An application goroutine calling
SendToTarget()can persist an outgoing message while the session goroutine advances the incoming sequence number on the same MongoStore. This can abort the outbound transaction withWriteConflictand cause data races on the sequence cache.Changes
The API and database schema are unchanged. Synchronization is limited to one Store instance; it does not coordinate separate instances or processes. Operations using this mutex wait during database I/O.
Validation
Tested with Go 1.27.4 and MongoDB 7.0.48 configured as a replica set.
WriteConflictand cache data races against the original implementation ateff945dd59a41caeaed20f71916f08d37e0fda99using a source overlay.go test -mod=readonly -race ./store/mongo -v -count=1passed withMONGODB_TEST_CXNset to the real replica set.go vet -mod=readonly ./store/mongoandgit diff --checkpassed.Coverage includes transactions enabled/disabled, concurrent send/receive, Reset/Refresh overlap, sequence reads, persisted state and message consistency, and lock release after insert/update/commit failures.
Full-repository tests and MongoStore TCP E2E tests were not run for this patch.