Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] raft: use vclock_map_t for voting tracking
@ 2020-11-06  8:37 Cyrill Gorcunov
  2020-11-06 10:28 ` Serge Petrenko
  2020-11-13 22:42 ` Vladislav Shpilevoy
  0 siblings, 2 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2020-11-06  8:37 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tml

We've VCLOCK_MASK constant which limits the number of
regular nodes in a replication cluster. This limit is
bound to the vclock_map_t bitset type. Thus when we're
tacking voting process in Raft node we better use this
type for vote_mask member (otherwise it is a room for
error if we ever change VCLOCK_MASK and extend the width
of a bitset).

Suggested-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
branch gorcunov/raft-vote-mask

 src/box/raft.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/box/raft.h b/src/box/raft.h
index 8293d7410..0e7fe0e85 100644
--- a/src/box/raft.h
+++ b/src/box/raft.h
@@ -33,6 +33,7 @@
 #include <stdbool.h>
 #include "tarantool_ev.h"
 #include "trigger.h"
+#include "vclock.h"
 
 #if defined(__cplusplus)
 extern "C" {
@@ -146,7 +147,7 @@ struct raft {
 	 * Bit 1 on position N means that a vote from instance with ID = N was
 	 * obtained.
 	 */
-	uint32_t vote_mask;
+	vclock_map_t vote_mask;
 	/** Number of votes for this instance. Valid only in candidate state. */
 	int vote_count;
 	/** State machine timed event trigger. */
-- 
2.26.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH] raft: use vclock_map_t for voting tracking
  2020-11-06  8:37 [Tarantool-patches] [PATCH] raft: use vclock_map_t for voting tracking Cyrill Gorcunov
@ 2020-11-06 10:28 ` Serge Petrenko
  2020-11-13 22:42 ` Vladislav Shpilevoy
  1 sibling, 0 replies; 3+ messages in thread
From: Serge Petrenko @ 2020-11-06 10:28 UTC (permalink / raw)
  To: Cyrill Gorcunov, Vladislav Shpilevoy; +Cc: tml


06.11.2020 11:37, Cyrill Gorcunov пишет:
> We've VCLOCK_MASK constant which limits the number of
> regular nodes in a replication cluster. This limit is
> bound to the vclock_map_t bitset type. Thus when we're
> tacking voting process in Raft node we better use this
> type for vote_mask member (otherwise it is a room for
> error if we ever change VCLOCK_MASK and extend the width
> of a bitset).
>
> Suggested-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>


Hi! Thanks for the patch! LGTM.

> ---
> branch gorcunov/raft-vote-mask
>
>   src/box/raft.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/box/raft.h b/src/box/raft.h
> index 8293d7410..0e7fe0e85 100644
> --- a/src/box/raft.h
> +++ b/src/box/raft.h
> @@ -33,6 +33,7 @@
>   #include <stdbool.h>
>   #include "tarantool_ev.h"
>   #include "trigger.h"
> +#include "vclock.h"
>   
>   #if defined(__cplusplus)
>   extern "C" {
> @@ -146,7 +147,7 @@ struct raft {
>   	 * Bit 1 on position N means that a vote from instance with ID = N was
>   	 * obtained.
>   	 */
> -	uint32_t vote_mask;
> +	vclock_map_t vote_mask;
>   	/** Number of votes for this instance. Valid only in candidate state. */
>   	int vote_count;
>   	/** State machine timed event trigger. */

-- 
Serge Petrenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH] raft: use vclock_map_t for voting tracking
  2020-11-06  8:37 [Tarantool-patches] [PATCH] raft: use vclock_map_t for voting tracking Cyrill Gorcunov
  2020-11-06 10:28 ` Serge Petrenko
@ 2020-11-13 22:42 ` Vladislav Shpilevoy
  1 sibling, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy @ 2020-11-13 22:42 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tml

Hi! Thanks for the patch!

Applied the diff below and pushed to master and 2.6.

====================
--- a/src/box/raft.h
+++ b/src/box/raft.h
@@ -34,7 +34,7 @@
 #include <assert.h>
 #include "tarantool_ev.h"
 #include "trigger.h"
-#include "vclock.h"
+#include "vclock/vclock.h"
 
 #if defined(__cplusplus)
 extern "C" {
@@ -70,7 +70,6 @@ extern "C" {
 
 struct fiber;
 struct raft_request;
-struct vclock;
 
 enum raft_state {
 	/**

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-13 22:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  8:37 [Tarantool-patches] [PATCH] raft: use vclock_map_t for voting tracking Cyrill Gorcunov
2020-11-06 10:28 ` Serge Petrenko
2020-11-13 22:42 ` Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox