qsync: handle async txns right during CONFIRM
It is possible that a new async transaction is added to the limbo when there is an in-progress CONFIRM WAL write for all the pending sync transactions. Then when CONFIRM WAL write is done, it might see that the limbo now in the first place contains an async transaction not yet written to WAL. A suspicious situation - on one hand the async transaction does not have any blocking sync txns before it and can be considered complete, on the other hand its WAL write is not done and it is not complete. Before this patch it resulted into a crash - limbo didn't consider the situation possible at all. Now when CONFIRM covers a not yet written async transactions, they are removed from the limbo and are turned to plain transactions. When their WAL write is done, they see they no more have TXN_WAIT_SYNC flag and don't even need to interact with the limbo. It is important to remove them from the limbo right when the CONFIRM is done. Because otherwise their limbo entry may be not removed at all when it is done on a replica. On a replica the limbo entries are removed only by CONFIRM/ROLLBACK/PROMOTE. If there would be an async transaction in the first position in the limbo queue, it wouldn't be deleted until next sync transaction appears. This replica case is not possible now though. Because all synchro entries on the applier are written in a blocking way. Nonetheless if it ever becomes non-blocking, the code should handle it ok. Closes #6057
Showing
- changelogs/unreleased/gh-6057-qsync-confirm-async-no-wal.md 5 additions, 0 deletionschangelogs/unreleased/gh-6057-qsync-confirm-async-no-wal.md
- src/box/txn.c 10 additions, 5 deletionssrc/box/txn.c
- src/box/txn_limbo.c 27 additions, 0 deletionssrc/box/txn_limbo.c
- test/replication/gh-6057-qsync-confirm-async-no-wal.result 163 additions, 0 deletionstest/replication/gh-6057-qsync-confirm-async-no-wal.result
- test/replication/gh-6057-qsync-confirm-async-no-wal.test.lua 88 additions, 0 deletionstest/replication/gh-6057-qsync-confirm-async-no-wal.test.lua
- test/replication/suite.cfg 1 addition, 0 deletionstest/replication/suite.cfg
- test/replication/suite.ini 1 addition, 1 deletiontest/replication/suite.ini
Loading
Please register or sign in to comment