~ne02ptzero/libfloat

log: Add metric on orphaned logs v1 APPLIED

Louis Solofrizzo: 1
 log: Add metric on orphaned logs

 2 files changed, 7 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~ne02ptzero/libfloat/patches/27934/mbox | git am -3
Learn more about email & git

[PATCH] log: Add metric on orphaned logs Export this patch

Add an exposed counter for logs that are committed on the leader but not
anywhere else on a cluster, in order to alert on a possible
network-split.

Signed-off-by: Louis Solofrizzo <lsolofrizzo@scaleway.com>
---
 libfloat.h | 1 +
 periodic.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/libfloat.h b/libfloat.h
index b4aaf1a..9428cbb 100644
--- a/libfloat.h
+++ b/libfloat.h
@@ -45,6 +45,7 @@ struct libfloat_ctx_s {

    struct {
        uint64_t        leader_election;                /*!< Count of leader elections for this cluster */
        uint64_t        orphans_logs;                   /*!< Count of logs that are applied on the leader only */
    } stat;

    struct {
diff --git a/periodic.c b/periodic.c
index c9796fb..6e9b0ec 100644
--- a/periodic.c
+++ b/periodic.c
@@ -64,6 +64,12 @@ void libfloat_periodic(libfloat_ctx_t *ctx, uint32_t time)
                        ctx->leader == ctx->me
                    );

                    if (libfloat_list_count(&entry->node_acks) == 1)
                    {
                        ERROR(ctx, "Log %d timeout with only leader commited, possible loss of synchronization", entry->id);
                        ctx->stat.orphans_logs++;
                    }

                    entry->commit(entry->udata, LIBFLOAT_ENTRY_TIMEOUT);
                    entry->commit = NULL;
                    libfloat_list_del(&entry->next);
-- 
2.34.1
LG

--
Michael Bonfils
htps://www.murlock.org/

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Monday, January 3rd, 2022 at 3:16 PM, Louis Solofrizzo <lsolofrizzo@scaleway.com> wrote:
LG