[tarantool-patches] Re: [PATCH v2 2/2] Fixed lost format on update and upsert operations.

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Apr 22 18:15:38 MSK 2018



On 18/04/2018 15:55, Kirill Shcherbatov wrote:
>> Why is tuple.transform so special? Why can't it derive the original
>> tuple format, like tuple.update and tuple.upsert?
> Transform should use runtime format. Vlad insisted on to do not redesign public API to contain format, just only in-line required code.

Please, describe why we need inlined update here. 'Vlad insisted' is not a reason.

> 
>> This doesn't check "transform integrity" AFAICS - the test passes even
>> if we use the original tuple's format instead of runtime_tuple_format.
> It's an integrity check to ensure that transform method hasn't degraded.

Vova means, that if tuple:transform would use non-default tuple format,
the tests will pass anyway. Please, add a test on transform, that would not
pass, if tuple uses non-default format.

> diff --git a/test/engine/update.test.lua b/test/engine/update.test.lua
> index 0252b8a..3ff7e62 100644
> --- a/test/engine/update.test.lua
> +++ b/test/engine/update.test.lua
> @@ -94,3 +94,30 @@ space:select{}
>   space:update({2}, {})
>   space:select{}
>   space:drop()
> +
> +--
> +-- gh-3051 Lost format while tuple update
> +--
> +format = {}
> +format[1] = {name = 'KEY', type = 'unsigned'}
> +format[2] = {name = 'VAL', type = 'string'}
> +s = box.schema.space.create('tst_sample', {engine = engine, format = format})
> +pk = s:create_index('pk')
> +s:insert({1, 'sss', '3', '4', '5', '6', '7'})
> +aa = box.space.tst_sample:get(1)
> +aa.VAL
> +aa = aa:update({{'=',2,'ssss'}})
> +aa.VAL
> +-- invalid update
> +aa:update({{'=',2, 666}})
> +-- test transform integrity
> +aa:transform(-1, 1)

This test will pass even if we would use non-default tuple format.



More information about the Tarantool-patches mailing list