From: Serge Petrenko <sergepetrenko@tarantool.org> To: Konstantin Osipov <kostja.osipov@gmail.com> Cc: tarantool-patches@dev.tarantool.org, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] vclock: refactor vclock map to use type uint32_t Date: Thu, 19 Mar 2020 17:36:08 +0300 [thread overview] Message-ID: <9F39AC96-CB98-4678-8324-9369F327D4FB@tarantool.org> (raw) In-Reply-To: <20200316203126.GA14539@atlas> Hi! Thanks for the review. > 16 марта 2020 г., в 23:31, Konstantin Osipov <kostja.osipov@gmail.com> написал(а): > > * Serge Petrenko <sergepetrenko@tarantool.org> [20/03/05 14:36]: >> We're using an unsigned int to hold vclock map, but there is no >> guarantee that unsigned int will be 4 bytes in size to fit all the 32 >> vclock components. So use uint32_t instead. > > I think there is a bunch of functions that still use unsigned to > pass the vclock value around. I’ve searched once again and couldn’t find any other references to vclock map except the ones that were already fixed in the patch. > > Besides, if you work on a fix like that, it's best to use a > typedef right away, so that it's easy to change to uint64t or 128 > bit integer in the future. Fixed. I didn’t touch bit_count_u32 though, it feels like a bit of an overkill to create something like bit_count_vclock_map_t or something. diff --git a/src/box/vclock.h b/src/box/vclock.h index a8549d2a9..79e5a1bc0 100644 --- a/src/box/vclock.h +++ b/src/box/vclock.h @@ -45,6 +45,8 @@ extern "C" { #endif /* defined(__cplusplus) */ +typedef uint32_t vclock_map_t; + enum { /** * The maximum number of components in vclock, should be power of two. @@ -82,7 +84,7 @@ enum { /** Cluster vector clock */ struct vclock { /** Map of used components in lsn array */ - uint32_t map; + vclock_map_t map; /** Sum of all components of vclock. */ int64_t signature; int64_t lsn[VCLOCK_MAX]; @@ -281,7 +283,7 @@ vclock_compare_generic(const struct vclock *a, const struct vclock *b, bool ignore_zero) { bool le = true, ge = true; - uint32_t map = a->map | b->map; + vclock_map_t map = a->map | b->map; struct bit_iterator it; bit_iterator_init(&it, &map, sizeof(map), true); >> No issue, discussed in scope of >> https://github.com/tarantool/tarantool/issues/4739 >> Branch: https://github.com/tarantool/tarantool/tree/sp/vclock-map-refactor > > -- > Konstantin Osipov, Moscow, Russia -- Serge Petrenko sergepetrenko@tarantool.org
next prev parent reply other threads:[~2020-03-19 14:36 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-05 11:36 Serge Petrenko 2020-03-05 20:46 ` Vladislav Shpilevoy 2020-03-06 8:58 ` Serge Petrenko 2020-03-08 22:16 ` Vladislav Shpilevoy 2020-03-10 11:23 ` Serge Petrenko 2020-03-16 20:31 ` Konstantin Osipov 2020-03-19 14:36 ` Serge Petrenko [this message] 2020-03-19 14:47 ` Konstantin Osipov 2020-03-20 11:15 ` 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=9F39AC96-CB98-4678-8324-9369F327D4FB@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=kostja.osipov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH] vclock: refactor vclock map to use type uint32_t' \ /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