zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From breed <...@git.apache.org>
Subject [GitHub] zookeeper pull request #560: ZOOKEEPER-3082: Fix server snapshot behavior wh...
Date Fri, 06 Jul 2018 17:15:03 GMT
Github user breed commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/560#discussion_r200716591
  
    --- Diff: src/java/main/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java ---
    @@ -399,8 +399,30 @@ public void save(DataTree dataTree,
             File snapshotFile = new File(snapDir, Util.makeSnapshotName(lastZxid));
             LOG.info("Snapshotting: 0x{} to {}", Long.toHexString(lastZxid),
                     snapshotFile);
    -        snapLog.serialize(dataTree, sessionsWithTimeouts, snapshotFile, syncSnap);
    -
    +        try {
    +            snapLog.serialize(dataTree, sessionsWithTimeouts, snapshotFile, syncSnap);
    +        } catch (IOException e) {
    +            if (snapshotFile.length() == 0) {
    --- End diff --
    
    this seems extra safe. i'm wondering if perhaps we should always delete the snapshot file
on an exception. the snapshot file probably will not be valid if an exception occurred. right?


---

Mime
View raw message