Hello community, here is the log from the commit of package raft for openSUSE:Factory checked in at 2020-07-14 07:56:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/raft (Old) and /work/SRC/openSUSE:Factory/.raft.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "raft" Tue Jul 14 07:56:52 2020 rev:9 rq:820059 version:0.9.23 Changes: -------- --- /work/SRC/openSUSE:Factory/raft/raft.changes 2020-06-03 20:35:46.485784255 +0200 +++ /work/SRC/openSUSE:Factory/.raft.new.3060/raft.changes 2020-07-14 07:59:04.609748298 +0200 @@ -1,0 +2,8 @@ +Fri Jul 10 22:35:29 UTC 2020 - Andreas Stieger <[email protected]> + +- raft 0.9.23: + * Disable async for UBIFS + * Reset vote when converting to candidate and starting a prevote round + * use internal configuration APIs in uv module + +------------------------------------------------------------------- Old: ---- raft-0.9.22.tar.gz New: ---- raft-0.9.23.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ raft.spec ++++++ --- /var/tmp/diff_new_pack.b887ea/_old 2020-07-14 07:59:05.505751199 +0200 +++ /var/tmp/diff_new_pack.b887ea/_new 2020-07-14 07:59:05.509751212 +0200 @@ -18,7 +18,7 @@ %bcond_without libuv Name: raft -Version: 0.9.22 +Version: 0.9.23 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.22.tar.gz -> raft-0.9.23.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/configure.ac new/raft-0.9.23/configure.ac --- old/raft-0.9.22/configure.ac 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/configure.ac 2020-06-05 22:23:07.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ(2.60) -AC_INIT([raft], [0.9.22]) +AC_INIT([raft], [0.9.23]) AC_LANG([C]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([ac]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/src/election.c new/raft-0.9.23/src/election.c --- old/raft-0.9.22/src/election.c 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/src/election.c 2020-06-05 22:23:07.000000000 +0200 @@ -124,8 +124,18 @@ assert(n_voters <= r->configuration.n); assert(voting_index < n_voters); - /* During pre-vote we don't actually increment term or persist vote. */ - if (!r->candidate_state.in_pre_vote) { + /* During pre-vote we don't actually increment term or persist vote, however + * we reset any vote that we previously granted since we have timed out and + * that vote is no longer valid. */ + if (r->candidate_state.in_pre_vote) { + /* Reset vote */ + rv = r->io->set_vote(r->io, 0); + if (rv != 0) { + goto err; + } + /* Update our cache too. */ + r->voted_for = 0; + } else { /* Increment current term */ term = r->current_term + 1; rv = r->io->set_term(r->io, term); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/src/snapshot.c new/raft-0.9.23/src/snapshot.c --- old/raft-0.9.22/src/snapshot.c 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/src/snapshot.c 2020-06-05 22:23:07.000000000 +0200 @@ -19,7 +19,7 @@ void snapshotClose(struct raft_snapshot *s) { unsigned i; - raft_configuration_close(&s->configuration); + configurationClose(&s->configuration); for (i = 0; i < s->n_bufs; i++) { raft_free(s->bufs[i].base); } @@ -45,7 +45,7 @@ return rv; } - raft_configuration_close(&r->configuration); + configurationClose(&r->configuration); r->configuration = snapshot->configuration; r->configuration_index = snapshot->configuration_index; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/src/uv_encoding.c new/raft-0.9.23/src/uv_encoding.c --- old/raft-0.9.22/src/uv_encoding.c 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/src/uv_encoding.c 2020-06-05 22:23:07.000000000 +0200 @@ -430,7 +430,7 @@ args->conf_index = byteGet64(&cursor); conf.len = (size_t)byteGet64(&cursor); conf.base = (void *)cursor; - raft_configuration_init(&args->conf); + configurationInit(&args->conf); rv = configurationDecode(&conf, &args->conf); if (rv != 0) { return rv; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/src/uv_fs.c new/raft-0.9.23/src/uv_fs.c --- old/raft-0.9.22/src/uv_fs.c 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/src/uv_fs.c 2020-06-05 22:23:07.000000000 +0200 @@ -582,6 +582,7 @@ switch (fs_info.f_type) { case 0x01021994: /* TMPFS_MAGIC */ case 0x2fc12fc1: /* ZFS magic */ + case 0x24051905: /* UBIFS Suprt magic */ *size = 0; return 0; default: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/src/uv_recv.c new/raft-0.9.23/src/uv_recv.c --- old/raft-0.9.22/src/uv_recv.c 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/src/uv_recv.c 2020-06-05 22:23:07.000000000 +0200 @@ -7,6 +7,7 @@ #include "heap.h" #include "uv.h" #include "uv_encoding.h" +#include "configuration.h" #if 0 #define tracef(...) Tracef(c->uv->tracer, __VA_ARGS__) @@ -98,7 +99,7 @@ HeapFree(s->message.append_entries.entries); break; case RAFT_IO_INSTALL_SNAPSHOT: - raft_configuration_close(&s->message.install_snapshot.conf); + configurationClose(&s->message.install_snapshot.conf); break; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/src/uv_snapshot.c new/raft-0.9.23/src/uv_snapshot.c --- old/raft-0.9.22/src/uv_snapshot.c 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/src/uv_snapshot.c 2020-06-05 22:23:07.000000000 +0200 @@ -216,7 +216,7 @@ goto err_after_open; } - raft_configuration_init(&snapshot->configuration); + configurationInit(&snapshot->configuration); rv = configurationDecode(&buf, &snapshot->configuration); if (rv != 0) { goto err_after_buf_malloc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.9.22/test/integration/test_election.c new/raft-0.9.23/test/integration/test_election.c --- old/raft-0.9.22/test/integration/test_election.c 2020-05-29 11:33:07.000000000 +0200 +++ new/raft-0.9.23/test/integration/test_election.c 2020-06-05 22:23:07.000000000 +0200 @@ -616,3 +616,104 @@ return MUNIT_OK; } + +/* A candidate receives votes then crashes. */ +TEST(election, preVoteWithcandidateCrash, setUp, tearDown, 0, cluster_3_params) +{ + struct fixture *f = data; + raft_set_pre_vote(CLUSTER_RAFT(0), true); + raft_set_pre_vote(CLUSTER_RAFT(1), true); + raft_set_pre_vote(CLUSTER_RAFT(2), true); + CLUSTER_START; + + /* The first server eventually times out and converts to candidate, but it + * does not increment its term yet.*/ + STEP_UNTIL_CANDIDATE(0); + ASSERT_TIME(1000); + ASSERT_TERM(0, 1); + + /* Server 1 and 2 ticks */ + CLUSTER_STEP_N(2); + ASSERT_FOLLOWER(1); + ASSERT_FOLLOWER(2); + + /* Server 0 completes sending a pre-vote RequestVote RPCs */ + CLUSTER_STEP_N(2); + + CLUSTER_STEP; /* Server 1 receives the pre-vote RequestVote RPC */ + ASSERT_TERM(1, 1); /* Server 1 does not increment its term */ + ASSERT_VOTED_FOR(1, 0); /* Server 1 does not persist its vote */ + ASSERT_TIME(1015); + + CLUSTER_STEP; /* Server 2 receives the pre-vote RequestVote RPC */ + ASSERT_TERM(2, 1); /* Server 2 does not increment its term */ + ASSERT_VOTED_FOR(2, 0); /* Server 1 does not persist its vote */ + ASSERT_TIME(1015); + + /* Server 1 and 2 complete sending pre-vote RequestVote results */ + CLUSTER_STEP_N(2); + + /* Server 0 receives the pre-vote RequestVote results */ + CLUSTER_STEP_N(2); + ASSERT_CANDIDATE(0); + ASSERT_TERM(0, 2); /* Server 0 has now incremented its term. */ + ASSERT_TIME(1030); + + /* Server 1 completes sending actual RequestVote RPCs */ + CLUSTER_STEP_N(2); + + CLUSTER_STEP; /* Server 1 receives the actual RequestVote RPC */ + ASSERT_TERM(1, 2); /* Server 1 does increment its term. */ + ASSERT_VOTED_FOR(1, 1); /* Server 1 does persists its vote */ + + CLUSTER_STEP; /* Server 2 receives the actual RequestVote RPC */ + ASSERT_TERM(2, 2); /* Server 2 does increment its term. */ + ASSERT_VOTED_FOR(2, 1); /* Server 2 does persists its vote */ + + /* Server 0 crashes. */ + CLUSTER_KILL(0); + + /* Server 1 times out and starts an election. It doesn't increment its term + * yet but it reset its vote since it's beginning the pre-vote phase. */ + STEP_UNTIL_CANDIDATE(1); + ASSERT_TIME(2200); + ASSERT_TERM(1, 2); + ASSERT_VOTED_FOR(1, 0); + + /* Since server 2 has already voted for server 0, it doesn't grant its vote + * and eventually times out and becomes candidate, resetting its vote as + * well. */ + STEP_UNTIL_CANDIDATE(2); + ASSERT_TIME(2300); + ASSERT_TERM(2, 2); + ASSERT_VOTED_FOR(2, 0); + + /* Server 2 completes sending the pre-vote RequestVote RPCs */ + CLUSTER_STEP_N(2); + + CLUSTER_STEP; /* Server 1 receives the pre-vote RequestVote RPC */ + ASSERT_TERM(1, 2); /* Server 1 does not increment its term */ + ASSERT_VOTED_FOR(1, 0); /* Server 1 does not persist its vote */ + + /* Server 1 completes sending pre-vote RequestVote results */ + CLUSTER_STEP_N(2); + + /* Server 2 receives the pre-vote RequestVote results */ + CLUSTER_STEP; + ASSERT_CANDIDATE(2); + ASSERT_TERM(2, 3); /* Server 2 has now incremented its term. */ + ASSERT_TIME(2330); + + /* Server 2 completes sending actual RequestVote RPCs */ + CLUSTER_STEP_N(2); + + CLUSTER_STEP_N(2); /* Server 1 receives the actual RequestVote RPC */ + ASSERT_TERM(1, 3); /* Server 1 does increment its term. */ + ASSERT_VOTED_FOR(1, 3); /* Server 1 does persists its vote */ + + CLUSTER_STEP; /* Server 1 completes sending actual RequestVote result */ + CLUSTER_STEP; /* Server 2 receives the actual RequestVote result */ + ASSERT_LEADER(2); + + return MUNIT_OK; +}
