Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/2] sql: refactor index drop code
Date: Sat, 1 Feb 2020 20:40:16 +0300	[thread overview]
Message-ID: <A195AAB9-5A53-490D-8167-52E520B683A3@tarantool.org> (raw)
In-Reply-To: <20200128174449.GB1049@tarantool.org>



> On Jan 28, 2020, at 20:44, Nikita Pettik <korablev@tarantool.org> wrote:
> 
> On 24 Jan 17:21, Roman Khabibov wrote:
>> Wrap index drop opcode emitting into single function.
>> 
>> Part of #4120
>> ---
>> src/box/sql/build.c | 52 ++++++++++++++++++++++++---------------------
>> 1 file changed, 28 insertions(+), 24 deletions(-)
>> 
>> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
>> index bc50ecbfa..58a6a8a6b 100644
>> --- a/src/box/sql/build.c
>> +++ b/src/box/sql/build.c
>> @@ -1469,6 +1469,26 @@ vdbe_emit_stat_space_clear(struct Parse *parse, const char *stat_table_name,
>> 	sql_table_delete_from(parse, src_list, where);
>> }
>> 
>> +/**
>> + * Generate VDBE program to remove entry with @a index_id and @a
>> + * space_id from _index space.
> 
> Is @a common shortcat for @param? If so, please share a link to docs,
> since I've managed to find only this:
> '''
> \a <word>
> Displays the argument in italics. Use this command to emphasize words.
> Use this command to refer to member arguments in the running text.
> '''
> 
>> + * Note: index_id_reg have to be allocated immediately after
>> + * space_id_reg.
>> + */
> 
> Nit: have -> has.
> 
> Please, add an assertion verifing that.
> 
>> +static void
>> +vdbe_emit_index_drop(struct Parse *parse_context, uint32_t index_id,
>> +		     uint32_t index_id_reg, uint32_t space_id_reg)
> 
> I'd also consider moving storing of index_id to register out of
> this function. Then you'll need only space_id_reg to process
> deletion.
I decided to drop this patch, because the function will be too small
and it will not reduce the code. So, IMO, it is pointless then.

>> +{
>> +	struct Vdbe *v = sqlGetVdbe(parse_context);
>> +	assert(v != NULL);
>> +	int record_reg = ++parse_context->nMem;
>> +	sqlVdbeAddOp2(v, OP_Integer, index_id, index_id_reg);
>> +	sqlVdbeAddOp3(v, OP_MakeRecord, space_id_reg, 2, record_reg);
>> +	sqlVdbeAddOp2(v, OP_SDelete, BOX_INDEX_ID, record_reg);
>> +	VdbeComment((v, "Remove index iid =  %u", index_id));
>> +}
>> +
>> /**
>>  * Generate VDBE program to remove entry from _fk_constraint space.
>>  *

      parent reply	other threads:[~2020-02-01 17:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 14:21 [Tarantool-patches] [PATCH 0/2] Support <ALTER TABLE DROP CONSTRAINT> Roman Khabibov
2020-01-24 14:21 ` [Tarantool-patches] [PATCH 1/2] sql: refactor index drop code Roman Khabibov
2020-01-28 17:44   ` Nikita Pettik
2020-01-29 21:56     ` Vladislav Shpilevoy
2020-01-29 22:32       ` Nikita Pettik
2020-01-29 23:45         ` Vladislav Shpilevoy
2020-01-30 11:12           ` Nikita Pettik
2020-01-30 21:05             ` Vladislav Shpilevoy
2020-02-01 17:40     ` Roman Khabibov [this message]

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=A195AAB9-5A53-490D-8167-52E520B683A3@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] sql: refactor index drop code' \
    /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