[Tarantool-patches] [PATCH v15 09/11] box/txn: clear fiber storage right before journal write
Cyrill Gorcunov
gorcunov at gmail.com
Fri Mar 20 11:19:54 MSK 2020
Otherwise we won't be able to make a rollback in case
of journal_entry_new allocation failure.
Acked-by: Konstantin Osipov <kostja.osipov at gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
src/box/txn.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/box/txn.c b/src/box/txn.c
index 06043a2d8..4e23e9828 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -513,7 +513,13 @@ txn_write_to_wal(struct txn *txn)
assert(remote_row == req->rows + txn->n_applier_rows);
assert(local_row == remote_row + txn->n_new_rows);
- /* Send the entry to the journal. */
+ /*
+ * Send the entry to the journal.
+ *
+ * After this point the transaction must not be used
+ * so reset the corresponding key in the fiber storage.
+ */
+ fiber_set_txn(fiber(), NULL);
if (journal_write(req) < 0) {
diag_set(ClientError, ER_WAL_IO);
diag_log();
@@ -586,11 +592,6 @@ txn_commit_async(struct txn *txn)
if (txn_commit_nop(txn))
return 0;
- /*
- * After this point the transaction must not be used
- * so reset the corresponding key in the fiber storage.
- */
- fiber_set_txn(fiber(), NULL);
return txn_write_to_wal(txn);
}
@@ -610,7 +611,6 @@ txn_commit(struct txn *txn)
return 0;
}
- fiber_set_txn(fiber(), NULL);
if (txn_write_to_wal(txn) != 0)
return -1;
--
2.20.1
More information about the Tarantool-patches
mailing list