From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@dev.tarantool.org, kostja.osipov@gmail.com Subject: [Tarantool-patches] [PATCH v2 3/3] box: remove dead code from box_process_call/eval() Date: Thu, 16 Jan 2020 22:54:23 +0100 [thread overview] Message-ID: <52419d26967890ace8245f46fdff0604f919a029.1579211601.git.v.shpilevoy@tarantool.org> (raw) In-Reply-To: <cover.1579211601.git.v.shpilevoy@tarantool.org> box_process_call/eval() in the end check if there is an active transaction. If there is, it is rolled back, and an error is set. But rollback is not needed anymore, because anyway in the end of the request the fiber is stopped, and its not finished transaction is rolled back. Just setting of the error is enough. Follow-up #4662 --- src/box/call.c | 28 ++++------------------------ src/box/txn.c | 1 + 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/box/call.c b/src/box/call.c index bcaa453ea..a46a61c3c 100644 --- a/src/box/call.c +++ b/src/box/call.c @@ -122,23 +122,13 @@ box_process_call(struct call_request *request, struct port *port) SC_FUNCTION, tt_cstr(name, name_len))) == 0) { rc = box_lua_call(name, name_len, &args, port); } - - struct txn *txn = in_txn(); - if (rc != 0) { - if (txn != NULL) - txn_rollback(txn); - fiber_gc(); + if (rc != 0) return -1; - } - - if (txn != NULL) { + if (in_txn() != NULL) { diag_set(ClientError, ER_FUNCTION_TX_ACTIVE); port_destroy(port); - txn_rollback(txn); - fiber_gc(); return -1; } - return 0; } @@ -154,21 +144,11 @@ box_process_eval(struct call_request *request, struct port *port) request->args_end - request->args); const char *expr = request->expr; uint32_t expr_len = mp_decode_strl(&expr); - struct txn *txn; - if (box_lua_eval(expr, expr_len, &args, port) != 0) { - txn = in_txn(); - if (txn != NULL) - txn_rollback(txn); - fiber_gc(); + if (box_lua_eval(expr, expr_len, &args, port) != 0) return -1; - } - - txn = in_txn(); - if (txn != NULL) { + if (in_txn() != 0) { diag_set(ClientError, ER_FUNCTION_TX_ACTIVE); port_destroy(port); - txn_rollback(txn); - fiber_gc(); return -1; } return 0; diff --git a/src/box/txn.c b/src/box/txn.c index 963ec8eeb..0854bbacc 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -845,6 +845,7 @@ txn_on_stop(struct trigger *trigger, void *event) (void) trigger; (void) event; txn_rollback(in_txn()); /* doesn't yield or fail */ + fiber_gc(); return 0; } -- 2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-01-16 21:54 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-16 21:54 [Tarantool-patches] [PATCH v2 0/3] Fiber storage leak Vladislav Shpilevoy 2020-01-16 21:54 ` [Tarantool-patches] [PATCH v2 1/3] fiber: unref fiber.storage via global Lua state Vladislav Shpilevoy 2020-01-17 7:30 ` Konstantin Osipov 2020-01-16 21:54 ` [Tarantool-patches] [PATCH v2 2/3] fiber: destroy fiber.storage created by iproto Vladislav Shpilevoy 2020-01-16 22:00 ` Cyrill Gorcunov 2020-01-17 7:47 ` Konstantin Osipov 2020-01-17 8:06 ` Cyrill Gorcunov 2020-01-17 7:45 ` Konstantin Osipov 2020-01-19 17:32 ` Vladislav Shpilevoy 2020-01-20 7:22 ` Konstantin Osipov 2020-01-20 19:15 ` Georgy Kirichenko 2020-01-21 22:21 ` Vladislav Shpilevoy 2020-01-21 22:32 ` Konstantin Osipov 2020-01-16 21:54 ` Vladislav Shpilevoy [this message] 2020-01-17 7:46 ` [Tarantool-patches] [PATCH v2 3/3] box: remove dead code from box_process_call/eval() Konstantin Osipov 2020-01-17 7:47 ` Konstantin Osipov 2020-01-17 17:41 ` Georgy Kirichenko 2020-01-19 17:32 ` Vladislav Shpilevoy 2020-01-20 19:21 ` Georgy Kirichenko 2020-01-18 19:27 ` [Tarantool-patches] [PATCH v2 0/3] Fiber storage leak Igor Munkin 2020-02-15 1:02 ` Vladislav Shpilevoy
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=52419d26967890ace8245f46fdff0604f919a029.1579211601.git.v.shpilevoy@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=kostja.osipov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 3/3] box: remove dead code from box_process_call/eval()' \ /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