~ne02ptzero/libfloat

65f9f585fc3ce8df8f62d40c83c48bd85c8b6217 — Louis Solofrizzo 3 months ago 77f3b3c
log: Only ERROR log on smaller commit_id when it is problematic

Otherwise, DEBUG it. Should generate less logs on production / tests.
Also removes the minimum 20 entries used to compute optimistic
replication.

Patch: https://lists.sr.ht/~ne02ptzero/libfloat/patches/47901

Signed-off-by: Louis Solofrizzo <lsolofrizzo@scaleway.com>
Acked-by: Patrik Cyvoct <pcyvoct@scaleway.com>
1 files changed, 5 insertions(+), 2 deletions(-)

M log.c
M log.c => log.c +5 -2
@@ 368,7 368,7 @@ end:
        );

        /* Let's be optimistic about replication, assume the node is gonna replicate and not spam it */
        if (ctx->conf.optimistic_replication && req.n_entries > 20)
        if (ctx->conf.optimistic_replication)
            node->next_log_to_send = last_log + 1;
    }



@@ 678,6 678,9 @@ void libfloat_append_entries_response(libfloat_ctx_t *ctx, libfloat_rpc_append_e
                {
                    /* We have 20 consecutive hertbeats telling the same story, let's believe it */

                    ERROR(ctx, "libfloat_append_entries_response: node %d: received current_index (%u) older than replicated_log (%u)",
                        node->id, resp->current_index, node->replicated_log);

                    node->announced_log_count = 0;
                    node->next_log_to_send = max(resp->current_index + 1, 1);
                    node->replicated_log = resp->current_index;


@@ 691,7 694,7 @@ void libfloat_append_entries_response(libfloat_ctx_t *ctx, libfloat_rpc_append_e
                node->announced_log = resp->current_index;
            }

            ERROR(ctx, "libfloat_append_entries_response: node %d: received current_index (%u) older than replicated_log (%u) (count=%lu)",
            DEBUG(ctx, "libfloat_append_entries_response: node %d: received current_index (%u) older than replicated_log (%u) (count=%lu)",
                node->id, resp->current_index, node->replicated_log, node->announced_log_count);
            return;
        }