From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) (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 7B61544185A for ; Fri, 20 Mar 2020 11:21:31 +0300 (MSK) Received: by mail-lf1-f67.google.com with SMTP id y2so3777045lfe.11 for ; Fri, 20 Mar 2020 01:21:31 -0700 (PDT) From: Cyrill Gorcunov Date: Fri, 20 Mar 2020 11:19:53 +0300 Message-Id: <20200320081956.30650-9-gorcunov@gmail.com> In-Reply-To: <20200320081956.30650-1-gorcunov@gmail.com> References: <20200320081956.30650-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v15 08/11] box/txn: unweave txn_commit from txn_commit_async List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml 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 Signed-off-by: Cyrill Gorcunov --- 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