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/12/15 13:37:49 UTC
[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.
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