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 E0C6D29FAC for ; Mon, 1 Oct 2018 11:20:28 -0400 (EDT) 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 qTfks-LTkPnt for ; Mon, 1 Oct 2018 11:20:28 -0400 (EDT) Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (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 9D0022862D for ; Mon, 1 Oct 2018 11:20:28 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH 2/2] sql: add test on changes/total_changes From: "n.pettik" In-Reply-To: Date: Mon, 1 Oct 2018 18:20:22 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <9C1DDEBD-C37D-4B61-96AC-832BC4DDD12A@tarantool.org> References: <7BEF7461-8C36-472F-95D7-6E46CD99E956@tarantool.org> 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 Cc: Alex Khatskevich > On 1 Oct 2018, at 12:09, Alex Khatskevich = wrote: >=20 >>>=20 >>> + {"0.1", "SELECT CHANGES()", {0}}, >>> + {"0.2", "SELECT TOTAL_CHANGES()", {0}}, >>> + {"1.0", "CREATE TABLE T1(A PRIMARY KEY)", {}}, >>> + {"1.1", "SELECT CHANGES()", {1}}, >>> + {"1.2", "SELECT TOTAL_CHANGES()", {1}}, >>> + {"2.0", "INSERT INTO T1 VALUES(1)", {}}, >>> + {"2.1", "SELECT CHANGES()", {1}}, >>> + {"2.2", "SELECT TOTAL_CHANGES()", {2}}, >>> + {"3.0", "INSERT INTO T1 VALUES(2)", {}}, >>> + {"3.1", "SELECT CHANGES()", {1}}, >>> + {"3.2", "SELECT TOTAL_CHANGES()", {3}}, >>> + {"4.0", "CREATE TABLE T2(A PRIMARY KEY)", {}}, >>> + {"4.1", "SELECT CHANGES()", {1}}, >>> + {"4.2", "SELECT TOTAL_CHANGES()", {4}}, >>> + {"5.0", "INSERT INTO T2 SELECT * FROM T1", {}}, >>> + {"5.1", "SELECT CHANGES()", {2}}, >>> + {"5.2", "SELECT TOTAL_CHANGES()", {6}}, >>> + {"6.0", [[ >>> + CREATE TRIGGER TRIG1 AFTER INSERT ON T1 FOR EACH = ROW BEGIN >>> + INSERT INTO T2 VALUES(NEW.A); >>> + END; >>> + ]],{}}, >>> + {"6.1", "SELECT CHANGES()", {1}}, >>> + {"6.2", "SELECT TOTAL_CHANGES()", {7}}, >>> + {"6.3", "INSERT INTO T1 VALUES(3)", {}}, >>> + -- 1 instead of 2; sqlite is the same. >>> + {"6.4", "SELECT CHANGES()", {1}}, >>> + {"6.5", "SELECT TOTAL_CHANGES()", {9}}, >>> + {"6.6", "DROP TRIGGER TRIG1"}, >>> + {"6.7", "SELECT CHANGES()", {1}}, >>> + {"6.8", "SELECT TOTAL_CHANGES()", {10}}, >>> + {"7.0", "DELETE FROM T1 WHERE A =3D 1", {}}, >>> + {"7.1", "SELECT CHANGES()", {1}}, >>> + {"7.2", "SELECT TOTAL_CHANGES()", {11}}, >>> + {"8.0", "UPDATE T1 SET A =3D 1 where A =3D 2", {}}, >>> + {"8.1", "SELECT CHANGES()", {1}}, >>> + {"8.2", "SELECT TOTAL_CHANGES()", {12}}, >>> + {"9.0", "SELECT COUNT(*) FROM T2", {3}}, >>> + {"9.1", "UPDATE T2 SET A =3D A + 3", {}}, >>> + -- Inserts to an ephemeral space are not counted. >>> + {"9.2", "SELECT CHANGES()", {3}}, >>> + {"9.3", "SELECT TOTAL_CHANGES()", {15}}, >>> + {"11.0", "DELETE FROM T1", {}}, >>> + {"11.1", "SELECT CHANGES()", {0}}, >>> + {"11.2", "SELECT TOTAL_CHANGES()", {15}}, >>> + {"12.0", "DELETE FROM T2 WHERE A < 100", {}}, >>> + {"12.1", "SELECT CHANGES()", {3}}, >>> + {"12.2", "SELECT TOTAL_CHANGES()", {18}}, >>> + -- Transactions/savepoints. >>> + {"13.0", "START TRANSACTION", {}}, >>> + {"13.1", "INSERT INTO T1 VALUES(11)", {}}, >>> + {"13.2", "SELECT CHANGES()", {1}}, >>> + {"13.3", "SELECT TOTAL_CHANGES()", {19}}, >>> + {"13.4", "SAVEPOINT S1", {}}, >>> + {"13.5", "INSERT INTO T1 VALUES(12)", {}}, >>> + {"13.6", "SELECT CHANGES()", {1}}, >>> + {"13.7", "SELECT TOTAL_CHANGES()", {20}}, >>> + {"13.8", "ROLLBACK TO SAVEPOINT S1", {}}, >>> + {"13.9", "SELECT CHANGES()", {1}}, >>> + {"13.10", "SELECT TOTAL_CHANGES()", {20}}, >> But why here TOTAL_CHANGES =3D=3D 20? At S1 savepoint we have >> TOTAL_CHANGES =3D=3D 19, so after rollback I guess it shouldn=E2=80=99t= change=E2=80=A6 >> Did I miss something? > I have expected the same thing. > However: > 1. sqlite works in the same way. It doesn=E2=80=99t mean anything. SQLite features a wide range of really = strange things. > 2. implementing this just need adding (nChanges) to savepoint Seems so, but it shouldn=E2=80=99t be complicated. > 3. I suppose that we should not implement this. Why? I guess it is matter of discussion. > The only difference with sqlite is ddl operations are counted in = tarantool. > The reason is obvious (count changes flag is raised where it should = not be). > I propose just to create issue on this by now (i will do it). Anyway, I propose to decide what to do with TOTAL_CHANGES within this = patch, since original issue sounds like: "Fix if easy, remove otherwise.=E2=80=9D Adding initially wrong tests is likely to be huge mistake. PS don=E2=80=99t forget to add mailing list to receivers.