[tarantool-patches] Re: [PATCH v2 4/4] sql: remove OP_LoadPtr

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Jul 10 23:23:51 MSK 2018



On 10/07/2018 21:34, n.pettik wrote:
> 
>> @@ -2969,12 +2964,9 @@ sql_create_index(struct Parse *parse, struct Token *token,
>> 			goto exit_create_index;
>>
>> 		sql_set_multi_write(parse, true);
>> -
>> -
>> -		sqlite3VdbeAddOp2(v, OP_SIDtoPtr, BOX_INDEX_ID,
>> -				  index_space_ptr_reg);
>> -		sqlite3VdbeAddOp4Int(v, OP_OpenWrite, iCursor, 0,
>> -				     index_space_ptr_reg, 6);
>> +		sqlite3VdbeAddOp4(v, OP_OpenWrite, iCursor, 0, 0,
>> +				  (void *)space_by_id(BOX_INDEX_ID),
>> +				  P4_SPACEPTR);
>> 		sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ);
> 
> Wait, AFAIK SIDtoPtr was used deliberately taking into consideration
> the fact that DDL may change ptr to space. So conversion id -> space ptr
> is delayed until vdbe execution (right before cursor opening). Am I wrong?

Yes, you are wrong here, because it was used to restore pointer to
struct space "_index", but "_index" is a system space, and it is never
altered. So pointer to "_index" is always valid, and it makes no sense
to restore it on runtime.

> 




More information about the Tarantool-patches mailing list