txn_limbo: single function to confirm transactions
Before this patch there were some structural problems with the
limbo code (still are now, but less).
It wasn't clear when lifetime of a transaction ends. When it is
committed, when rolled back, when completion is called. With
rollback things are more or less bearable, but not with commit.
Transaction's completion could be done at the same time with
setting limbo_entry.is_commit flag. Or with setting the flag +
yield + completion. This led to having a weird crutch in
txn_limbo_wait_complete() to make async transactions explicitly
wait until the previous sync transactions are written to WAL.
The commit flag could be set in 3!!! different places - parameters
update handler, ACK handler, and confirmation handler. In these 3
places there were various assumptions making it really hard to
understand what is happening here and there, what is the
difference. Not counting how much code was duplicated.
This patch makes the commit path always come through confirmation
reader, as the most logical place for that, and already covering
almost all the tricky cases.
Now there is a guarantee that a transaction is completed if it is
removed from the limbo queue. No need to check TXN_IS_DONE, wait
for anything, whatsoever.
Also the patch is a preparation for removal of TXN_IS_DONE check
from the main path of txn_commit(). txn_limbo_wait_complete()
shouldn't ever return a not finished transaction for that.
Part of #5143
Acked-by:
Cyrill Gorcunov <gorcunov@gmail.com>
Loading
Please register or sign in to comment