Skip to content
Snippets Groups Projects
Commit 1ade2611 authored by Vladislav Shpilevoy's avatar Vladislav Shpilevoy
Browse files

txn: assert after WAL write that txn is not done

In the journal write trigger the transaction assumed it might be
already rolled back and completed, hence does not need to do
anything except free itself.

But it can't happen. The only imaginable reason why a transaction
might be rolled back before it completed its WAL write is a
ROLLBACK entry issued after the transaction.

But ROLLBACK applies its effects only after it is written. Hence
only after all the other pending txns are written too. Therefore
it is not possible for a transaction to get ROLLBACK before it
finishes its own WAL write.

Probably it was possible in the time when applier used to execute
ROLLBACK before writing it to WAL. But that was fixed in
b259e930 ("applier: process
synchro rows after WAL write"). Can't happen now.

This became easier to realize when not finished transaction
signature got its own value TXN_SIGNATURE_UNKNOWN.
parent 4d896f84
No related branches found
No related tags found
No related merge requests found
......@@ -532,15 +532,7 @@ static void
txn_on_journal_write(struct journal_entry *entry)
{
struct txn *txn = entry->complete_data;
/*
* txn_limbo has already rolled the tx back, so we just
* have to free it.
*/
if (txn->signature != TXN_SIGNATURE_UNKNOWN) {
assert(txn->signature < 0);
txn_free(txn);
return;
}
assert(txn->signature == TXN_SIGNATURE_UNKNOWN);
txn->signature = entry->res;
/*
* Some commit/rollback triggers require for in_txn fiber
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment