Github user eribeiro commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/632#discussion_r225016431 --- Diff: zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java --- @@ -154,6 +160,26 @@ private final ReferenceCountedACLCache aclCache = new ReferenceCountedACLCache(); + // The maximum number of tree digests that we will keep in our history + public static final int DIGEST_LOG_LIMIT = 1024; + + // Dump digest every 128 txns, in hex it's 80, which will make it easier + // to align and compare between servers. + public static final int DIGEST_LOG_INTERVAL = 128; + + // If this is not null, we are actively looking for a target zxid that we + // want to validate the digest for + private ZxidDigest digestFromLoadedSnapshot; + + // The digest associated with the highest zxid in the data tree. + private volatile ZxidDigest lastProcessedZxidDigest; + + // Will be notified when digest mismatch event triggered. + private List<DigestWatcher> digestWatchers = new ArrayList<>(); --- End diff -- Oh, good points. Firstly, one thing is: this list could be made `final`, right? :) > We won't have concurrent modification here So, `public void addDigestWatcher(DigestWatcher digestWatcher)` couldn't under any circumstances be called while `reportDigestMismatch` executes the loop at line 1669? Both are public methods, so that motivated me to write the first observation about this, but I can surely be missing something obvious...
---