~ne02ptzero/libfloat

Investiguate replication stuck v1 SUPERSEDED

Michael Bonfils: 1
 Investiguate replication stuck

 3 files changed, 33 insertions(+), 2 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/28497/mbox | git am -3
Learn more about email & git

[PATCH] Investiguate replication stuck Export this patch

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      |  7 +++++--
 3 files changed, 33 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..f5989ac 100644
--- a/log.c
+++ b/log.c
@@ -663,8 +663,11 @@ void libfloat_append_entries_response(libfloat_ctx_t *ctx, libfloat_rpc_append_e
                node->replicated_log = 0;
                node->next_log_to_send = 1;
            }

            return;
            else
            {
                ERROR(ctx, "libfloat_append_entries_response: recevied current_index (%u) older than replicated_log (%u)",
                    resp->current_index, node->replicated_log);
            }
        }

        node->next_log_to_send = max(resp->current_index, 1);
-- 
2.25.1