From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Alex Khatskevich <avkhatskevich@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 2/2] sql: add test on changes/total_changes
Date: Mon, 1 Oct 2018 02:54:24 +0300 [thread overview]
Message-ID: <7BEF7461-8C36-472F-95D7-6E46CD99E956@tarantool.org> (raw)
In-Reply-To: <de9c4270a4f3fe49483ac9dc3b065bf12c11a0f4.1538051558.git.avkhatskevich@tarantool.org>
> On 27 Sep 2018, at 15:39, AKhatskevich <avkhatskevich@tarantool.org> wrote:
>
> Closes #2181
> ---
> test/sql-tap/gh2181-changes-statistics.test.lua | 74 +++++++++++++++++++++++++
> 1 file changed, 74 insertions(+)
> create mode 100755 test/sql-tap/gh2181-changes-statistics.test.lua
>
> diff --git a/test/sql-tap/gh2181-changes-statistics.test.lua b/test/sql-tap/gh2181-changes-statistics.test.lua
> new file mode 100755
> index 000000000..26eb95f28
> --- /dev/null
> +++ b/test/sql-tap/gh2181-changes-statistics.test.lua
> @@ -0,0 +1,74 @@
> +#!/usr/bin/env tarantool
> +test = require("sqltester")
> +test:plan(56)
> +
> +test:do_select_tests(
> + "gh2181-changes-statistics",
> + {
> + {"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 = 1", {}},
> + {"7.1", "SELECT CHANGES()", {1}},
> + {"7.2", "SELECT TOTAL_CHANGES()", {11}},
> + {"8.0", "UPDATE T1 SET A = 1 where A = 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 = 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 == 20? At S1 savepoint we have
TOTAL_CHANGES == 19, so after rollback I guess it shouldn’t change…
Did I miss something?
next prev parent reply other threads:[~2018-09-30 23:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-27 12:39 [tarantool-patches] [PATCH 0/2] Add test on changes && fix typo in MakeRecord AKhatskevich
2018-09-27 12:39 ` [tarantool-patches] [PATCH 1/2] sql: fix typo in MakeRecord memory hint AKhatskevich
2018-10-01 0:12 ` [tarantool-patches] " n.pettik
2018-09-27 12:39 ` [tarantool-patches] [PATCH 2/2] sql: add test on changes/total_changes AKhatskevich
2018-09-30 23:54 ` n.pettik [this message]
[not found] ` <c5639a4e-0b51-cbaa-112c-4f47d86bbe07@tarantool.org>
2018-10-01 15:20 ` [tarantool-patches] " n.pettik
2018-10-01 16:13 ` Alex Khatskevich
[not found] ` <881CB143-0DC2-468A-90CA-0459E9EE7B15@gmail.com>
2018-10-04 10:49 ` n.pettik
[not found] ` <75020feb-3d2a-2707-bfdb-fd3fd2229afa@tarantool.org>
2018-10-09 12:11 ` n.pettik
2018-10-10 14:39 ` Alex Khatskevich
2018-10-18 14:41 ` n.pettik
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=7BEF7461-8C36-472F-95D7-6E46CD99E956@tarantool.org \
--to=korablev@tarantool.org \
--cc=avkhatskevich@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH 2/2] sql: add test on changes/total_changes' \
/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