From: Nikita Pettik <korablev@tarantool.org> To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org> Subject: [tarantool-patches] [PATCH 4/4] sql: fix SAVEPOINT RELEASE statement Date: Thu, 3 May 2018 21:49:25 +0300 [thread overview] Message-ID: <db45505203365b8dce7890b9daf59584371b070d.1525368399.git.korablev@tarantool.org> (raw) In-Reply-To: <cover.1525368399.git.korablev@tarantool.org> In-Reply-To: <cover.1525368399.git.korablev@tarantool.org> Before this patch SAVEPOINT RELEASE statement always raised error, due to SQLite's obsolete code. Now it has been removed, and SAVEPOINT RELEASE works as desired. Closes #3379 --- src/box/sql/vdbe.c | 7 ----- test/sql/gh-3379-release-savepoints.result | 40 ++++++++++++++++++++++++++++ test/sql/gh-3379-release-savepoints.test.lua | 26 ++++++++++++++++++ 3 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 test/sql/gh-3379-release-savepoints.result create mode 100644 test/sql/gh-3379-release-savepoints.test.lua diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 6ea04901c..62f393de4 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -2901,13 +2901,6 @@ case OP_Savepoint: { if (!pSavepoint) { sqlite3VdbeError(p, "no such savepoint: %s", zName); rc = SQLITE_ERROR; - } else if (p1==SAVEPOINT_RELEASE) { - /* It is not possible to release (commit) a savepoint if there are - * active write statements. - */ - sqlite3VdbeError(p, "cannot release savepoint - " - "SQL statements in progress"); - rc = SQLITE_BUSY; } else { /* Determine whether or not this is a transaction savepoint. If so, diff --git a/test/sql/gh-3379-release-savepoints.result b/test/sql/gh-3379-release-savepoints.result new file mode 100644 index 000000000..5f5804b66 --- /dev/null +++ b/test/sql/gh-3379-release-savepoints.result @@ -0,0 +1,40 @@ +test_run = require('test_run').new() +--- +... +test_run:cmd("setopt delimiter ';'") +--- +- true +... +-- These tests check that release of SQL savepoints works as desired. +-- +-- box.cfg() +release_sv = function() + box.begin() + box.sql.execute('SAVEPOINT t1;') + box.sql.execute('RELEASE SAVEPOINT t1;') +end; +--- +... +release_sv(); +--- +... +box.commit(); +--- +... +release_sv_fail = function() + box.begin() + box.sql.execute('SAVEPOINT t1;') + box.sql.execute('SAVEPOINT t2;') + box.sql.execute('RELEASE SAVEPOINT t2;') + box.sql.execute('RELEASE SAVEPOINT t1;') + box.sql.execute('ROLLBACK TO t1;') +end; +--- +... +release_sv_fail(); +--- +- error: 'no such savepoint: T1' +... +box.commit(); +--- +... diff --git a/test/sql/gh-3379-release-savepoints.test.lua b/test/sql/gh-3379-release-savepoints.test.lua new file mode 100644 index 000000000..6b299045d --- /dev/null +++ b/test/sql/gh-3379-release-savepoints.test.lua @@ -0,0 +1,26 @@ +test_run = require('test_run').new() +test_run:cmd("setopt delimiter ';'") + +-- These tests check that release of SQL savepoints works as desired. +-- + +-- box.cfg() + +release_sv = function() + box.begin() + box.sql.execute('SAVEPOINT t1;') + box.sql.execute('RELEASE SAVEPOINT t1;') +end; +release_sv(); +box.commit(); + +release_sv_fail = function() + box.begin() + box.sql.execute('SAVEPOINT t1;') + box.sql.execute('SAVEPOINT t2;') + box.sql.execute('RELEASE SAVEPOINT t2;') + box.sql.execute('RELEASE SAVEPOINT t1;') + box.sql.execute('ROLLBACK TO t1;') +end; +release_sv_fail(); +box.commit(); -- 2.15.1
next prev parent reply other threads:[~2018-05-03 18:49 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 ` [tarantool-patches] " Vladislav Shpilevoy 2018-05-05 19:15 ` n.pettik 2018-05-03 18:49 ` Nikita Pettik [this message] 2018-05-04 14:12 ` [tarantool-patches] Re: [PATCH 4/4] sql: fix SAVEPOINT RELEASE statement 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=db45505203365b8dce7890b9daf59584371b070d.1525368399.git.korablev@tarantool.org \ --to=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH 4/4] sql: fix SAVEPOINT RELEASE statement' \ /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