M election.c => election.c +1 -1
@@ 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;
M snapshot.c => snapshot.c +1 -1
@@ 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;