From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: box: disable sparse optimization in box.tuple.new()
Date: Wed, 13 Feb 2019 15:19:26 +0300 [thread overview]
Message-ID: <20190213121926.GA27871@chai> (raw)
In-Reply-To: <57b38a8d-14f4-a272-7fdb-4f6cf08cf925@tarantool.org>
* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/02/12 20:54]:
Please use a separate serializer configuration. Both solutions are
bad, but at least I see no forward compatibility
issues with a separate configuration. If we break any existing
code by changing the behavior, we'll expose the config as a
separate one for box.tuple.new() or frommap().
> Hi! Thanks for the patch!
>
> On 12/02/2019 14:18, Kirill Shcherbatov wrote:
> > The box.tuple.new() used to call luamp_encode_tuple with
> > default LUA serializer config 'luaL_msgpack_default'. This
> > routine may consider an array to be excessively sparse when
> > + encode_sparse_ratio > 0
> > + max(table) > encode_sparse_safe
> > + max(table) > count(table) * encode_sparse_ratio.
> > Sparse optimization save memory via representing excessively
> > sparse tuple as MP_MAP. But Tarantool tuple always must be
> > MP_ARRAY so it is not relevant for box.tuple.new semantics.
> > So it is disabled with encode_sparse_ratio = 0 in a new local
> > serializer config.
> >
> > Closes #3882
> > ---
>
> Please, next time put here links to the branch and issue.
>
> The patch is ok for me. But I see, that Kostja complaints, that
> you could create a special serializer for it. I agree, but I see
> a drawback about it. Separate serializer would be unconfigurable.
> Now a user can change serializer by making require('msgpack').cfg(...).
> So the issue can be fixed manually like this even on 2.1:
>
> [002] Test failed! Result content mismatch:
> [002] --- box/tuple.result Tue Feb 12 18:26:58 2019
> [002] +++ box/tuple.reject Tue Feb 12 18:42:10 2019
> [002] @@ -1168,6 +1168,12 @@
> [002] -- gh-3882: Inappropriate storage optimization for sparse arrays
> [002] -- in box.tuple.new.
> [002] --
> [002] +m = require('msgpack')
> [002] +---
> [002] +...
> [002] +m.cfg{encode_sparse_ratio = 0}
> [002] +---
> [002] +...
>
> I added these two lines without a patch, and the test passed.
>
> With Kostja's way of implementation, tuple encoding would be
> impossible to configure.
>
> If Kostja thinks, that your way does not work, then do whatever
> he wants, please. Ask him for clarification.
>
> > src/box/lua/tuple.c | 9 ++++++++
> > test/box/tuple.result | 50 +++++++++++++++++++++++++++++++++++++++++
> > test/box/tuple.test.lua | 26 +++++++++++++++++++++
> > 3 files changed, 85 insertions(+)
> >
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov
next prev parent reply other threads:[~2019-02-13 12:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 10:43 [tarantool-patches] [PATCH v1 1/1] " Kirill Shcherbatov
2019-02-12 11:18 ` [tarantool-patches] " Kirill Shcherbatov
2019-02-12 11:33 ` [tarantool-patches] " Konstantin Osipov
2019-02-12 17:50 ` Vladislav Shpilevoy
2019-02-13 12:19 ` Konstantin Osipov [this message]
2019-02-15 15:17 ` Kirill Shcherbatov
2019-02-15 21:31 ` Vladislav Shpilevoy
2019-02-18 8:45 ` [tarantool-patches] Re: [PATCH v1 1/1] " Kirill Yukhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190213121926.GA27871@chai \
--to=kostja@tarantool.org \
--cc=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: box: disable sparse optimization in box.tuple.new()' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox