From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (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 BEE874696C6 for ; Thu, 5 Mar 2020 15:31:14 +0300 (MSK) Received: by mail-lj1-f196.google.com with SMTP id u26so5852326ljd.8 for ; Thu, 05 Mar 2020 04:31:14 -0800 (PST) From: Cyrill Gorcunov Date: Thu, 5 Mar 2020 15:29:40 +0300 Message-Id: <20200305122943.7324-8-gorcunov@gmail.com> In-Reply-To: <20200305122943.7324-1-gorcunov@gmail.com> References: <20200305122943.7324-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 07/10] 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. 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 1c0143703..c5f24ebdb 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(); @@ -593,11 +599,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); } @@ -618,7 +619,6 @@ txn_commit(struct txn *txn) goto out; } - fiber_set_txn(fiber(), NULL); if (txn_write_to_wal(txn) != 0) return -1; -- 2.20.1