From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>, tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH 3/4] sql: allow SAVEPOINT statement outside transaction
Date: Fri, 4 May 2018 17:12:32 +0300 [thread overview]
Message-ID: <bc9aa5d6-5733-67d6-c69e-82e8d19343e6@tarantool.org> (raw)
In-Reply-To: <b69afda201a1200b1bdbb3ba22bd9b570397c788.1525368399.git.korablev@tarantool.org>
Hello. Thanks for contributing!
See below 3 comments.
On 03/05/2018 21:49, Nikita Pettik wrote:
> Before this patch, usage of SAVEPOINT statement outside transaction or
> inside transaction started in Lua, led to assertion fault.
> Now, failed assert is substituted with checks to test transaction status.
>
> Closes #3313
> ---
> src/box/sql/vdbe.c | 8 +++++-
> test/sql/gh-3313-savepoints-outside-txn.result | 32 ++++++++++++++++++++++++
> test/sql/gh-3313-savepoints-outside-txn.test.lua | 18 +++++++++++++
> 3 files changed, 57 insertions(+), 1 deletion(-)
> create mode 100644 test/sql/gh-3313-savepoints-outside-txn.result
> create mode 100644 test/sql/gh-3313-savepoints-outside-txn.test.lua
>
> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index 1192fc399..6ea04901c 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -2867,7 +2867,13 @@ case OP_Savepoint: {
> Savepoint *pTmp;
> struct sql_txn *psql_txn = p->psql_txn;
>
> - assert(psql_txn);
> + if (psql_txn == NULL) {
> + assert(!box_txn());
> + sqlite3VdbeError(p, "cannot process savepoint: "
> + "there is no active transaction");
> + rc = SQLITE_ERROR;
> + goto abort_due_to_error;
> + }
1. Lets use diag_set(ClientError, ER_SAVEPOINT_NO_TRANSACTION) and return TARANTOOL_ERROR.
It must behave like box.savepoint.
> diff --git a/test/sql/gh-3313-savepoints-outside-txn.result b/test/sql/gh-3313-savepoints-outside-txn.result
> new file mode 100644
> index 000000000..702d3e815
> --- /dev/null
> +++ b/test/sql/gh-3313-savepoints-outside-txn.result
> @@ -0,0 +1,32 @@
> +test_run = require('test_run').new()
> +---
> +...
> +test_run:cmd("setopt delimiter ';'")
2. Why do you need here a special delimiter? Your test does not
contain multi-line statements.
> +---
> +- true
> +...
> +-- These tests check that SQL savepoints properly work outside
> +-- transactions as well as inside transactions started in Lua.
> +--
> +-- box.cfg()
3. Garbage comment.
next prev parent reply other threads:[~2018-05-04 14:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 18:49 [tarantool-patches] [PATCH 0/4] Rework SQL transaction processing Nikita Pettik
2018-05-03 18:49 ` [tarantool-patches] [PATCH 1/4] sql: remove OP_AutoCommit opcode Nikita Pettik
2018-05-04 14:12 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-05 19:14 ` n.pettik
2018-05-03 18:49 ` [tarantool-patches] [PATCH 2/4] sql: allow transitive Lua <-> SQL transactions Nikita Pettik
2018-05-04 14:12 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-05 19:14 ` n.pettik
2018-05-03 18:49 ` [tarantool-patches] [PATCH 3/4] sql: allow SAVEPOINT statement outside transaction Nikita Pettik
2018-05-04 14:12 ` Vladislav Shpilevoy [this message]
2018-05-05 19:15 ` [tarantool-patches] " n.pettik
2018-05-03 18:49 ` [tarantool-patches] [PATCH 4/4] sql: fix SAVEPOINT RELEASE statement Nikita Pettik
2018-05-04 14:12 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-05 19:16 ` n.pettik
2018-05-07 13:31 ` [tarantool-patches] Re: [PATCH 0/4] Rework SQL transaction processing Vladislav Shpilevoy
2018-05-11 7:17 ` Kirill Yukhin
2018-05-11 10:08 ` Kirill Yukhin
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=bc9aa5d6-5733-67d6-c69e-82e8d19343e6@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH 3/4] sql: allow SAVEPOINT statement outside transaction' \
/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