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 3707B28FAE for ; Mon, 11 Mar 2019 07:56:35 -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 GvkraAFUceKK for ; Mon, 11 Mar 2019 07:56:35 -0400 (EDT) Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (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 849DB20F1D for ; Mon, 11 Mar 2019 07:56:34 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH v2] txn: factor fiber_gc out of txn_rollback Date: Mon, 11 Mar 2019 14:56:31 +0300 Message-Id: <9f046ffc5c88f28b817b9c351d257c9c1b3cfc47.1552305225.git.georgy@tarantool.org> 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 In some cases we want to retry an operation after possible error leading to txn_rollback so we shouldn't clear fiber gc memory in such cases. Also it is consistent with txn_commit that doesn't clear gc memory. Changes in v2: * add fiber_gc after txn_rollback invocation. Follow-up 77fa1736dbb9 box: factor fiber_gc out of txn_commit Branch: https://github.com/tarantool/tarantool/tree/g.kirichenko/gh-2618-txn-rollback-gc-follow-up --- src/box/call.c | 4 ++++ src/box/txn.c | 4 ++-- src/box/vy_scheduler.c | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/box/call.c b/src/box/call.c index b9750c5f3..639b66610 100644 --- a/src/box/call.c +++ b/src/box/call.c @@ -209,12 +209,14 @@ box_process_call(struct call_request *request, struct port *port) if (rc != 0) { txn_rollback(); + fiber_gc(); return -1; } if (in_txn()) { diag_set(ClientError, ER_FUNCTION_TX_ACTIVE); txn_rollback(); + fiber_gc(); return -1; } @@ -230,12 +232,14 @@ box_process_eval(struct call_request *request, struct port *port) return -1; if (box_lua_eval(request, port) != 0) { txn_rollback(); + fiber_gc(); return -1; } if (in_txn()) { diag_set(ClientError, ER_FUNCTION_TX_ACTIVE); txn_rollback(); + fiber_gc(); return -1; } diff --git a/src/box/txn.c b/src/box/txn.c index 7900fb3ab..1f488bbcc 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -399,8 +399,6 @@ txn_rollback() txn_stmt_unref_tuples(stmt); TRASH(txn); - /** Free volatile txn memory. */ - fiber_gc(); fiber_set_txn(fiber(), NULL); } @@ -480,6 +478,8 @@ box_txn_rollback() return -1; } txn_rollback(); /* doesn't throw */ + /** Free volatile txn memory. */ + fiber_gc(); return 0; } diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c index 92d407808..1e8210fe6 100644 --- a/src/box/vy_scheduler.c +++ b/src/box/vy_scheduler.c @@ -901,6 +901,7 @@ fail: batch->is_failed = true; diag_move(diag_get(), &batch->diag); txn_rollback(); + fiber_gc(); } /** -- 2.21.0