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 EFDE0441857 for ; Fri, 20 Mar 2020 11:21:42 +0300 (MSK) Received: by mail-lj1-f194.google.com with SMTP id z10so4594601ljn.0 for ; Fri, 20 Mar 2020 01:21:42 -0700 (PDT) From: Cyrill Gorcunov Date: Fri, 20 Mar 2020 11:19:54 +0300 Message-Id: <20200320081956.30650-10-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 09/11] box/txn: clear fiber storage right before journal write List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Otherwise we won't be able to make a rollback in case of journal_entry_new allocation failure. Acked-by: Konstantin Osipov Signed-off-by: Cyrill Gorcunov --- src/box/txn.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/box/txn.c b/src/box/txn.c index 06043a2d8..4e23e9828 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -513,7 +513,13 @@ txn_write_to_wal(struct txn *txn) assert(remote_row == req->rows + txn->n_applier_rows); assert(local_row == remote_row + txn->n_new_rows); - /* Send the entry to the journal. */ + /* + * Send the entry to the journal. + * + * After this point the transaction must not be used + * so reset the corresponding key in the fiber storage. + */ + fiber_set_txn(fiber(), NULL); if (journal_write(req) < 0) { diag_set(ClientError, ER_WAL_IO); diag_log(); @@ -586,11 +592,6 @@ txn_commit_async(struct txn *txn) if (txn_commit_nop(txn)) return 0; - /* - * After this point the transaction must not be used - * so reset the corresponding key in the fiber storage. - */ - fiber_set_txn(fiber(), NULL); return txn_write_to_wal(txn); } @@ -610,7 +611,6 @@ txn_commit(struct txn *txn) return 0; } - fiber_set_txn(fiber(), NULL); if (txn_write_to_wal(txn) != 0) return -1; -- 2.20.1