From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (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 E52934696C4 for ; Wed, 19 Feb 2020 21:39:58 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id w1so1454396ljh.5 for ; Wed, 19 Feb 2020 10:39:58 -0800 (PST) From: Cyrill Gorcunov Date: Wed, 19 Feb 2020 21:37:13 +0300 Message-Id: <20200219183713.17646-15-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 14/14] box/txn: use journal_write in txn_commit List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml This allows us to keep wait for transaction complete in one place -- inside journal_write. Signed-off-by: Cyrill Gorcunov --- 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