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 2020/11/22 07:40:07 UTC

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

smallYellowCat opened a new pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548


   ZOOKEEPER-4005:Zookeeper will not sync snapshot while get DIFF and cause start failed.


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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
smallYellowCat closed pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548


   


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



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

Posted by GitBox <gi...@apache.org>.
maoling commented on a change in pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548#discussion_r546213189



##########
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:
       - Sometimes the `DIFF` message is frequent,  so the existing check of snapshot may be not cheap? Putting that check just before the real place of `takeSnapshot` is more efficiency?
   - Another alternative way may be: allow users to take a snapshot themselves when upgrading by CLI or admin server command(take a snapshot immediately) that were [PR-917](https://github.com/apache/zookeeper/pull/917) and [PR-1044 ](https://github.com/apache/zookeeper/pull/1044) wanted to do.




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



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

Posted by GitBox <gi...@apache.org>.
smallYellowCat commented on pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548#issuecomment-735395100


   > @smallYellowCat Please try to add an unit test for this change. I'll take a closer look this patch at this weekend:)
   
   @maoling Pls check the UT code, Thank you very much.


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



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

Posted by GitBox <gi...@apache.org>.
maoling commented on pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548#issuecomment-733735768


   @smallYellowCat  Please try to add an unit test for this change. I'll take a closer look this patch at this weekend:)


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



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

Posted by GitBox <gi...@apache.org>.
maoling commented on a change in pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548#discussion_r546224788



##########
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:
       Furthermore, we should answer this question: Why must we need a snapshot to restore at the start-up of server(a bit of a counter-intuitive)? we can remove this restriction without any consistency concerns?




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



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

Posted by GitBox <gi...@apache.org>.
maoling commented on a change in pull request #1548:
URL: https://github.com/apache/zookeeper/pull/1548#discussion_r543346873



##########
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:
       - `Util.isSnapshotFileName(name)` is better?
   - Just find one valid snapshot, then fast return true instead of iterating all?
   - I still need a deeper thinking about this change, will come back soon. Sorry for the late.




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