-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Debug tool to modify Raft snapshot and hardstate #3364
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1.
Reviewable status: 1 of 2 files reviewed, 3 unresolved discussions (waiting on @danielmai, @manishrjain, and @martinmr)
dgraph/cmd/debug/run.go, line 96 at r1 (raw file):
"Remove data from Raft entries until but not including this index.") flag.StringVarP(&opt.wsetSnapshot, "snap", "s", "", "Set snapshot term,index,readts to this.")
"Set the snapshot term, index, and readTs. Value must be a comma-separated list containing the value for these variables in that order."
dgraph/cmd/debug/run.go, line 891 at r1 (raw file):
store := raftwal.Init(db, rid, gid) switch { case len(opt.wsetSnapshot) > 0:
The logic to set the snapshot is quite long. Unless there's a good reason for it, I think this code should go into its own function, just like printRaft
.
dgraph/cmd/debug/run.go, line 954 at r1 (raw file):
x.Check(err) err = store.CreateSnapshot(dsnap.Index, &cs, data) fmt.Printf("Created snapshot with error: %v\n", err)
only print this if there's an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @danielmai and @manishrjain)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple comments but overall it looks good.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @danielmai and @manishrjain)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @danielmai and @martinmr)
dgraph/cmd/debug/run.go, line 96 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
"Set the snapshot term, index, and readTs. Value must be a comma-separated list containing the value for these variables in that order."
Done.
dgraph/cmd/debug/run.go, line 891 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
The logic to set the snapshot is quite long. Unless there's a good reason for it, I think this code should go into its own function, just like
printRaft
.
Done. Moved all the logic out of this file into a new wal.go file, so all raft stuff is separate. Also, moved the nested funcs outside.
dgraph/cmd/debug/run.go, line 954 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
only print this if there's an error.
Done.
This PR adds a way for the debug tool to operate upon the Raft logs to set a future snapshot and hardstate. This can be used to fix up a broken follower, who has fallen way behind the leader.
This PR adds a way for the debug tool to operate upon the Raft logs to set a future snapshot and hardstate. This can be used to fix up a broken follower, who has fallen way behind the leader.
This change is