[Tarantool-patches] [PATCH v15 08/11] box/txn: unweave txn_commit from txn_commit_async

Cyrill Gorcunov gorcunov at gmail.com
Fri Mar 20 11:19:53 MSK 2020


We gonna diverge sync and async code flow thus lets
make txn_commit to not use txn_commit_async.

Fixes #4031

Acked-by: Konstantin Osipov <kostja.osipov at gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 src/box/txn.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/box/txn.c b/src/box/txn.c
index 60da5b564..06043a2d8 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -599,8 +599,21 @@ txn_commit(struct txn *txn)
 {
 	txn->fiber = fiber();
 
-	if (txn_commit_async(txn) != 0)
+	if (txn_prepare(txn) != 0) {
+		txn_rollback(txn);
+		txn_free(txn);
+		return -1;
+	}
+
+	if (txn_commit_nop(txn)) {
+		txn_free(txn);
+		return 0;
+	}
+
+	fiber_set_txn(fiber(), NULL);
+	if (txn_write_to_wal(txn) != 0)
 		return -1;
+
 	/*
 	 * In case of non-yielding journal the transaction could already
 	 * be done and there is nothing to wait in such cases.
-- 
2.20.1



More information about the Tarantool-patches mailing list