From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 8 Oct 2018 13:16:19 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] Re: [PATCH] box: add tuple:size function Message-ID: <20181008101619.rmhte5evn3flfxiy@esperanza> References: <1538070923-23087-1-git-send-email-ivushkinalex@gmail.com> <20181005102321.eyhdkng2ymu5q6jc@esperanza> <8704964c-ac90-583f-c9ab-fc4dde847184@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8704964c-ac90-583f-c9ab-fc4dde847184@tarantool.org> To: Vladislav Shpilevoy , Konstantin Osipov Cc: tarantool-patches@freelists.org, AlexeyIvushkin List-ID: On Sat, Oct 06, 2018 at 04:58:46PM +0300, Vladislav Shpilevoy wrote: > > > On 05/10/2018 13:23, Vladimir Davydov wrote: > > On Thu, Sep 27, 2018 at 08:55:23PM +0300, AlexeyIvushkin wrote: > > > diff --git a/src/box/lua/tuple.lua b/src/box/lua/tuple.lua > > > index 63ea73e..801ee3c 100644 > > > --- a/src/box/lua/tuple.lua > > > +++ b/src/box/lua/tuple.lua > > > @@ -286,6 +286,7 @@ local methods = { > > > ["update"] = tuple_update; > > > ["upsert"] = tuple_upsert; > > > ["bsize"] = tuple_bsize; > > > + ["size"] = internal.tuple.size; > > > ["tomap"] = internal.tuple.tuple_to_map; > > > > Why did you decide to introduce a new function rather than fixing > > tuple.bsize, as it was explicitly requested in the ticket? > > It breaks compatibility. Now bsize returns only Message Pack part > of tuple despite what the documentation says. Frankly, I don't think that introducing a new method just to keep the old behavior of bsize intact is a good idea, because we probably won't stop at that. The next thing we have to add will probably be space.size, which would be defined as a sum of tuple.size of constituent tuples and that wouldn't be as trivial to implement as tuple.size... Anyway, IMO having two methods for getting the size of binary data stored in a tuple is confusing (which one should I use as a user?). Up to Kostja.