From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (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 14C78430D49 for ; Thu, 19 Mar 2020 12:07:14 +0300 (MSK) Received: by mail-lf1-f68.google.com with SMTP id x143so942871lff.12 for ; Thu, 19 Mar 2020 02:07:14 -0700 (PDT) From: Cyrill Gorcunov Date: Thu, 19 Mar 2020 12:05:34 +0300 Message-Id: <20200319090537.5613-9-gorcunov@gmail.com> In-Reply-To: <20200319090537.5613-1-gorcunov@gmail.com> References: <20200319090537.5613-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v13 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