Skip to content

rabbit_db_exchange: Always use a transaction to bump exchange serials#15236

Merged
dumbbell merged 1 commit intomainfrom
use-transaction-for-exchange-serials
Jan 9, 2026
Merged

rabbit_db_exchange: Always use a transaction to bump exchange serials#15236
dumbbell merged 1 commit intomainfrom
use-transaction-for-exchange-serials

Conversation

@dumbbell
Copy link
Copy Markdown
Collaborator

@dumbbell dumbbell commented Jan 9, 2026

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.

@dumbbell dumbbell added this to the 4.3.0 milestone Jan 9, 2026
@dumbbell dumbbell requested a review from mkuratczyk January 9, 2026 08:30
@dumbbell dumbbell self-assigned this Jan 9, 2026
[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.
@dumbbell dumbbell force-pushed the use-transaction-for-exchange-serials branch from b186550 to 66abb3a Compare January 9, 2026 08:43
@dumbbell dumbbell marked this pull request as ready for review January 9, 2026 12:03
@dumbbell dumbbell merged commit 7b3faa5 into main Jan 9, 2026
860 of 863 checks passed
@dumbbell dumbbell deleted the use-transaction-for-exchange-serials branch January 9, 2026 12:03
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants