Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package raft for openSUSE:Factory checked in at 2021-08-10 10:27:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/raft (Old) and /work/SRC/openSUSE:Factory/.raft.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "raft" Tue Aug 10 10:27:26 2021 rev:14 rq:910710 version:0.11.2 Changes: -------- --- /work/SRC/openSUSE:Factory/raft/raft.changes 2021-06-24 18:22:56.960941187 +0200 +++ /work/SRC/openSUSE:Factory/.raft.new.1899/raft.changes 2021-08-10 10:27:31.797808125 +0200 @@ -1,0 +2,8 @@ +Sun Aug 8 13:10:06 UTC 2021 - Andreas Stieger <andreas.stie...@gmx.de> + +- raft 0.11.2: + * set start_index correctly when no closed segments are present + * uv_segment code correctnes fixes + * replication: do not send snapshots to offline nodes + +------------------------------------------------------------------- Old: ---- raft-0.11.1.tar.gz New: ---- raft-0.11.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ raft.spec ++++++ --- /var/tmp/diff_new_pack.WS8vyd/_old 2021-08-10 10:27:32.273807574 +0200 +++ /var/tmp/diff_new_pack.WS8vyd/_new 2021-08-10 10:27:32.273807574 +0200 @@ -17,7 +17,7 @@ Name: raft -Version: 0.11.1 +Version: 0.11.2 Release: 0 Summary: Fully asynchronous C implementation of the Raft consensus protocol License: LGPL-3.0-only WITH LGPL-3.0-linking-exception ++++++ raft-0.11.1.tar.gz -> raft-0.11.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/.github/workflows/build-and-test.yml new/raft-0.11.2/.github/workflows/build-and-test.yml --- old/raft-0.11.1/.github/workflows/build-and-test.yml 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/.github/workflows/build-and-test.yml 2021-08-03 11:32:52.000000000 +0200 @@ -40,7 +40,7 @@ CC: ${{ matrix.compiler }} run: | ./test/lib/fs.sh setup - make check CFLAGS=-O0 $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false) + make check $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false) ./test/lib/fs.sh teardown - name: Coverage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/.travis.yml new/raft-0.11.2/.travis.yml --- old/raft-0.11.1/.travis.yml 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/.travis.yml 2021-08-03 11:32:52.000000000 +0200 @@ -42,5 +42,5 @@ - amalgamate.py --config=amalgamation.json --source=$(pwd) - $CC raft.c -c -D_GNU_SOURCE -DHAVE_LINUX_AIO_ABI_H -Wall -Wextra -Wpedantic -fpic - ./test/lib/fs.sh setup - - make check CFLAGS=-O0 $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false) + - make check $(./test/lib/fs.sh detect) || (cat ./test-suite.log && false) - ./test/lib/fs.sh teardown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/README.md new/raft-0.11.2/README.md --- old/raft-0.11.1/README.md 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/README.md 2021-08-03 11:32:52.000000000 +0200 @@ -146,7 +146,17 @@ To add more servers to the cluster use the ```raft_add()``` and ```raft_promote``` APIs. - + +Usage Notes +----------- + +The default [libuv](http://libuv.org) based ```raft_io``` implementation compresses the raft +snapshots using the ```liblz4``` library. Next to saving disk space, the lz4 +compressed snapshots offer additional data integrity checks in the form of a +[Content Checksum](https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md), this allows raft +to detect corruptions that occurred during storage. It is therefore recommended to not disable +lz4 compression by means of the ```--disable-lz4``` configure flag. + Notable users ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/configure.ac new/raft-0.11.2/configure.ac --- old/raft-0.11.1/configure.ac 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/configure.ac 2021-08-03 11:32:52.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ(2.60) -AC_INIT([raft], [0.11.1]) +AC_INIT([raft], [0.11.2]) 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.11.1/src/election.c new/raft-0.11.2/src/election.c --- old/raft-0.11.1/src/election.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/election.c 2021-08-03 11:32:52.000000000 +0200 @@ -119,7 +119,7 @@ * configuration (meaning that we are a voting server). */ assert(voting_index < r->configuration.n); - /* Sanity check that configurationVoterCount and configurationIndexOfVoter + /* Coherence check that configurationVoterCount and configurationIndexOfVoter * have returned something that makes sense. */ assert(n_voters <= r->configuration.n); assert(voting_index < n_voters); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/log.c new/raft-0.11.2/src/log.c --- old/raft-0.11.1/src/log.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/log.c 2021-08-03 11:32:52.000000000 +0200 @@ -619,7 +619,7 @@ if (index == l->snapshot.last_index) { assert(l->snapshot.last_term != 0); - /* Sanity check that if we still have the entry at last_index, its term + /* Coherence check that if we still have the entry at last_index, its term * matches the one in the snapshot. */ i = locateEntry(l, index); if (i != l->size) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/progress.c new/raft-0.11.2/src/progress.c --- old/raft-0.11.1/src/progress.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/progress.c 2021-08-03 11:32:52.000000000 +0200 @@ -178,6 +178,11 @@ r->leader_state.progress[i].recent_recv = true; } +bool progressGetRecentRecv(const struct raft *r, const unsigned i) +{ + return r->leader_state.progress[i].recent_recv; +} + void progressToSnapshot(struct raft *r, unsigned i) { struct raft_progress *p = &r->leader_state.progress[i]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/progress.h new/raft-0.11.2/src/progress.h --- old/raft-0.11.1/src/progress.h 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/progress.h 2021-08-03 11:32:52.000000000 +0200 @@ -64,6 +64,9 @@ * To be called whenever we receive an AppendEntries RPC result */ void progressMarkRecentRecv(struct raft *r, unsigned i); +/* Return the value of the recent_recv flag. */ +bool progressGetRecentRecv(const struct raft *r, unsigned i); + /* Convert to the i'th server to snapshot mode. */ void progressToSnapshot(struct raft *r, unsigned i); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/replication.c new/raft-0.11.2/src/replication.c --- old/raft-0.11.1/src/replication.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/replication.c 2021-08-03 11:32:52.000000000 +0200 @@ -351,7 +351,15 @@ return sendAppendEntries(r, i, prev_index, prev_term); send_snapshot: - return sendSnapshot(r, i); + if (progressGetRecentRecv(r, i)) { + /* Only send a snapshot when we have heard from the server */ + return sendSnapshot(r, i); + } else { + /* Send empty AppendEntries RPC when we haven't heard from the server */ + prev_index = logLastIndex(&r->log); + prev_term = logLastTerm(&r->log); + return sendAppendEntries(r, i, prev_index, prev_term); + } } /* Possibly trigger I/O requests for newly appended log entries or heartbeats. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/uv.c new/raft-0.11.2/src/uv.c --- old/raft-0.11.1/src/uv.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/uv.c 2021-08-03 11:32:52.000000000 +0200 @@ -391,7 +391,7 @@ } if (segments != NULL) { if (segments[0].is_open) { - *start_index = 1; + *start_index = (*snapshot)->index + 1; } else { *start_index = segments[0].first_index; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/uv_encoding.c new/raft-0.11.2/src/uv_encoding.c --- old/raft-0.11.1/src/uv_encoding.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/uv_encoding.c 2021-08-03 11:32:52.000000000 +0200 @@ -368,7 +368,8 @@ return 0; err_after_alloc: - raft_free(entries); + raft_free(*entries); + *entries = NULL; err: assert(rv != 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/uv_metadata.c new/raft-0.11.2/src/uv_metadata.c --- old/raft-0.11.1/src/uv_metadata.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/uv_metadata.c 2021-08-03 11:32:52.000000000 +0200 @@ -36,7 +36,7 @@ metadata->term = byteGet64(&cursor); metadata->voted_for = byteGet64(&cursor); - /* Sanity checks that values make sense */ + /* Coherence checks that values make sense */ if (metadata->version == 0) { ErrMsgPrintf(errmsg, "version is set to zero"); return RAFT_CORRUPT; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/src/uv_segment.c new/raft-0.11.2/src/uv_segment.c --- old/raft-0.11.1/src/uv_segment.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/src/uv_segment.c 2021-08-03 11:32:52.000000000 +0200 @@ -481,7 +481,7 @@ uint64_t format; /* Format version */ size_t n_batches = 0; /* Number of loaded batches */ struct raft_entry *tmp_entries; /* Entries in current batch */ - struct raft_buffer buf; /* Segment file content */ + struct raft_buffer buf = {0}; /* Segment file content */ size_t offset; /* Content read cursor */ unsigned tmp_n_entries; /* Number of entries in current batch */ int i; @@ -521,6 +521,7 @@ tracef("remove zeroed open segment %s", info->filename); remove = true; HeapFree(buf.base); + buf.base = NULL; goto done; } } @@ -572,6 +573,7 @@ if (n_batches == 0) { HeapFree(buf.base); + buf.base = NULL; remove = true; } @@ -616,7 +618,9 @@ raft_free(tmp_entries); err_after_read: - HeapFree(buf.base); + if (buf.base != NULL) { + HeapFree(buf.base); + } err: assert(rv != 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/test/integration/test_snapshot.c new/raft-0.11.2/test/integration/test_snapshot.c --- old/raft-0.11.1/test/integration/test_snapshot.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/test/integration/test_snapshot.c 2021-08-03 11:32:52.000000000 +0200 @@ -90,6 +90,9 @@ CLUSTER_DESATURATE_BOTHWAYS(0, 2); CLUSTER_STEP_UNTIL_APPLIED(2, 4, 5000); + /* Check that the leader has sent a snapshot */ + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); + munit_assert_int(CLUSTER_N_RECV(2, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); return MUNIT_OK; } @@ -103,29 +106,147 @@ SET_SNAPSHOT_THRESHOLD(3); SET_SNAPSHOT_TRAILING(1); SET_SNAPSHOT_TIMEOUT(200); - CLUSTER_SATURATE_BOTHWAYS(0, 2); - /* Apply a few of entries, to force a snapshot to be taken. */ + /* Apply a few of entries, to force a snapshot to be taken. Drop all network + * traffic between servers 0 and 2 in order for AppendEntries RPCs to not be + * replicated */ + CLUSTER_SATURATE_BOTHWAYS(0, 2); CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; - /* Reconnect the leader, but follower cannot reply */ - CLUSTER_DESATURATE(0, 2); + /* Reconnect both servers and set a high disk latency on server 2 so that + * the InstallSnapshot RPC will time out */ + CLUSTER_SET_DISK_LATENCY(2, 300); + CLUSTER_DESATURATE_BOTHWAYS(0, 2); - /* InstallSnaphot RPC times out */ - CLUSTER_STEP_UNTIL_ELAPSED(400); + /* Wait a while and check that the leader has sent a snapshot */ + CLUSTER_STEP_UNTIL_ELAPSED(300); + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); + munit_assert_int(CLUSTER_N_RECV(2, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); - /* Reconnect the follower */ - CLUSTER_DESATURATE(2, 0); + /* Wait for the snapshot to be installed */ CLUSTER_STEP_UNTIL_APPLIED(2, 4, 5000); /* Assert that the leader has retried the InstallSnapshot RPC */ munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 2); + munit_assert_int(CLUSTER_N_RECV(2, RAFT_IO_INSTALL_SNAPSHOT), ==, 2); + + return MUNIT_OK; +} + +/* Install snapshot to an offline node */ +TEST(snapshot, installOneDisconnectedFromBeginningReconnects, setUp, tearDown, 0, NULL) +{ + struct fixture *f = data; + (void)params; + + /* Set very low threshold and trailing entries number */ + SET_SNAPSHOT_THRESHOLD(3); + SET_SNAPSHOT_TRAILING(1); + SET_SNAPSHOT_TIMEOUT(200); + + /* Apply a few of entries, to force a snapshot to be taken. Disconnect + * servers 0 and 2 so that the network calls return failure status */ + CLUSTER_DISCONNECT(0, 2); + CLUSTER_DISCONNECT(2, 0); + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + + /* Wait a while so leader detects offline node */ + CLUSTER_STEP_UNTIL_ELAPSED(2000); + + /* Assert that the leader doesn't try sending a snapshot to an offline node */ + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 0); + munit_assert_int(CLUSTER_N_RECV(2, RAFT_IO_INSTALL_SNAPSHOT), ==, 0); + + CLUSTER_RECONNECT(0, 2); + CLUSTER_RECONNECT(2, 0); + /* Wait for the snapshot to be installed */ + CLUSTER_STEP_UNTIL_APPLIED(2, 4, 5000); + + /* Assert that the leader has sent an InstallSnapshot RPC */ + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); + munit_assert_int(CLUSTER_N_RECV(2, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); + + return MUNIT_OK; +} + +/* Install snapshot to an offline node that went down during operation */ +TEST(snapshot, installOneDisconnectedDuringOperationReconnects, setUp, tearDown, 0, NULL) +{ + struct fixture *f = data; + (void)params; + + /* Set very low threshold and trailing entries number */ + SET_SNAPSHOT_THRESHOLD(3); + SET_SNAPSHOT_TRAILING(1); + SET_SNAPSHOT_TIMEOUT(200); + + /* Apply a few of entries */ + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + + /* Wait for follower to catch up*/ + CLUSTER_STEP_UNTIL_APPLIED(2, 4, 5000); + /* Assert that the leader hasn't sent an InstallSnapshot RPC */ + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 0); + + CLUSTER_DISCONNECT(0, 2); + CLUSTER_DISCONNECT(2, 0); + + /* Wait a while so leader detects offline node */ + CLUSTER_STEP_UNTIL_ELAPSED(2000); + + /* Apply a few more entries */ + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + + /* Assert that the leader doesn't try sending snapshot to an offline node */ + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 0); + munit_assert_int(CLUSTER_N_RECV(2, RAFT_IO_INSTALL_SNAPSHOT), ==, 0); + + CLUSTER_RECONNECT(0, 2); + CLUSTER_RECONNECT(2, 0); + CLUSTER_STEP_UNTIL_APPLIED(2, 7, 5000); + + /* Assert that the leader has tried sending an InstallSnapshot RPC */ + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); + munit_assert_int(CLUSTER_N_RECV(2, RAFT_IO_INSTALL_SNAPSHOT), ==, 1); return MUNIT_OK; } +/* No snapshots sent to killed nodes */ +TEST(snapshot, noSnapshotInstallToKilled, setUp, tearDown, 0, NULL) +{ + struct fixture *f = data; + (void)params; + + /* Set very low threshold and trailing entries number */ + SET_SNAPSHOT_THRESHOLD(3); + SET_SNAPSHOT_TRAILING(1); + SET_SNAPSHOT_TIMEOUT(200); + + /* Kill a server */ + CLUSTER_KILL(2); + + /* Apply a few of entries */ + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + CLUSTER_MAKE_PROGRESS; + + /* Wait a while */ + CLUSTER_STEP_UNTIL_ELAPSED(4000); + + /* Assert that the leader hasn't sent an InstallSnapshot RPC */ + munit_assert_int(CLUSTER_N_SEND(0, RAFT_IO_INSTALL_SNAPSHOT), ==, 0); + return MUNIT_OK; +} + /* Install snapshot times out and leader retries, afterwards AppendEntries resume */ TEST(snapshot, installOneTimeOutAppendAfter, setUp, tearDown, 0, NULL) { @@ -136,21 +257,22 @@ SET_SNAPSHOT_THRESHOLD(3); SET_SNAPSHOT_TRAILING(1); SET_SNAPSHOT_TIMEOUT(200); - CLUSTER_SATURATE_BOTHWAYS(0, 2); - /* Apply a few of entries, to force a snapshot to be taken. */ + /* Apply a few of entries, to force a snapshot to be taken. Drop all network + * traffic between servers 0 and 2 in order for AppendEntries RPCs to not be + * replicated */ + CLUSTER_SATURATE_BOTHWAYS(0, 2); CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; - /* Reconnect the leader, but follower cannot reply */ - CLUSTER_DESATURATE(0, 2); - - /* InstallSnaphot RPC times out */ - CLUSTER_STEP_UNTIL_ELAPSED(400); + /* Reconnect both servers and set a high disk latency on server 2 so that + * the InstallSnapshot RPC will time out */ + CLUSTER_SET_DISK_LATENCY(2, 300); + CLUSTER_DESATURATE_BOTHWAYS(0, 2); - /* Reconnect the follower */ - CLUSTER_DESATURATE(2, 0); + /* Wait for the snapshot to be installed */ + CLUSTER_STEP_UNTIL_APPLIED(2, 4, 5000); /* Append a few entries and check if they are replicated */ CLUSTER_MAKE_PROGRESS; @@ -172,29 +294,33 @@ SET_SNAPSHOT_THRESHOLD(3); SET_SNAPSHOT_TRAILING(1); SET_SNAPSHOT_TIMEOUT(200); - CLUSTER_SATURATE_BOTHWAYS(0, 2); - /* Apply a few of entries, to force a snapshot to be taken. */ + /* Apply a few of entries, to force a snapshot to be taken. Drop all network + * traffic between servers 0 and 2 in order for AppendEntries RPCs to not be + * replicated */ + CLUSTER_SATURATE_BOTHWAYS(0, 2); CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; - /* Reconnect the leader, but follower cannot reply */ - CLUSTER_DESATURATE(0, 2); + /* Reconnect both servers and set a high disk latency on server 2 so that + * the InstallSnapshot RPC will time out */ + CLUSTER_SET_DISK_LATENCY(2, 300); + CLUSTER_DESATURATE_BOTHWAYS(0, 2); - /* InstallSnaphot RPC times out */ + /* Step until the snapshot times out */ CLUSTER_STEP_UNTIL_ELAPSED(400); - /* Apply another few of entries, to force a new snapshot to be taken. */ + /* Apply another few of entries, to force a new snapshot to be taken. Drop + * all traffic between servers 0 and 2 in order for AppendEntries RPCs to not be + * replicated */ + CLUSTER_SATURATE_BOTHWAYS(0, 2); CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; - /* InstallSnaphot RPC times out */ - CLUSTER_STEP_UNTIL_ELAPSED(400); - /* Reconnect the follower */ - CLUSTER_DESATURATE(2, 0); + CLUSTER_DESATURATE_BOTHWAYS(0, 2); CLUSTER_STEP_UNTIL_APPLIED(2, 7, 5000); /* Assert that the leader has sent multiple InstallSnapshot RPCs */ @@ -214,30 +340,33 @@ SET_SNAPSHOT_THRESHOLD(3); SET_SNAPSHOT_TRAILING(1); SET_SNAPSHOT_TIMEOUT(200); - CLUSTER_SATURATE_BOTHWAYS(0, 2); - /* Apply a few of entries, to force a snapshot to be taken. */ + /* Apply a few of entries, to force a snapshot to be taken. Drop all network + * traffic between servers 0 and 2 in order for AppendEntries RPCs to not be + * replicated */ + CLUSTER_SATURATE_BOTHWAYS(0, 2); CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; - /* Reconnect the leader, but follower cannot reply */ - CLUSTER_DESATURATE(0, 2); + /* Reconnect both servers and set a high disk latency on server 2 so that + * the InstallSnapshot RPC will time out */ + CLUSTER_SET_DISK_LATENCY(2, 300); + CLUSTER_DESATURATE_BOTHWAYS(0, 2); - /* InstallSnaphot RPC times out */ + /* Step until the snapshot times out */ CLUSTER_STEP_UNTIL_ELAPSED(400); - /* Apply another few of entries, to force a new snapshot to be taken. */ + /* Apply another few of entries, to force a new snapshot to be taken. Drop + * all traffic between servers 0 and 2 in order for AppendEntries RPCs to not be + * replicated */ + CLUSTER_SATURATE_BOTHWAYS(0, 2); CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; - /* InstallSnaphot RPC times out */ - CLUSTER_STEP_UNTIL_ELAPSED(400); - /* Reconnect the follower */ - CLUSTER_DESATURATE(2, 0); - + CLUSTER_DESATURATE_BOTHWAYS(0, 2); /* Append a few entries and make sure the follower catches up */ CLUSTER_MAKE_PROGRESS; CLUSTER_MAKE_PROGRESS; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/test/integration/test_uv_load.c new/raft-0.11.2/test/integration/test_uv_load.c --- old/raft-0.11.1/test/integration/test_uv_load.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/test/integration/test_uv_load.c 2021-08-03 11:32:52.000000000 +0200 @@ -850,6 +850,29 @@ return MUNIT_OK; } +/* The data directory contains a snapshot and an open segment containing a valid + * entry, and no closed segments. */ +TEST(load, openSegmentNoClosedSegmentsSnapshotPresent, setUp, tearDown, 0, NULL) +{ + struct fixture *f = data; + struct snapshot snapshot = { + 1, /* term */ + 3, /* index */ + 1 /* data */ + }; + SNAPSHOT_PUT(1, 3, 1); + APPEND(1, 4); + UNFINALIZE(4, 4, 1); + LOAD(0, /* term */ + 0, /* voted for */ + &snapshot, /* snapshot */ + 4, /* start index */ + 4, /* data for first loaded entry */ + 1 /* n entries */ + ); + return MUNIT_OK; +} + /* The data directory has several closed segments, all with entries compatible * with the snapshot. */ TEST(load, closedSegmentsOverlappingWithSnapshot, setUp, tearDown, 0, NULL) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/raft-0.11.1/test/unit/test_uv_writer.c new/raft-0.11.2/test/unit/test_uv_writer.c --- old/raft-0.11.1/test/unit/test_uv_writer.c 2021-06-03 17:22:33.000000000 +0200 +++ new/raft-0.11.2/test/unit/test_uv_writer.c 2021-08-03 11:32:52.000000000 +0200 @@ -334,13 +334,13 @@ /* Write two different blocks concurrently. */ TEST(UvWriterSubmit, concurrent, NULL, NULL, 0, DirAllParams) { - return MUNIT_SKIP; /* TODO: tests hang */ + return MUNIT_SKIP; /* TODO: tests stop responding */ } /* Write the same block concurrently. */ TEST(UvWriterSubmit, concurrentSame, NULL, NULL, 0, DirAllParams) { - return MUNIT_SKIP; /* TODO: tests hang */ + return MUNIT_SKIP; /* TODO: tests stop responding */ } /* There are not enough resources to create an AIO context to perform the