From: Georgy Kirichenko <georgy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Georgy Kirichenko <georgy@tarantool.org>
Subject: [tarantool-patches] [PATCH v2] txn: factor fiber_gc out of txn_rollback
Date: Mon, 11 Mar 2019 14:56:31 +0300 [thread overview]
Message-ID: <9f046ffc5c88f28b817b9c351d257c9c1b3cfc47.1552305225.git.georgy@tarantool.org> (raw)
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
next reply other threads:[~2019-03-11 11:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 11:56 Georgy Kirichenko [this message]
2019-03-11 12:27 ` Vladimir Davydov
2019-03-11 14:21 ` [tarantool-patches] " Konstantin Osipov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9f046ffc5c88f28b817b9c351d257c9c1b3cfc47.1552305225.git.georgy@tarantool.org \
--to=georgy@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH v2] txn: factor fiber_gc out of txn_rollback' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox