From: Oleg Babin <olegrok@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH vshard 1/1] router: bucket_id_strcrc32 and bucket_id_mpcrc32
Date: Thu, 27 Feb 2020 13:12:50 +0300 [thread overview]
Message-ID: <c7a9e197-9c87-4916-890f-54ddd1e61fe1@tarantool.org> (raw)
In-Reply-To: <14136e7a-c642-8c59-4371-b30e1604446f@tarantool.org>
On 27/02/2020 03:22, Vladislav Shpilevoy wrote:
> Yep, I knew that. Precision loss is why I discarded my first draft
> patch, using tonumber() for all cdata numbers. The point is that
> if you insert ffi.cast(double), then you should pass ffi.cast(double)
> to bucket_id function as well. You calculate hash from what is
> inserted. Not from what is returned. From how I imagine this.
My main consern that user can modify returned value and then put it
again. But ok, I see that we can't cover all possible cases - I hope
this issue or some note in documentation makes developers to think about
such problem.
>
> This also makes MessagePack encoding useless, because if we
> have only Lua numbers and strings, then crc32(tostring()) will
> work fine too.
>
> I can add a third function bucket_id_nstrcrc32. Stands for
> Number String Crc32 - n str crc32. This will call tonumber()
> for all cdata numbers before calling crc32(tostring(...)) on
> them.
>
> Sounds good?
>
Let's stay as is and should not overcomplcate API.
--
Oleg Babin
next prev parent reply other threads:[~2020-02-27 10:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 23:52 Vladislav Shpilevoy
2020-02-26 7:15 ` Oleg Babin
2020-02-27 0:22 ` Vladislav Shpilevoy
2020-02-27 10:12 ` Oleg Babin [this message]
2020-02-29 17:09 ` Vladislav Shpilevoy
2020-03-02 8:10 ` Oleg Babin
2020-03-02 21:06 ` Vladislav Shpilevoy
2020-02-26 8:20 ` Konstantin Osipov
2020-02-27 0:25 ` Vladislav Shpilevoy
2020-02-27 6:53 ` Konstantin Osipov
2020-02-29 17:10 ` Vladislav Shpilevoy
2020-03-01 16:52 ` Konstantin Osipov
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=c7a9e197-9c87-4916-890f-54ddd1e61fe1@tarantool.org \
--to=olegrok@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH vshard 1/1] router: bucket_id_strcrc32 and bucket_id_mpcrc32' \
/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