[Tarantool-patches] [PATCH 14/14] box/txn: use journal_write in txn_commit

Cyrill Gorcunov gorcunov at gmail.com
Wed Feb 19 21:37:13 MSK 2020


This allows us to keep wait for transaction
complete in one place -- inside journal_write.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 src/box/txn.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/box/txn.c b/src/box/txn.c
index 38241c066..8f9be3269 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -619,25 +619,11 @@ txn_commit(struct txn *txn)
 		return -1;
 	}
 
-	/* Send the entry to the journal. */
-	if (journal_write_async(req) < 0) {
+	int res = journal_write(req);
+	if (res != 0) {
 		diag_set(ClientError, ER_WAL_IO);
 		diag_log();
-		return -1;
-	}
-
-	/*
-	 * In case of non-yielding journal the transaction could already
-	 * be done and there is nothing to wait in such cases.
-	 */
-	if (!txn_has_flag(txn, TXN_IS_DONE)) {
-		bool cancellable = fiber_set_cancellable(false);
-		fiber_yield();
-		fiber_set_cancellable(cancellable);
 	}
-	int res = txn->signature >= 0 ? 0 : -1;
-	if (res != 0)
-		diag_set(ClientError, ER_WAL_IO);
 
 	/* Synchronous transactions are freed by the calling fiber. */
 	txn_free(txn);
-- 
2.20.1



More information about the Tarantool-patches mailing list