Hello community, here is the log from the commit of package raft for openSUSE:Factory checked in at 2020-09-14 12:26:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/raft (Old) and /work/SRC/openSUSE:Factory/.raft.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "raft" Mon Sep 14 12:26:57 2020 rev:11 rq:833909 version:0.9.25 Changes: -------- --- /work/SRC/openSUSE:Factory/raft/raft.changes 2020-07-27 17:47:19.431389837 +0200 +++ /work/SRC/openSUSE:Factory/.raft.new.4249/raft.changes 2020-09-14 12:29:02.425125897 +0200 @@ -1,0 +2,8 @@ +Sat Sep 12 07:30:01 UTC 2020 - Andreas Stieger <[email protected]> + +- raft 0.9.25: + * Add APIs to configure timeouts when promoting a stand-by + * Improve detection of the version of the ZFS kernel module + * Honor endianness when decoding test FSM commands + +------------------------------------------------------------------- Old: ---- raft-0.9.24.tar.gz New: ---- raft-0.9.25.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ raft.spec ++++++ --- /var/tmp/diff_new_pack.wHWRzi/_old 2020-09-14 12:29:03.281126443 +0200 +++ /var/tmp/diff_new_pack.wHWRzi/_new 2020-09-14 12:29:03.285126445 +0200 @@ -18,7 +18,7 @@ %bcond_without libuv Name: raft -Version: 0.9.24 +Version: 0.9.25 Release: 0 Summary: Fully asynchronous C implementation of the Raft consensus protocol License: LGPL-3.0-only WITH linking-exception-lgpl-3.0 ++++++ raft-0.9.24.tar.gz -> raft-0.9.25.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.24/configure.ac new/raft-0.9.25/configure.ac --- old/raft-0.9.24/configure.ac 2020-07-12 12:08:51.000000000 +0200 +++ new/raft-0.9.25/configure.ac 2020-08-03 15:21:29.000000000 +0200 @@ -50,7 +50,7 @@ # Check if zfs >= 0.8.0 is available (for direct I/O support). AC_CHECK_PROG(have_zfs, zfs, yes) AS_IF([test x"$have_zfs" = x"yes"], - [AX_COMPARE_VERSION($(zfs version 2>/dev/null | cut -f 2 -d - | head -1), [ge], [0.8.0], + [AX_COMPARE_VERSION($(cat /sys/module/zfs/version | cut -f 1 -d -), [ge], [0.8.0], [AC_DEFINE(RAFT_HAVE_ZFS_WITH_DIRECT_IO)], []) ], []) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.24/include/raft.h new/raft-0.9.25/include/raft.h --- old/raft-0.9.24/include/raft.h 2020-07-12 12:08:51.000000000 +0200 +++ new/raft-0.9.25/include/raft.h 2020-08-03 15:21:29.000000000 +0200 @@ -77,7 +77,7 @@ #define RAFT_STANDBY 0 /* Replicate log, does not participate in quorum. */ #define RAFT_VOTER 1 /* Replicate log, does participate in quorum. */ -#define RAFT_SPARE 2 /* Does not replicate log, or participate in quorum. */ +#define RAFT_SPARE 2 /* Does not replicate log, or participate in quorum. */ /** * Hold information about a single server in the cluster configuration. @@ -694,6 +694,11 @@ /* Whether to use pre-vote to avoid disconnected servers disrupting the * current leader, as described in 4.2.3 and 9.6. */ bool pre_vote; + + /* Limit how long to wait for a stand-by to catch-up with the log when its + * being promoted to voter. */ + unsigned max_catch_up_rounds; + unsigned max_catch_up_round_duration; }; RAFT_API int raft_init(struct raft *r, @@ -781,6 +786,20 @@ RAFT_API void raft_set_snapshot_trailing(struct raft *r, unsigned n); /** + * Set the maximum number of a catch-up rounds to try when replicating entries + * to a stand-by server that is being promoted to voter, before giving up and + * failing the configuration change. The default is 10. + */ +RAFT_API void raft_set_max_catch_up_rounds(struct raft *r, unsigned n); + +/** + * Set the maximum duration of a catch-up round when replicating entries to a + * stand-by server that is being promoted to voter. The default is 5 seconds. + */ +RAFT_API void raft_set_max_catch_up_round_duration(struct raft *r, + unsigned msecs); + +/** * Return a human-readable description of the last error occured. */ RAFT_API const char *raft_errmsg(struct raft *r); @@ -897,10 +916,10 @@ * #RAFT_BADROLE is returned. */ RAFT_API int raft_assign(struct raft *r, - struct raft_change *req, - raft_id id, - int role, - raft_change_cb cb); + struct raft_change *req, + raft_id id, + int role, + raft_change_cb cb); /** * Remove the given server from the cluster configuration. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.24/src/raft.c new/raft-0.9.25/src/raft.c --- old/raft-0.9.24/src/raft.c 2020-07-12 12:08:51.000000000 +0200 +++ new/raft-0.9.25/src/raft.c 2020-08-03 15:21:29.000000000 +0200 @@ -18,6 +18,11 @@ #define DEFAULT_SNAPSHOT_THRESHOLD 1024 #define DEFAULT_SNAPSHOT_TRAILING 2048 +/* Number of milliseconds after which a server promotion will be aborted if the + * server hasn't caught up with the logs yet. */ +#define DEFAULT_MAX_CATCH_UP_ROUNDS 10 +#define DEFAULT_MAX_CATCH_UP_ROUND_DURATION (5 * 1000) + int raft_init(struct raft *r, struct raft_io *io, struct raft_fsm *fsm, @@ -58,6 +63,8 @@ r->close_cb = NULL; memset(r->errmsg, 0, sizeof r->errmsg); r->pre_vote = false; + r->max_catch_up_rounds = DEFAULT_MAX_CATCH_UP_ROUNDS; + r->max_catch_up_round_duration = DEFAULT_MAX_CATCH_UP_ROUND_DURATION; rv = r->io->init(r->io, r->id, r->address); if (rv != 0) { ErrMsgTransfer(r->io->errmsg, r->errmsg, "io"); @@ -113,6 +120,16 @@ r->snapshot.trailing = n; } +void raft_set_max_catch_up_rounds(struct raft *r, unsigned n) +{ + r->max_catch_up_rounds = n; +} + +void raft_set_max_catch_up_round_duration(struct raft *r, unsigned msecs) +{ + r->max_catch_up_round_duration = msecs; +} + void raft_set_pre_vote(struct raft *r, bool enabled) { r->pre_vote = enabled; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.24/src/tick.c new/raft-0.9.25/src/tick.c --- old/raft-0.9.24/src/tick.c 2020-07-12 12:08:51.000000000 +0200 +++ new/raft-0.9.25/src/tick.c 2020-08-03 15:21:29.000000000 +0200 @@ -15,10 +15,6 @@ #define tracef(...) #endif -/* Number of milliseconds after which a server promotion will be aborted if the - * server hasn't caught up with the logs yet. */ -#define RAFT_MAX_CATCH_UP_DURATION (5 * 1000) - /* Apply time-dependent rules for followers (Figure 3.1). */ static int tickFollower(struct raft *r) { @@ -168,9 +164,9 @@ assert(server_index < r->configuration.n); assert(r->configuration.servers[server_index].role != RAFT_VOTER); - is_too_slow = (r->leader_state.round_number == 10 && + is_too_slow = (r->leader_state.round_number == r->max_catch_up_rounds && round_duration > r->election_timeout); - is_unresponsive = round_duration > RAFT_MAX_CATCH_UP_DURATION; + is_unresponsive = round_duration > r->max_catch_up_round_duration; /* Abort the promotion if we are at the 10'th round and it's still * taking too long, or if the server is unresponsive. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.24/test/lib/fsm.c new/raft-0.9.25/test/lib/fsm.c --- old/raft-0.9.24/test/lib/fsm.c 2020-07-12 12:08:51.000000000 +0200 +++ new/raft-0.9.25/test/lib/fsm.c 2020-08-03 15:21:29.000000000 +0200 @@ -18,6 +18,7 @@ void **result) { struct fsm *f = fsm->data; + const void *cursor = buf->base; unsigned command; int value; @@ -25,8 +26,8 @@ return -1; } - command = *(uint64_t *)buf->base; - value = *((int64_t *)buf->base + 1); + command = (unsigned)byteGet64(&cursor); + value = (int)byteGet64(&cursor); switch (command) { case SET_X:
