~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
2 2

[PATCH] Check qorum is ok in periodic check

Michael Bonfils <mbonfils@scaleway.com>
Details
Message ID
<20211220170546.234302-1-mbonfils@scaleway.com>
DKIM signature
pass
Download raw message
Patch: +10 -6
Stopped followers didn't trigger a step down from leader
if qorum is no more reached.

Signed-off-by: Michael Bonfils <mbonfils@scaleway.com>
---
 periodic.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/periodic.c b/periodic.c
index 94bf728..f3a95e6 100644
--- a/periodic.c
+++ b/periodic.c
@@ -10,25 +10,29 @@ void libfloat_periodic(libfloat_ctx_t *ctx, uint32_t time)
        {
            if (ctx->conf.sanity_timeout != 0 && ctx->n_nodes > 1)
            {
                bool            node_reachable = false;
                int             nodes_reachables = 0;
                libfloat_node_t *node;

                for_every_node(ctx, node, {
                    if (node->last_update + ctx->conf.sanity_timeout > ctx->time(NULL))
                    if (node->id == ctx->me->id)
                    {
                        node_reachable = true;
                        break;
                        nodes_reachables ++;
                    }
                    else if (node->last_update + ctx->conf.sanity_timeout > ctx->time(NULL))
                    {
                        nodes_reachables ++;
                    }
                });

                if (!node_reachable)
                if (nodes_reachables < ctx->n_nodes / 2 + 1)
                {
                    /**
                    * Hmmm, we might be partitionned, or at the very least we don't have a quorum anymore.
                    * Time to step down!
                    */
                    libfloat_become_follower(ctx);
                    ERROR(ctx, "Sanity timeout has been reached (%d seconds), stepping down from leader position", ctx->conf.sanity_timeout);
                    ERROR(ctx, "Sanity timeout has been reached (%d seconds), stepping down from leader position: reachable %d / quorum %lu (%lu)", 
                          ctx->conf.sanity_timeout, nodes_reachables, ctx->n_nodes / 2 + 1, ctx->n_nodes);
                    return;
                }
            }
-- 
2.25.1
Details
Message ID
<20211220174625.zy2gy7zdteaeed7u@darlene>
In-Reply-To
<20211220170546.234302-1-mbonfils@scaleway.com> (view parent)
DKIM signature
missing
Download raw message
On Mon, Dec 20, 2021 at 05:05:46PM +0000, Michael Bonfils wrote:
> +                        nodes_reachables ++;
> +                    }
> +                    else if (node->last_update + ctx->conf.sanity_timeout > ctx->time(NULL))
> +                    {
> +                        nodes_reachables ++;

node_reachables++;

LGTM
-- 
Louis Solofrizzo
Team Storage

> "jackpot: you may have an unnecessary change record"
>  -- message from "diff"
Details
Message ID
<20211221132746.fydkztlrqelngsf2@scaleway>
In-Reply-To
<20211220170546.234302-1-mbonfils@scaleway.com> (view parent)
DKIM signature
pass
Download raw message
LG
Reply to thread Export thread (mbox)