Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander Turenko" <alexander.turenko@tarantool.org>
To: vanyail <vanyail@yandex.ru>
Cc: tarantool-patches <tarantool-patches@freelists.org>
Subject: [tarantool-patches] Re: [patches] [PATCH] Ban of REINDEX syntax.
Date: Thu, 15 Mar 2018 16:34:52 +0300	[thread overview]
Message-ID: <1521120892.753756821@f173.i.mail.ru> (raw)
In-Reply-To: <1521051043-28203-1-git-send-email-vanyail@yandex.ru>


Hi, Ivan!

Congratulations with the first contribution!

Consider the review below. Please, update the patch accordingly and send again.

WBR, Alexander Turenko.
----

Common:
- I suggest to have real name in the 'user.name' git-config setting
- rebase on top of the current 2.0

Subject line:
- add 'sql:' prefix
- remove period at the end

>Среда, 14 марта 2018, 21:12 +03:00 от vanyail < vanyail@yandex.ru >:
>
>This change cut REINDEX syntax from keywords and also disables tests which were using this syntax.

Wrap commit message lines to be 72 symbols wide.

>
>This patch is not totally removing this syntax because it will be allowed in future releases.

I would say that the change is about parser, but the implementation under hood
was hold as is, because it is planned to fix and enable this feature in the 
scope of #3195.

>
>Fixes #2174
>---

Add links to the issue and the branch here (right below --- mark).

> extra/mkkeywordhash.c                            |    6 -
> src/box/sql/keywordhash.h                        |  614 +++++-----
> src/box/sql/parse.c                              | 1413 +++++++++++-----------
> src/box/sql/parse.y                              |    7 -
> test/sql-tap/gh-2174-ban-reindex-syntax.test.lua |   15 +
> test/sql-tap/keyword1.test.lua                   |    3 +-
> test/sql-tap/suite.ini                           |    3 +-
> 7 files changed, 1018 insertions(+), 1043 deletions(-)
> create mode 100755 test/sql-tap/gh-2174-ban-reindex-syntax.test.lua


>diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
>index 914fc53..738d130 100644
>--- a/src/box/sql/parse.y
>+++ b/src/box/sql/parse.y
>@@ -1472,13 +1472,6 @@ cmd ::= DROP TRIGGER ifexists(NOERR) fullname(X). {
> }
> %endif  !SQLITE_OMIT_TRIGGER
>
>-////////////////////////// REINDEX collation //////////////////////////////////
>-%ifndef SQLITE_OMIT_REINDEX
>-cmd ::= REINDEX.                {sqlite3Reindex(pParse, 0, 0);}
>-cmd ::= REINDEX nm(X).          {sqlite3Reindex(pParse, &X, 0);}
>-cmd ::= REINDEX nm(X) ON nm(Y). {sqlite3Reindex(pParse, &X, &Y);}
>-%endif  SQLITE_OMIT_REINDEX
>-

It is better to leave the REINDEX parser code commented (see the ALTER ADD 
COLUMN case below). It is good to link the issue in the scope of which it was
commented and the issue in the scope of which it will be fixed and enabled.

>
> /////////////////////////////////// ANALYZE ///////////////////////////////////
> %ifndef SQLITE_OMIT_ANALYZE
> cmd ::= ANALYZE.                {sqlite3Analyze(pParse, 0);}
>diff --git a/test/sql-tap/gh-2174-ban-reindex-syntax.test.lua b/test/sql-tap/gh-2174-ban-reindex-syntax.test.lua
>new file mode 100755
>index 0000000..97c8390
>--- /dev/null
>+++ b/test/sql-tap/gh-2174-ban-reindex-syntax.test.lua
>@@ -0,0 +1,15 @@
>+#!/usr/bin/env tarantool

It would be food to note that the test is to be deleted in the scope of #3195.

>
>+test = require("sqltester")
>+test:plan(1)
>+
>+test:execsql("DROP TABLE IF EXISTS t1");
>+test:execsql("CREATE TABLE t1(a INT PRIMARY KEY)");
>+test:execsql("CREATE INDEX i1 on t1(a)");
>+
>+local ok = pcall(test.execsql, test, [[
>+    REINDEX i1 ON t1
>+]])
>+
>+test:ok(not ok, 'reindex syntax must be banned')
>+
>+test:finish_test()
>diff --git a/test/sql-tap/keyword1.test.lua b/test/sql-tap/keyword1.test.lua
>index 23a561f..fbcd173 100755
>--- a/test/sql-tap/keyword1.test.lua
>+++ b/test/sql-tap/keyword1.test.lua
>@@ -1,6 +1,6 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
>-test:plan(176)
>+test:plan(175)
>
> --!./tcltestrunner.lua
> -- 2009 January 29
>@@ -107,7 +107,6 @@ local bannedkws = {
> "primary",
> "recursive",
> "references",
>-"reindex",
> "release",
> "rename",
> "replace",
>diff --git a/test/sql-tap/suite.ini b/test/sql-tap/suite.ini
>index 0bc9e83..eac10a9 100644
>--- a/test/sql-tap/suite.ini
>+++ b/test/sql-tap/suite.ini
>@@ -1,5 +1,6 @@
> [default]
> core = app
>-description = Database tests with #! using TAP
>+description = Some test are banned until REINDEX syntax will not be allowed. Database tests with #! using TAP 

This information should not be part of the description.

>
>+disabled = reindex.test.lua gh2130-index-refer-table.test.lua misc3.test.lua 

State explicitly the reason why each test was disabled or, better, when exactly
it should be enabled. It may look like so:

disabled = \
    reindex.test.lua ; to be enabled in #3195 \
    gh2130-index-refer-table.test.lua ; to be enabled in #3195 \
    misc3.test.lua ; to be enabled in #3195

>
> lua_libs = lua/sqltester.lua ../sql/lua/sql_tokenizer.lua ../box/lua/identifier.lua
> is_parallel = True
>-- 
>2.7.4
>




       reply	other threads:[~2018-03-15 13:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1521051043-28203-1-git-send-email-vanyail@yandex.ru>
2018-03-15 13:34 ` Alexander Turenko [this message]
2018-03-15 13:56   ` [tarantool-patches] Re[2]: " Alexander Turenko
2018-03-19 19:22   ` [tarantool-patches] [PATCH] sql: ban " Ivan Ilyin
2018-03-21 11:06   ` Ivan Ilyin
2018-03-21 13:02     ` [tarantool-patches] " Alexander Turenko
2018-03-21 15:37       ` n.pettik
2018-03-21 16:08         ` Alexander Turenko
2018-03-21 16:42           ` Kirill Yukhin
2018-03-21 20:10             ` Alexander Turenko

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=1521120892.753756821@f173.i.mail.ru \
    --to=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vanyail@yandex.ru \
    --subject='[tarantool-patches] Re: [patches] [PATCH] Ban of REINDEX syntax.' \
    /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