From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 5/6] sql: don't add string of 'CREATE INDEX ...' to index opts
Date: Tue, 11 Dec 2018 21:29:31 +0300 [thread overview]
Message-ID: <11243F86-41D8-4008-906E-65DA7A9E0119@tarantool.org> (raw)
In-Reply-To: <e74f45f1-6929-8615-9844-abaa17032362@tarantool.org>
> On 10 Dec 2018, at 17:18, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> wrote:
>
> Thanks for the patch! See 2 comments and review fixes below.
>
> On 10/12/2018 00:30, Nikita Pettik wrote:
>> Part of #2647
>> ---
>> src/box/sql.c | 22 +++-------------------
>> src/box/sql/build.c | 35 +++--------------------------------
>> 2 files changed, 6 insertions(+), 51 deletions(-)
>> diff --git a/src/box/sql.c b/src/box/sql.c
>> index e79265823..45c539ec7 100644
>> --- a/src/box/sql.c
>> +++ b/src/box/sql.c
>> @@ -1214,7 +1196,9 @@ sql_encode_index_opts(struct region *region, const struct index_opts *opts,
>> bool is_error = false;
>> mpstream_init(&stream, region, region_reserve_cb, region_alloc_cb,
>> set_encode_error, &is_error);
>> - mpstream_encode_index_opts(&stream, opts);
>> + mpstream_encode_map(&stream, 1);
>> + mpstream_encode_str(&stream, "unique");
>> + mpstream_encode_bool(&stream, opts->is_unique);;
>> mpstream_flush(&stream);
>
> 1. We do not need mpstream for this tiny piece of code. I
> refactored it to simple region_alloc.
Ok, I don’t mind.
>> if (is_error) {
>> diag_set(OutOfMemory, stream.pos - stream.buf, "mpstream_flush",
>> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
>> index fd1666c6d..ab2a56420 100644
>> --- a/src/box/sql/build.c
>> +++ b/src/box/sql/build.c
>> @@ -2546,6 +2527,7 @@ sql_create_index(struct Parse *parse, struct Token *token,
>> sqlite3VdbeAddOp1(vdbe, OP_Close, cursor);
>> vdbe_emit_create_index(parse, def, index->def,
>> def->id, index_id);
>> + sqlite3VdbeChangeP5(vdbe, OPFLAG_NCHANGE);
>
> 2. Are you sure that you should increment change counter here?
> As I know, it should be incremented once on a DDL, but this
> increment is under 'if (tbl_name != NULL)' which means that it
> is not a separate index, but part of CREATE TABLE, it is not?
> CREATE TABLE increments change counter on insertion into _space
> only.
tbl_name != NULL means that currently we are processing
CREATE INDEX statement, not CREATE TABLE. So, its ok.
>
>> sqlite3VdbeAddOp0(vdbe, OP_Expire);
>> }
>>
>
> My review fixes here and on the branch:
Applied.
next prev parent reply other threads:[~2018-12-11 18:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-09 21:30 [tarantool-patches] [PATCH 0/6] Remove string of SQL statement from opts Nikita Pettik
2018-12-09 21:30 ` [tarantool-patches] [PATCH 1/6] sql: avoid calling sql_encode_table_opts() during trigger creation Nikita Pettik
2018-12-10 14:17 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-11 18:29 ` n.pettik
2018-12-09 21:30 ` [tarantool-patches] [PATCH 2/6] sql: don't update SQL string during renaming Nikita Pettik
2018-12-10 14:16 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-11 18:29 ` n.pettik
2018-12-12 12:36 ` Vladislav Shpilevoy
2018-12-13 12:42 ` n.pettik
2018-12-09 21:30 ` [tarantool-patches] [PATCH 3/6] test: fix sqltester methods to drop all tables/views Nikita Pettik
2018-12-10 14:16 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-11 18:29 ` n.pettik
2018-12-09 21:30 ` [tarantool-patches] [PATCH 4/6] sql: don't add string of 'CREATE TABLE...' to space opts Nikita Pettik
2018-12-10 14:17 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-11 18:29 ` n.pettik
2018-12-09 21:30 ` [tarantool-patches] [PATCH 5/6] sql: don't add string of 'CREATE INDEX ...' to index opts Nikita Pettik
2018-12-10 14:18 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-11 18:29 ` n.pettik [this message]
2018-12-09 21:30 ` [tarantool-patches] [PATCH 6/6] Remove SQL string from " Nikita Pettik
2018-12-25 13:45 ` [tarantool-patches] Re: [PATCH 0/6] Remove string of SQL statement from opts Kirill Yukhin
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=11243F86-41D8-4008-906E-65DA7A9E0119@tarantool.org \
--to=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='[tarantool-patches] Re: [PATCH 5/6] sql: don'\''t add string of '\''CREATE INDEX ...'\'' to index opts' \
/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