From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id A2C7D3162F for ; Fri, 21 Jun 2019 17:48:26 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dJbuj8VH7zVh for ; Fri, 21 Jun 2019 17:48:26 -0400 (EDT) Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E45FE315E1 for ; Fri, 21 Jun 2019 17:48:25 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH v5 1/7] txn: unref statement at txn_free Date: Sat, 22 Jun 2019 00:48:15 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Georgy Kirichenko Refactoring: put txn statement unref code into transaction free function. --- src/box/txn.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/box/txn.c b/src/box/txn.c index 7a2c8cdaf..9aa460f50 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -168,6 +168,10 @@ txn_new() inline static void txn_free(struct txn *txn) { + struct txn_stmt *stmt; + stailq_foreach_entry(stmt, &txn->stmts, next) + txn_stmt_unref_tuples(stmt); + /* Truncate region up to struct txn size. */ region_truncate(&txn->region, sizeof(struct txn)); stailq_add(&txn_cache, &txn->in_txn_cache); @@ -448,10 +452,6 @@ txn_commit(struct txn *txn) panic("commit trigger failed"); } - struct txn_stmt *stmt; - stailq_foreach_entry(stmt, &txn->stmts, next) - txn_stmt_unref_tuples(stmt); - fiber_set_txn(fiber(), NULL); txn_free(txn); return 0; @@ -489,10 +489,6 @@ txn_rollback() panic("rollback trigger failed"); } - struct txn_stmt *stmt; - stailq_foreach_entry(stmt, &txn->stmts, next) - txn_stmt_unref_tuples(stmt); - /** Free volatile txn memory. */ fiber_gc(); fiber_set_txn(fiber(), NULL); -- 2.22.0