From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id AD47C23D80 for ; Thu, 20 Dec 2018 15:42:01 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o9MB6h9jk-iB for ; Thu, 20 Dec 2018 15:42:01 -0500 (EST) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 66A3623D7C for ; Thu, 20 Dec 2018 15:42:01 -0500 (EST) Subject: [tarantool-patches] Re: [PATCH v1 0/3] sql: do not use OP_Delete+OP_Insert for UPDATES References: From: Vladislav Shpilevoy Message-ID: <156112be-070e-4b54-b126-b1b0d74fd85e@tarantool.org> Date: Thu, 20 Dec 2018 23:41:59 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, Kirill Shcherbatov , Nikita Pettik Nikita, please, do first review. On 19/12/2018 18:37, Kirill Shcherbatov wrote: > Introduced a new OP_Update opcode making Tarantool native Update > operation. > In case of UPDATE or REPLACE we can't use new OP_Update as it > has a complex SQL-specific semantics: > > CREATE TABLE tj (s1 INT PRIMARY KEY, s2 INT); > INSERT INTO tj VALUES (1, 3),(2, 4),(3,5); > CREATE UNIQUE INDEX i ON tj (s2); > SELECT * FROM tj; > [1, 3], [2, 4], [3, 5] > UPDATE OR REPLACE tj SET s2 = s2 + 1; > SELECT * FROM tj; > [1, 4], [3, 6] > > I.e. [1, 3] tuple is updated as [1, 4] and have replaced tuple > [2, 4]. This logic is implemented as preventive tuples deletion > by all corresponding indexes in SQL. > > The other significant change is forbidden primary key update. > It was possible to deal with it the same way like with or > REPLACE specifier but we need an atomic UPDATE step for #3691 > ticket to support "or IGNORE/or ABORT/or FAIL" specifiers. > Reworked tests to make testing avoiding primary key UPDATE where > possible. > > Fixed bug in VDBE - sometimes temporal tuples in memory allocated > with sql_vdbe_mem_alloc_region were stored in Mem variable having > invalid flags set. > > Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-3850-op-update > Issue: https://github.com/tarantool/tarantool/issues/3850 > > Kirill Shcherbatov (3): > sql: clean-up vdbe_emit_constraint_checks > sql: fix sql_vdbe_mem_alloc_region result memory > sql: do not use OP_Delete+OP_Insert for UPDATES > > src/box/sql/delete.c | 3 +- > src/box/sql/fkey.c | 49 +++--- > src/box/sql/insert.c | 49 ++---- > src/box/sql/sqliteInt.h | 17 +- > src/box/sql/update.c | 81 +++++++-- > src/box/sql/vdbe.c | 106 ++++++++++++ > src/box/sql/vdbeInt.h | 6 + > src/box/sql/vdbeaux.c | 3 +- > src/box/sql/vdbemem.c | 36 ++++ > src/mpstream.c | 20 +++ > src/mpstream.h | 7 + > test/sql-tap/alter2.test.lua | 16 +- > test/sql-tap/analyze9.test.lua | 43 ++++- > test/sql-tap/bigrow1.test.lua | 12 +- > test/sql-tap/check.test.lua | 14 +- > test/sql-tap/fkey2.test.lua | 161 +++++++++--------- > test/sql-tap/fkey3.test.lua | 25 ++- > test/sql-tap/fkey4.test.lua | 32 ++-- > test/sql-tap/gh2140-trans.test.lua | 26 +-- > .../gh2250-trigger-chain-limit.test.lua | 8 +- > test/sql-tap/gh2259-in-stmt-trans.test.lua | 12 +- > test/sql-tap/identifier_case.test.lua | 2 +- > test/sql-tap/index6.test.lua | 5 +- > test/sql-tap/intpkey.test.lua | 10 +- > test/sql-tap/misc1.test.lua | 20 ++- > test/sql-tap/quote.test.lua | 6 +- > test/sql-tap/table.test.lua | 2 +- > test/sql-tap/tkt-a8a0d2996a.test.lua | 4 +- > test/sql-tap/tkt2767.test.lua | 16 +- > test/sql-tap/tkt2832.test.lua | 10 +- > test/sql-tap/tkt3554.test.lua | 15 +- > test/sql-tap/trigger2.test.lua | 28 +-- > test/sql-tap/trigger7.test.lua | 2 +- > test/sql-tap/triggerB.test.lua | 28 +-- > test/sql-tap/triggerC.test.lua | 43 ++--- > test/sql-tap/triggerD.test.lua | 4 +- > test/sql-tap/update.test.lua | 31 ++-- > test/sql-tap/with1.test.lua | 24 +-- > test/sql/on-conflict.result | 8 +- > test/sql/on-conflict.test.lua | 8 +- > test/sql/row-count.result | 10 +- > test/sql/row-count.test.lua | 10 +- > test/sql/triggers.result | 16 +- > test/sql/triggers.test.lua | 16 +- > 44 files changed, 660 insertions(+), 384 deletions(-) >