You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2021/01/07 07:31:19 UTC

[GitHub] [zookeeper] stop-coding commented on a change in pull request #632: [ZOOKEEPER-3150] Add tree digest check and verify data integrity when loading from disk

stop-coding commented on a change in pull request #632:
URL: https://github.com/apache/zookeeper/pull/632#discussion_r553153135



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileSnap.java
##########
@@ -226,13 +236,42 @@ public synchronized void serialize(DataTree dt, Map<Long, Integer> sessions, Fil
                 FileHeader header = new FileHeader(SNAP_MAGIC, VERSION, dbId);
                 serialize(dt, sessions, oa, header);
                 SnapStream.sealStream(snapOS, oa);

Review comment:
       if digest enabled, it need check sum twice? Does it  serialize zxid digest firstly, then write checksum? like this:
                   serialize(dt, sessions, oa, header);
                   //SnapStream.sealStream(snapOS, oa);
   
                   // Digest feature was added after the CRC to make it backward
                   // compatible, the older code cal still read snapshots which
                   // includes digest.
                   //
                   // To check the intact, after adding digest we added another
                   // CRC check.
                   if (dt.serializeZxidDigest(oa)) {
                       //SnapStream.sealStream(snapOS, oa);
                       LOG.warn(" serializeZxidDigest success");
                   }
                   SnapStream.sealStream(snapOS, oa); // do it finally




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org