~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] Don't try to retrieve term if log is 0

Michael Bonfils
Details
Message ID
<20211015154120.3173457-1-mbonfils@scaleway.com>
DKIM signature
pass
Download raw message
Patch: +2 -2
Also use DEBUG instead of ERROR for information log

Signed-off-by: Michael Bonfils <mbonfils@scaleway.com>
---
 election.c | 2 +-
 snapshot.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/election.c b/election.c
index 663ee99..ef9bff9 100644
--- a/election.c
+++ b/election.c
@@ -79,7 +79,7 @@ static bool libfloat_can_i_grant_vote(libfloat_ctx_t *ctx, libfloat_rpc_request_
        return false;
    }

    if (libfloat_get_last_term(ctx, NULL, &last_term) == false)
    if (ctx->persistent.commit_index > 0 && libfloat_get_last_term(ctx, NULL, &last_term) == false)
    {
        /* We have failed to retrieve last_ferm from log */
        return false;
diff --git a/snapshot.c b/snapshot.c
index 34db6ff..2ca1ab2 100644
--- a/snapshot.c
+++ b/snapshot.c
@@ -189,7 +189,7 @@ void libfloat_snapshot_done(libfloat_ctx_t *ctx, bool success)

    /* Write the current snapshot in persistent storage */
    ctx->write_current_snapshot(ctx, ctx->persistent.commit_index, ctx->persistent.term);
    ERROR(ctx, "Writing snapshot with index=%d and term=%d", ctx->persistent.commit_index, ctx->persistent.term);
    DEBUG(ctx, "Writing snapshot with index=%d and term=%d", ctx->persistent.commit_index, ctx->persistent.term);
    ctx->persistent.snapshot.index = ctx->persistent.commit_index;
    ctx->persistent.snapshot.term = ctx->persistent.term;

-- 
2.25.1
Details
Message ID
<9183a497-28cf-4b0e-b620-bb61eeee8369@ptrk.io>
In-Reply-To
<20211015154120.3173457-1-mbonfils@scaleway.com> (view parent)
DKIM signature
pass
Download raw message
LG

Oct 15, 2021 17:41:38 Michael Bonfils <mbonfils@scaleway.com>:

> Also use DEBUG instead of ERROR for information log
>
> Signed-off-by: Michael Bonfils <mbonfils@scaleway.com>
> ---
> election.c | 2 +-
> snapshot.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/election.c b/election.c
> index 663ee99..ef9bff9 100644
> --- a/election.c
> +++ b/election.c
> @@ -79,7 +79,7 @@ static bool libfloat_can_i_grant_vote(libfloat_ctx_t *ctx, libfloat_rpc_request_
>          return false;
>      }
>
> -    if (libfloat_get_last_term(ctx, NULL, &last_term) == false)
> +    if (ctx->persistent.commit_index > 0 && libfloat_get_last_term(ctx, NULL, &last_term) == false)
>      {
>          /* We have failed to retrieve last_ferm from log */
>          return false;
> diff --git a/snapshot.c b/snapshot.c
> index 34db6ff..2ca1ab2 100644
> --- a/snapshot.c
> +++ b/snapshot.c
> @@ -189,7 +189,7 @@ void libfloat_snapshot_done(libfloat_ctx_t *ctx, bool success)
>
>      /* Write the current snapshot in persistent storage */
>      ctx->write_current_snapshot(ctx, ctx->persistent.commit_index, ctx->persistent.term);
> -    ERROR(ctx, "Writing snapshot with index=%d and term=%d", ctx->persistent.commit_index, ctx->persistent.term);
> +    DEBUG(ctx, "Writing snapshot with index=%d and term=%d", ctx->persistent.commit_index, ctx->persistent.term);
>      ctx->persistent.snapshot.index = ctx->persistent.commit_index;
>      ctx->persistent.snapshot.term = ctx->persistent.term;
>
> --
> 2.25.1
Details
Message ID
<20211018113758.kn7555pvnboo6v5z@darlene>
In-Reply-To
<20211015154120.3173457-1-mbonfils@scaleway.com> (view parent)
DKIM signature
missing
Download raw message
LG

-- 
Louis Solofrizzo
Team Storage

> It's interesting to think that many quite distinguished people have
> bodies similar to yours.
Reply to thread Export thread (mbox)