Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 0 commits into from

Conversation

smallYellowCat
Copy link

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

@maoling
Copy link
Member

maoling commented Nov 25, 2020

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

@smallYellowCat
Copy link
Author

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

String[] snaps = snapShotDir.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.contains("snapshot");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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 and PR-1044 wanted to do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants