[Tarantool-patches] [PATCH] box/txn: do not zap fiber txn pointer before txn_write_to_wal completes

Cyrill Gorcunov gorcunov at gmail.com
Fri Jan 24 18:17:06 MSK 2020


The txn_write_to_wal operates with txn by own: on success it calls
txn_entry_done_cb which completes transaction, on error it calls
txn_rollback which expects the transaction we're rolling back is
the one the fiber carries in storage.

 | txn_write
 |   fiber_set_txn(fiber(), NULL); // zap fiber's storage.txn
 |   txn_write_to_wal(txn);
 |     journal_entry_new(..., txn_entry_done_cb, ...)
 |     if (req == NULL)
 |       txn_rollback(txn);
 |         assert(txn == in_txn()); // in_txn()=nil, triggers

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
Not for merging! I need to create a proper testcase with
error injection. Sending it out for early review since
I'm hunting another issue right now and this patch just
to not loose the info.

 src/box/txn.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/box/txn.c b/src/box/txn.c
index bedb57449..060d91536 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -583,7 +583,6 @@ txn_write(struct txn *txn)
 		fiber_set_txn(fiber(), NULL);
 		return 0;
 	}
-	fiber_set_txn(fiber(), NULL);
 	return txn_write_to_wal(txn);
 }
 
-- 
2.20.1



More information about the Tarantool-patches mailing list