From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (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 99653430D44 for ; Thu, 19 Mar 2020 12:07:25 +0300 (MSK) Received: by mail-lf1-f66.google.com with SMTP id j11so970013lfg.4 for ; Thu, 19 Mar 2020 02:07:25 -0700 (PDT) From: Cyrill Gorcunov Date: Thu, 19 Mar 2020 12:05:35 +0300 Message-Id: <20200319090537.5613-10-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 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