Commit 66abb3a
committed
rabbit_db_exchange: Always use a transaction to bump exchange serials
[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.1 parent d563c07 commit 66abb3a
1 file changed
Lines changed: 9 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
557 | 543 | | |
558 | 544 | | |
559 | | - | |
| 545 | + | |
560 | 546 | | |
561 | 547 | | |
562 | 548 | | |
| 549 | + | |
| 550 | + | |
563 | 551 | | |
564 | 552 | | |
565 | 553 | | |
566 | 554 | | |
567 | 555 | | |
| 556 | + | |
568 | 557 | | |
569 | 558 | | |
570 | 559 | | |
| |||
0 commit comments