From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>,
tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: prevent executing crossengine sql
Date: Fri, 20 Jul 2018 18:03:30 +0300 [thread overview]
Message-ID: <50ac96b7-d395-f528-f66b-c10847e54670@tarantool.org> (raw)
In-Reply-To: <6134a0afdcfba13ca289e2d42fdd529a2787070a.1532094680.git.kshcherbatov@tarantool.org>
Hi! Thanks for the good diligent attempt to fix the bug,
the patch looks really cool except a pair of minor things,
but I think, that it is fatally flawed because
1) It still do not begin_ro_stmt though Vinyl needs it to
send iterators and transactions into read view;
2) Only opcodes analysis does not help when we have multiple
statements each parsed into own Vdbe and then they are
executed under the transaction.
Example (yes, we do not have PREPARE, but we will do):
p1 = PREPARE INSERT INTO memtx_space VALUES (1, 2, 3);
p2 = PREPARE SELECT * FROM vinyl_space;
-- In both no cross-engine things are detected.
-- Now execute them together.
START TRANSACTION;
EXECUTE p1;
EXECUTE p2; -- Fail.
COMMIT;
So we should use txn_begin_ro_stmt for iterators.
Strictly speaking, it crashes already now, even after the
patch applied:
box.cfg{}
box.sql.execute("CREATE TABLE test (id INT PRIMARY KEY)")
box.sql.execute("PRAGMA sql_default_engine='vinyl'")
box.sql.execute("CREATE TABLE test2 (id INT PRIMARY KEY)")
box.sql.execute("INSERT INTO test2 VALUES (2)")
function f()
box.sql.execute("START TRANSACTION")
box.sql.execute("INSERT INTO test VALUES (1)")
box.sql.execute("SELECT * FROM test2")
box.sql.execute("COMMIT")
end
tarantool> f()
Assertion failed: (tx == NULL || tx->state == VINYL_TX_READY), function vinyl_index_create_iterator, file /Users/v.shpilevoy/Work/Repositories/tarantool/src/box/vinyl.c, line 4038.
Process 6270 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff5fdcab66 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff5fdcab66 <+10>: jae 0x7fff5fdcab70 ; <+20>
0x7fff5fdcab68 <+12>: movq %rax, %rdi
0x7fff5fdcab6b <+15>: jmp 0x7fff5fdc1ae9 ; cerror_nocancel
0x7fff5fdcab70 <+20>: retq
Target 0: (tarantool) stopped.
On 20/07/2018 16:52, Kirill Shcherbatov wrote:
> Some sql requests are complex and could contain R/W with
> multiple spaces. As we have no ability to make such changes
> transactionaly, we have to dissallow such requests. This mean
> that we shouldn't create triggers on memtex spaces writing
> something in vinyl and so on.
> Since now, such checks are carried out on sql_finish_coding,
> the last parsing step.
> Pay attention, that _sql_stat1 and _sql_stat4 are exceptions.
> Most requests(excluding ANALYZE) use them only for READ and it
> is ok.
>
> Closes #3551
> ---
> Branch: http://github.com/tarantool/tarantool/tree/kshch/kshch/gh-3551-crossengine-sql
> Issue: https://github.com/tarantool/tarantool/issues/3551
>
next prev parent reply other threads:[~2018-07-20 15:03 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 13:52 [tarantool-patches] " Kirill Shcherbatov
2018-07-20 15:03 ` Vladislav Shpilevoy [this message]
2018-07-20 17:50 ` [tarantool-patches] " Kirill Shcherbatov
2018-07-23 11:50 ` Vladislav Shpilevoy
2018-07-23 16:20 ` n.pettik
2018-07-23 16:39 ` Vladislav Shpilevoy
2018-07-23 17:09 ` n.pettik
2018-07-23 17:21 ` Vladislav Shpilevoy
2018-07-23 18:06 ` n.pettik
2018-07-23 18:29 ` Vladislav Shpilevoy
2018-07-24 11:05 ` [tarantool-patches] [PATCH v1 1/2] sql: use schema API to get index info in analyze Kirill Shcherbatov
[not found] ` <cover.1532430181.git.kshcherbatov@tarantool.org>
2018-07-24 11:05 ` [tarantool-patches] [PATCH v1 2/2] sql: prevent executing crossengine sql Kirill Shcherbatov
2018-07-25 13:24 ` [tarantool-patches] " n.pettik
2018-07-25 17:07 ` Kirill Shcherbatov
2018-07-25 21:05 ` Vladislav Shpilevoy
2018-07-26 7:08 ` Kirill Shcherbatov
2018-07-26 8:54 ` Vladislav Shpilevoy
2018-07-26 11:22 ` Kirill Shcherbatov
2018-07-26 21:26 ` Vladislav Shpilevoy
2018-07-27 7:13 ` Kirill Shcherbatov
2018-07-27 8:55 ` Vladislav Shpilevoy
2018-07-27 10:02 ` Kirill Shcherbatov
2018-07-27 10:14 ` Vladislav Shpilevoy
2018-07-31 7:54 ` Kirill Yukhin
2018-07-25 13:22 ` [tarantool-patches] Re: [PATCH v1 1/2] sql: use schema API to get index info in analyze n.pettik
2018-07-25 17:07 ` Kirill Shcherbatov
2018-07-25 20:52 ` 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=50ac96b7-d395-f528-f66b-c10847e54670@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: prevent executing crossengine sql' \
/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