~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] Investiguate replication stuck

Michael Bonfils <mbonfils@scaleway.com>
Details
Message ID
<20220120145313.1573536-1-mbonfils@scaleway.com>
DKIM signature
missing
Download raw message
Patch: +31 -2
Add functions to retrieve replicated_log and next_log_to_send per node
of a cluster.

Signed-off-by: Michael Bonfils <mbonfils@scaleway.com>
---
 libfloat.c | 10 ++++++++++
 libfloat.h | 18 ++++++++++++++++++
 log.c      |  5 +++--
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/libfloat.c b/libfloat.c
index 63eacde..59c3e8b 100644
--- a/libfloat.c
+++ b/libfloat.c
@@ -105,3 +105,13 @@ bool libfloat_str_to_commit_type(const char *t, libfloat_commit_type_t *out)

    return false;
}

libfloat_entry_id_t libfloat_node_get_next_log(libfloat_node_t *node)
{
    return node->next_log_to_send;
}

libfloat_entry_id_t libfloat_node_get_replicated_log(libfloat_node_t *node)
{
    return node->replicated_log;
}
\ No newline at end of file
diff --git a/libfloat.h b/libfloat.h
index 9428cbb..69f040f 100644
--- a/libfloat.h
+++ b/libfloat.h
@@ -522,4 +522,22 @@ const char *libfloat_commit_type_to_str(libfloat_commit_type_t t);
 */
bool libfloat_str_to_commit_type(const char *t, libfloat_commit_type_t *out);

/*!
 * \brief Get next log to send for a node
 *
 * \param[in] node Node of a libfloat cluster
 *
 * \return commit_id of next log to send
 */
libfloat_entry_id_t libfloat_node_get_next_log(libfloat_node_t *node);

/*!
 * \brief Get current replicated commit id for this node
 *
 * \param[in] node Node of a libfloat cluster
 *
 * \return commit_id of the current replicated log
 */
libfloat_entry_id_t libfloat_node_get_replicated_log(libfloat_node_t *node);

#endif /* LIBFLOAT_H */
diff --git a/log.c b/log.c
index 06c9289..b761c57 100644
--- a/log.c
+++ b/log.c
@@ -662,9 +662,10 @@ void libfloat_append_entries_response(libfloat_ctx_t *ctx, libfloat_rpc_append_e
                /* Node has lost its log, let's reset our state */
                node->replicated_log = 0;
                node->next_log_to_send = 1;
                return;
            }

            return;
            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->next_log_to_send = max(resp->current_index, 1);
-- 
2.25.1
Details
Message ID
<20220120145711.jzifivi7zrngfu2m@darlene>
In-Reply-To
<20220120145313.1573536-1-mbonfils@scaleway.com> (view parent)
DKIM signature
missing
Download raw message
LGTM

-- 
Louis Solofrizzo
Team Storage

> People are going to scream bloody murder about that.
>  -- Seen on linux-kernel
Details
Message ID
<20220120152349.qipuhgkrsgbfzahm@scaleway>
In-Reply-To
<20220120145313.1573536-1-mbonfils@scaleway.com> (view parent)
DKIM signature
missing
Download raw message
LG
Reply to thread Export thread (mbox)