[Tarantool-patches] [PATCH 11/14] box/txn: merge txn_write_to_wal_async to txn_commit_async

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


No need for separate routine, everything is ready
to be used inside txn_commit_async itself.

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

diff --git a/src/box/txn.c b/src/box/txn.c
index 4dbaf5b91..a95c28431 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -536,24 +536,6 @@ txn_entry_new(struct txn *txn)
 	return req;
 }
 
-static int64_t
-txn_write_to_wal_async(struct txn *txn)
-{
-	struct journal_entry *req = txn_entry_new(txn);
-	if (req == NULL) {
-		txn_rollback(txn);
-		return -1;
-	}
-
-	/* Send the entry to the journal. */
-	if (journal_write_async(req) < 0) {
-		diag_set(ClientError, ER_WAL_IO);
-		diag_log();
-		return -1;
-	}
-	return 0;
-}
-
 /*
  * Prepare a transaction using engines.
  */
@@ -602,7 +584,20 @@ txn_commit_async(struct txn *txn)
 	if (txn_complete_nop(txn))
 		return 0;
 
-	return txn_write_to_wal_async(txn);
+	struct journal_entry *req = txn_entry_new(txn);
+	if (req == NULL) {
+		txn_rollback(txn);
+		return -1;
+	}
+
+	/* Send the entry to the journal. */
+	if (journal_write_async(req) < 0) {
+		diag_set(ClientError, ER_WAL_IO);
+		diag_log();
+		return -1;
+	}
+
+	return 0;
 }
 
 int
-- 
2.20.1



More information about the Tarantool-patches mailing list