-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(cmd): support wal cmd truncate
command
#530
Conversation
cmd/wal/truncate/cmd.go
Outdated
Cmd.Flags().Int64Var(&options.shard, "shard", 0, "shard id") | ||
Cmd.Flags().StringVar(&options.namespace, "namespace", "default", "namespace name") | ||
Cmd.Flags().StringVar(&options.walDir, "wal-dir", "", "directory path") |
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.
These should be options of the wal
command, so they get inherited by all subcommands
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.
applied.
cmd/wal/truncate/cmd.go
Outdated
Cmd.Flags().StringVar(&options.walDir, "wal-dir", "", "directory path") | ||
// operations | ||
Cmd.Flags().Int64Var(&options.safePointEntry, "safe-point-entry", math.MaxInt64, "the last safe entry offset") | ||
Cmd.Flags().BoolVar(&options.lastEntry, "last-entry", false, "if trim the last entry") |
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.
Maybe rename into
Cmd.Flags().BoolVar(&options.lastEntry, "last-entry", false, "if trim the last entry") | |
Cmd.Flags().BoolVar(&options.lastEntry, "trim-last-entry", false, "trim the last entry from the wal") |
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.
Refined the usage and changed the prefix to truncate
.
Motivation
Introduce the wal cmd
truncate
command to truncate corrupted unsynced data in the write-ahead log before implementing a CRC-based write-ahead log.