anmolnar commented on code in PR #2185: URL: https://github.com/apache/zookeeper/pull/2185#discussion_r1876716261
########## zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java: ########## @@ -618,9 +622,10 @@ public synchronized long restoreFromSnapshot(final InputStream inputStream) thro restoreLatch = new CountDownLatch(1); try { - // set to the new zkDatabase - setZKDatabase(newZKDatabase); - + synchronized (snapshotAndRestoreLock) { + // set to the new zkDatabase + setZKDatabase(newZKDatabase); + } Review Comment: To be on the safe side. `Learner` calls it within a sync block: https://github.com/apache/zookeeper/blob/master/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java#L610 -- 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. To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org