From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5F9214696C9 for ; Wed, 19 Feb 2020 21:39:24 +0300 (MSK) Received: by mail-lj1-f194.google.com with SMTP id q8so1415673ljj.11 for ; Wed, 19 Feb 2020 10:39:24 -0800 (PST) From: Cyrill Gorcunov Date: Wed, 19 Feb 2020 21:37:10 +0300 Message-Id: <20200219183713.17646-12-gorcunov@gmail.com> In-Reply-To: <20200219183713.17646-1-gorcunov@gmail.com> References: <20200219183713.17646-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 11/14] box/txn: merge txn_write_to_wal_async to txn_commit_async List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml No need for separate routine, everything is ready to be used inside txn_commit_async itself. Signed-off-by: Cyrill Gorcunov --- 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