[Tarantool-patches] [PATCH v5 14/52] sql: introduce mem_copy_as_ephemeral()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Apr 11 21:10:19 MSK 2021


Thanks for working on this!

>>> @@ -593,9 +598,12 @@ sqlVdbeMemAboutToChange(Vdbe * pVdbe, Mem * pMem)
>>>  	int i;
>>>  	Mem *pX;
>>>  	for (i = 0, pX = pVdbe->aMem; i < pVdbe->nMem; i++, pX++) {
>>> -		if (pX->pScopyFrom == pMem) {
>>> -			pX->flags |= MEM_Undefined;
>>> -			pX->pScopyFrom = 0;
>>> +		if ((pX->flags & (MEM_Blob | MEM_Str)) != 0 &&
>>> +		    (pX->flags & (MEM_Ephem | MEM_Static)) == 0) {
>>> +			if (pX->pScopyFrom == pMem) {
>>> +				pX->flags |= MEM_Undefined;
>>> +				pX->pScopyFrom = 0;
>>> +			}
>>
>> 2. Why did you change that?
>>
> This check is only useful for strings and binaries, since they may be lost due
> to change of another MEM. Also, due to this function it was possible that value
> of type other than MEM_Blob or MEM_Str will have MEM_Ephem set. This is wrong, I
> believe.

Due to which function? sqlVdbeMemAboutToChange() does not set MEM_Ephem.


More information about the Tarantool-patches mailing list