From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [tarantool-patches] Re: [PATCH v2 2/2] Fixed lost format on update and upsert operations. References: <1f4e0a5e-30f2-f36a-3970-ec4eeb14a456@tarantool.org> <4a4c5106-1d2d-553f-c8f1-5c031e91c9ac@tarantool.org> <8a909d97-3f64-207d-fe25-a4462f814d38@tarantool.org> <0f5103aa-cbd6-8ccb-326d-51875e0f561d@tarantool.org> <42c7e5e1-2803-f3f7-6c7e-11c778399fd9@tarantool.org> <20180418122842.pkpq3mktqwjobppm@esperanza> <18a8749f-ba4e-61a8-a58d-12257f2d0f32@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Sun, 22 Apr 2018 18:15:38 +0300 MIME-Version: 1.0 In-Reply-To: <18a8749f-ba4e-61a8-a58d-12257f2d0f32@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit To: tarantool-patches@freelists.org, Kirill Shcherbatov Cc: Vladimir Davydov List-ID: 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.