Skip to content
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

Merged
merged 6 commits into from
Sep 25, 2024
Merged

feat(cmd): support wal cmd truncate command #530

merged 6 commits into from
Sep 25, 2024

Conversation

mattisonchao
Copy link
Member

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.

Comment on lines 44 to 46
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")
Copy link
Collaborator

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

Copy link
Member Author

Choose a reason for hiding this comment

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

applied.

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")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe rename into

Suggested change
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")

Copy link
Member Author

@mattisonchao mattisonchao Sep 25, 2024

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.

@merlimat merlimat merged commit b9f1d9c into main Sep 25, 2024
7 checks passed
@merlimat merlimat deleted the tools.wal branch September 25, 2024 13:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants