~ne02ptzero/libfloat

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Don't try to retrieve term if log is 0

Michael Bonfils <mbonfils@scaleway.com>
Details
Message ID
<20211116075343.2751248-1-mbonfils@scaleway.com>
DKIM signature
missing
Download raw message
Patch: +4 -1
Following ec48c42c add test when a new election is starting

Signed-off-by: Michael Bonfils <mbonfils@scaleway.com>
---
 election.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/election.c b/election.c
index ef9bff9..d9db208 100644
--- a/election.c
+++ b/election.c
@@ -45,7 +45,10 @@ void libfloat_election_start(libfloat_ctx_t *ctx)
    ctx->election_timeout_rand = ctx->conf.election_timeout + ctx->rand() % ctx->conf.election_timeout;
    ctx->timeout_elapsed = 0;

    libfloat_get_last_term(ctx, &last_id, &last_term);
    if (ctx->persistent.commit_index > 0)
    {
        libfloat_get_last_term(ctx, &last_id, &last_term);
    }

    /* Send a vote request to each node of the cluster */
    for_every_node(ctx, node, {
-- 
2.25.1
Details
Message ID
<2fb1c6cf-d0ce-49e7-b3ca-85496040380e@ptrk.io>
In-Reply-To
<20211116075343.2751248-1-mbonfils@scaleway.com> (view parent)
DKIM signature
missing
Download raw message
LG

Nov 16, 2021 08:54:03 Michael Bonfils <mbonfils@scaleway.com>:

> Following ec48c42c add test when a new election is starting
> 
> Signed-off-by: Michael Bonfils <mbonfils@scaleway.com>
> ---
> election.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/election.c b/election.c
> index ef9bff9..d9db208 100644
> --- a/election.c
> +++ b/election.c
> @@ -45,7 +45,10 @@ void libfloat_election_start(libfloat_ctx_t *ctx)
>      ctx->election_timeout_rand = ctx->conf.election_timeout + ctx->rand() % ctx->conf.election_timeout;
>      ctx->timeout_elapsed = 0;
> 
> -    libfloat_get_last_term(ctx, &last_id, &last_term);
> +    if (ctx->persistent.commit_index > 0)
> +    {
> +        libfloat_get_last_term(ctx, &last_id, &last_term);
> +    }
> 
>      /* Send a vote request to each node of the cluster */
>      for_every_node(ctx, node, {
> -- 
> 2.25.1
Reply to thread Export thread (mbox)