Hello community,

here is the log from the commit of package raft for openSUSE:Leap:15.2 checked 
in at 2020-05-01 15:07:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/raft (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.raft.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "raft"

Fri May  1 15:07:10 2020 rev:2 rq:799404 version:0.9.18

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/raft/raft.changes      2020-02-17 
17:31:53.607833574 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.raft.new.2738/raft.changes    2020-05-01 
15:07:12.126551993 +0200
@@ -1,0 +2,6 @@
+Tue Apr 28 19:37:09 UTC 2020 - Andreas Stieger <[email protected]>
+
+- raft 0.9.18:
+  * ignore empty snapshot data files, and other bug fixes
+
+-------------------------------------------------------------------

Old:
----
  raft-0.9.17.tar.gz

New:
----
  raft-0.9.18.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ raft.spec ++++++
--- /var/tmp/diff_new_pack.87TtBx/_old  2020-05-01 15:07:12.522552853 +0200
+++ /var/tmp/diff_new_pack.87TtBx/_new  2020-05-01 15:07:12.522552853 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package raft
 #
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %bcond_without libuv
 Name:           raft
-Version:        0.9.17
+Version:        0.9.18
 Release:        0
 Summary:        Fully asynchronous C implementation of the Raft consensus 
protocol
 License:        LGPL-3.0-only WITH linking-exception-lgpl-3.0
@@ -85,7 +85,7 @@
        --disable-uv \
 %endif
 
-make %{?_smp_mflags}
+%make_build
 
 %install
 %make_install

++++++ raft-0.9.17.tar.gz -> raft-0.9.18.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/raft-0.9.17/configure.ac new/raft-0.9.18/configure.ac
--- old/raft-0.9.17/configure.ac        2020-01-24 13:10:52.000000000 +0100
+++ new/raft-0.9.18/configure.ac        2020-04-16 09:15:51.000000000 +0200
@@ -1,5 +1,5 @@
 AC_PREREQ(2.60)
-AC_INIT([raft], [0.9.17])
+AC_INIT([raft], [0.9.18])
 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.17/src/uv.h new/raft-0.9.18/src/uv.h
--- old/raft-0.9.17/src/uv.h    2020-01-24 13:10:52.000000000 +0100
+++ new/raft-0.9.18/src/uv.h    2020-04-16 09:15:51.000000000 +0200
@@ -232,7 +232,7 @@
 
 /* Append a new item to the given snapshot info list if the given filename
  * matches the pattern of a snapshot metadata file (snapshot-xxx-yyy-zzz.meta)
- * and there is actually a matching snapshot file on disk. */
+ * and there is actually a matching non-empty snapshot file on disk. */
 int UvSnapshotInfoAppendIfMatch(struct uv *uv,
                                 const char *filename,
                                 struct uvSnapshotInfo *infos[],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/raft-0.9.17/src/uv_append.c 
new/raft-0.9.18/src/uv_append.c
--- old/raft-0.9.17/src/uv_append.c     2020-01-24 13:10:52.000000000 +0100
+++ new/raft-0.9.18/src/uv_append.c     2020-04-16 09:15:51.000000000 +0200
@@ -305,6 +305,7 @@
     int rv;
 
     assert(!uv->closing);
+    assert(!QUEUE_IS_EMPTY(&uv->append_pending_reqs));
 
     /* If we are already writing, let's wait. */
     if (!QUEUE_IS_EMPTY(&uv->append_writing_reqs)) {
@@ -579,7 +580,7 @@
     /* If we have no segments yet, it means this is the very first append, and
      * we need to add a new segment. Otherwise we check if the last segment has
      * enough room for this batch of entries. */
-    segment = uvGetCurrentAliveSegment(uv);
+    segment = uvGetLastAliveSegment(uv);
     if (segment == NULL || segment->finalize) {
         fits = false;
     } else {
@@ -641,6 +642,7 @@
     }
 
     assert(append->segment != NULL);
+    assert(!QUEUE_IS_EMPTY(&uv->append_pending_reqs));
 
     /* Try to write immediately. */
     rv = uvAppendMaybeStart(uv);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/raft-0.9.17/src/uv_os.c new/raft-0.9.18/src/uv_os.c
--- old/raft-0.9.17/src/uv_os.c 2020-01-24 13:10:52.000000000 +0100
+++ new/raft-0.9.18/src/uv_os.c 2020-04-16 09:15:51.000000000 +0200
@@ -166,7 +166,7 @@
     int rv;
     /* At the moment only UV_FS_O_NONBLOCK is supported */
     assert(flags == UV_FS_O_NONBLOCK);
-    flags = EFD_NONBLOCK;
+    flags = EFD_NONBLOCK|EFD_CLOEXEC;
     rv = eventfd(initval, flags);
     if (rv == -1) {
         return -errno;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/raft-0.9.17/src/uv_snapshot.c 
new/raft-0.9.18/src/uv_snapshot.c
--- old/raft-0.9.17/src/uv_snapshot.c   2020-01-24 13:10:52.000000000 +0100
+++ new/raft-0.9.18/src/uv_snapshot.c   2020-04-16 09:15:51.000000000 +0200
@@ -59,6 +59,7 @@
     bool matched;
     char snapshot_filename[UV__FILENAME_LEN];
     bool exists;
+    bool is_empty;
     char errmsg[RAFT_ERRMSG_BUF_SIZE];
     int rv;
 
@@ -69,9 +70,9 @@
         return 0;
     }
 
-    /* Check if there's actually a snapshot file for this snapshot metadata. If
-     * there's none, it means that we aborted before finishing the snapshot, so
-     * let's remove the metadata file. */
+    /* Check if there's actually a valid snapshot file for this snapshot
+     * metadata. If there's none or it's empty, it means that we aborted before
+     * finishing the snapshot, so let's remove the metadata file. */
     uvSnapshotFilenameOf(&info, snapshot_filename);
     rv = UvFsFileExists(uv->dir, snapshot_filename, &exists, errmsg);
     if (rv != 0) {
@@ -84,6 +85,19 @@
         *appended = false;
         return 0;
     }
+    rv = UvFsFileIsEmpty(uv->dir, snapshot_filename, &is_empty, errmsg);
+    if (rv != 0) {
+        tracef("is_empty %s: %s", snapshot_filename, errmsg);
+        rv = RAFT_IOERR;
+        return rv;
+    }
+    if (is_empty) {
+        /* Ignore errors */
+        UvFsRemoveFile(uv->dir, filename, errmsg);
+        UvFsRemoveFile(uv->dir, snapshot_filename, errmsg);
+        *appended = false;
+        return 0;
+    }
 
     ARRAY__APPEND(struct uvSnapshotInfo, info, infos, n_infos, rv);
     if (rv == -1) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/raft-0.9.17/test/integration/test_uv_append.c 
new/raft-0.9.18/test/integration/test_uv_append.c
--- old/raft-0.9.17/test/integration/test_uv_append.c   2020-01-24 
13:10:52.000000000 +0100
+++ new/raft-0.9.18/test/integration/test_uv_append.c   2020-04-16 
09:15:51.000000000 +0200
@@ -288,6 +288,20 @@
     return MUNIT_OK;
 }
 
+/* Schedule multiple appends each one exceeding the segment size. */
+TEST(append, severalBig, setUp, tearDownDeps, 0, NULL)
+{
+    struct fixture *f = data;
+    APPEND_SUBMIT(0, 2, MAX_SEGMENT_BLOCKS * SEGMENT_BLOCK_SIZE);
+    APPEND_SUBMIT(1, 2, MAX_SEGMENT_BLOCKS * SEGMENT_BLOCK_SIZE);
+    APPEND_SUBMIT(2, 2, MAX_SEGMENT_BLOCKS * SEGMENT_BLOCK_SIZE);
+    APPEND_WAIT(0);
+    APPEND_WAIT(1);
+    APPEND_WAIT(2);
+    ASSERT_ENTRIES(6, 6 * MAX_SEGMENT_BLOCKS * SEGMENT_BLOCK_SIZE);
+    return MUNIT_OK;
+}
+
 /* Write the very first entry and then another one, both fitting in the same
  * block. */
 TEST(append, fitBlock, setUp, tearDownDeps, 0, NULL)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/raft-0.9.17/test/integration/test_uv_load.c 
new/raft-0.9.18/test/integration/test_uv_load.c
--- old/raft-0.9.17/test/integration/test_uv_load.c     2020-01-24 
13:10:52.000000000 +0100
+++ new/raft-0.9.18/test/integration/test_uv_load.c     2020-04-16 
09:15:51.000000000 +0200
@@ -636,6 +636,40 @@
     return MUNIT_OK;
 }
 
+/* There are two snapshots, but the last one has an empty data file. The first
+ * one is loaded and the empty one is discarded.  */
+TEST(load, emptySnapshot, setUp, tearDown, 0, NULL)
+{
+    struct fixture *f = data;
+    struct snapshot snapshot = {
+        1, /* term */
+        4, /* index */
+        1  /* data */
+    };
+    char filename[64];
+    uint64_t now;
+
+    SNAPSHOT_PUT(1, 4, 1);
+
+    /* Take a snapshot but then truncate the data file, as if the server ran 
out
+     * of space before it could write it. */
+    uv_update_time(&f->loop);
+    now = uv_now(&f->loop);
+    sprintf(filename, "snapshot-2-6-%ju", now);
+    SNAPSHOT_PUT(2, 6, 2);
+    test_dir_truncate_file(f->dir, filename, 0);
+
+    LOAD(0,         /* term */
+         0,         /* voted for */
+         &snapshot, /* snapshot */
+         5,        /* start index */
+         0,         /* data for first loaded entry */
+         0          /* n entries */
+    );
+
+    return MUNIT_OK;
+}
+
 /* The data directory has a closed segment with entries that are no longer
  * needed, since they are included in a snapshot. We still keep those segments
  * and just let the next snapshot logic delete them. */


Reply via email to