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/12 10:44:43 UTC

[GitHub] [zookeeper] smallYellowCat commented on a change in pull request #1548: ZOOKEEPER-4005:Zookeeper will not sync snapshot while get DIFF and cause start failed.

smallYellowCat commented on a change in pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548#discussion_r555676855



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
##########
@@ -530,6 +531,17 @@ public void takeSnapshot(boolean syncSnap) {
         ServerMetrics.getMetrics().SNAPSHOT_TIME.add(elapsed);
     }
 
+    public boolean existSnapshot() {
+        File snapShotDir = txnLogFactory.getSnapDir();
+        String[] snaps = snapShotDir.list(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                return name.contains("snapshot");

Review comment:
       1. this check only occurr during qurumpeer starting.
   2.  the reason of check snapshot whether exist is prevent zk from starting in a subset and maybe become a leader.




----------------------------------------------------------------
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