[tarantool-patches] Re: [PATCH 09/10] sql: disable ON CONFLICT actions for indexes

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Aug 27 20:24:35 MSK 2018



On 26/08/2018 16:44, n.pettik wrote:
> 
>>> diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
>>> index 33d243414..9da971415 100644
>>> --- a/src/box/sql/insert.c
>>> +++ b/src/box/sql/insert.c
>>> @@ -354,11 +351,14 @@ sqlite3Insert(Parse * pParse,	/* Parser context */
>>> 	}
>>> #endif				/* SQLITE_OMIT_XFER_OPT */
>>> -	/* Allocate registers for holding the tupleid of the new row,
>>> -	 * the content of the new row, and the assembled row record.
>>> +	/*
>>> +	 * Allocate registers for holding the tupleid of the new
>>> +	 * row (if it isn't required first register will contain
>>> +	 * NULL), the content of the new row, and the assembled
>>> +	 * row record.
>>> 	 */
>>> 	regTupleid = regIns = pParse->nMem + 1;
>>> -	pParse->nMem += def->field_count + 1;
>>> +	pParse->nMem += def->field_count + 2;
>>
>> Why +2? My presumption is because nMem was not
>> incremented one line above here 'regTupleid = regIns = pParse->nMem + 1;',
>> am I right? Why did it work before?
> 
> As comments says: field_count for raw data to be encoded into tuple,
> one memory cell for encoded tuple, and the last one for rowid (or tupleid):
> it is used for ephemeral spaces to distinguish entries. If it is not required,
> then mem will contain NULL. Tuple id (regTupleId) comes first, then
> raw tuple and in the end - encoded msgpack.

Thanks for the explanation.

I understand the comment. But I do not understand why nMem is changed
to +1 in comparison with the previous version. Your comment is actually
the same as it was, but nMem is increased.

The comment is this in short: "Allocate registers for holding the
tupleid, content, assembled record.". Both before and after your patch.
But nMem is now +1.




More information about the Tarantool-patches mailing list