rabbit_db_exchange: Always use a transaction to bump exchange serials#15236
Merged
rabbit_db_exchange: Always use a transaction to bump exchange serials#15236
Conversation
[Why] Initially, I thought a transaction would be too much for a simple counter. Therefore I use a regular `get`, plus a `put` with a condition on the tree node payload version to ensure the put would only succeed of the read value was still the one in the store. Unfortunately this technic is very inefficient with a lot of concurrency. That's because all processes will read the same value and will all commit a `put`, but only one of them will succeed. After that, all but on will retry the same read/modify/write with the same poor result. In the end, all processes are spamming `put` commands and they make very little progress, loading the store in the process. [How] This patch goes back to a simple transaction. This solves the contention issue.
b186550 to
66abb3a
Compare
mkuratczyk
approved these changes
Jan 9, 2026
dumbbell
added a commit
that referenced
this pull request
Jan 9, 2026
rabbit_db_exchange: Always use a transaction to bump exchange serials (backport #15236)
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.
Why
Initially, I thought a transaction would be too much for a simple counter. Therefore I use a regular
get, plus aputwith a condition on the tree node payload version to ensure the put would only succeed of the read value was still the one in the store.Unfortunately this technic is very inefficient with a lot of concurrency. That's because all processes will read the same value and will all commit a
put, but only one of them will succeed. After that, all but on will retry the same read/modify/write with the same poor result. In the end, all processes are spammingputcommands and they make very little progress, loading the store in the process.How
This patch goes back to a simple transaction. This solves the contention issue.