From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0034C46970E for ; Fri, 27 Dec 2019 21:42:23 +0300 (MSK) References: <42999683415fb48efba3821b59ef7e62ad00cf16.1577277455.git.sergepetrenko@tarantool.org> From: Vladislav Shpilevoy Message-ID: <71750f3d-6093-a70a-0c02-34759576eb84@tarantool.org> Date: Fri, 27 Dec 2019 21:42:23 +0300 MIME-Version: 1.0 In-Reply-To: <42999683415fb48efba3821b59ef7e62ad00cf16.1577277455.git.sergepetrenko@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v2 4/5] vclock: ignore 0th component in comparisons. List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: sergepetrenko , georgy@tarantool.org Cc: tarantool-patches@dev.tarantool.org I've just noticed that we have '.' in the end of the commit title. I dropped it force pushed this commit, as an obvious fix. Also see some other changes below. They are pushed on top of this commit. Squash if you agree. Or change it, if I miss something. ================================================================================ commit 77455d8aeb1f5f26920bbc6d213b9d32edcfd6bb Author: Vladislav Shpilevoy Date: Fri Dec 27 19:08:54 2019 +0300 Review fix 4/5 diff --git a/src/box/vclock.h b/src/box/vclock.h index e1625410e..eb0fb5d8b 100644 --- a/src/box/vclock.h +++ b/src/box/vclock.h @@ -266,7 +266,10 @@ enum { VCLOCK_ORDER_UNDEFINED = INT_MAX }; * \brief Compare vclocks * \param a vclock * \param b vclock - * \param ignore_zero Whether to order by 0-th component or not + * \param ignore_zero Whether to order by 0-th component or not. + * The 0 component is ignored on anonymous replicas when + * they apply rows from remote master. Because anon + * replicas use the component for local purposes. * * \retval 1 if \a vclock is ordered after \a other * \retval -1 if \a vclock is ordered before than \a other @@ -275,7 +278,7 @@ enum { VCLOCK_ORDER_UNDEFINED = INT_MAX }; */ static inline int vclock_compare_generic(const struct vclock *a, const struct vclock *b, - bool ignore_zero) + bool ignore_zero) { bool le = true, ge = true; unsigned int map = a->map | b->map; @@ -283,11 +286,6 @@ vclock_compare_generic(const struct vclock *a, const struct vclock *b, bit_iterator_init(&it, &map, sizeof(map), true); size_t replica_id = bit_iterator_next(&it); - /* - * Ignore 0-th component in comparisons. - * It is empty for normal replicas and should - * be ignored for anonymous ones. - */ if (replica_id == 0 && ignore_zero) replica_id = bit_iterator_next(&it);