-
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
Allow truncating raft logs via debug tool #3345
Conversation
dgraph/cmd/debug/run.go
Outdated
flag.BoolVar(&opt.sizeHistogram, "histogram", false, | ||
"Show a histogram of the key and value sizes.") | ||
|
||
flag.StringVarP(&opt.wdir, "wal", "w", "", "Directory where Raft write-ahead logs are stored.") | ||
flag.Uint64VarP(&opt.wtruncateUntil, "truncate", "t", 0, "Remove data from Raft entries up until this index.") |
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.
line is 111 characters (from lll
)
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, 1 of 1 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @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: all files reviewed, 3 unresolved discussions (waiting on @golangcibot and @manishrjain)
dgraph/cmd/debug/run.go, line 92 at r1 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
line is 111 characters (from
lll
)
I feel like "truncate" is the wrong term here. Truncate means to cut off the end (e.g. truncate a file), and I think here you're removing things from the start. Possible alternatives: drop, prune, expire,
dgraph/cmd/debug/run.go, line 93 at r2 (raw file):
flag.StringVarP(&opt.wdir, "wal", "w", "", "Directory where Raft write-ahead logs are stored.") flag.Uint64VarP(&opt.wtruncateUntil, "truncate", "t", 0, "Remove data from Raft entries up until this index.")
"until" is a ambiguous about whether the index itself is removed or not. I'd suggest changing it to "until and including" or "until but not including" to be clear.
dgraph/cmd/debug/run.go, line 855 at r2 (raw file):
case ent.Type == raftpb.EntryNormal && ent.Index < opt.wtruncateUntil: if len(ent.Data) == 0 { continue
Is there a reason for not removing empty entries?
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: all files reviewed, 3 unresolved discussions (waiting on @codexnull and @golangcibot)
dgraph/cmd/debug/run.go, line 93 at r2 (raw file):
Previously, codexnull (Javier Alvarado) wrote…
"until" is a ambiguous about whether the index itself is removed or not. I'd suggest changing it to "until and including" or "until but not including" to be clear.
Done.
dgraph/cmd/debug/run.go, line 855 at r2 (raw file):
Previously, codexnull (Javier Alvarado) wrote…
Is there a reason for not removing empty entries?
Entries aren't being removed. Only their data is being dropped.
This PR would add a flag in debug tool, which would allow dropping data from Raft log entries of type EntryNormal.
This PR would add a flag in debug tool, which would allow dropping data from Raft log entries of type EntryNormal.
This change is