[Tarantool-patches] [PATCH v2 4/5] vclock: ignore 0th component in comparisons.

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Dec 27 21:42:23 MSK 2019


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 <v.shpilevoy at tarantool.org>
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);
 


More information about the Tarantool-patches mailing list