-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Add a no-ttl flag to etcdctl migrate to discard keys on transform. #6793
Conversation
@hongchaodeng Can you please review this? |
@@ -42,6 +42,7 @@ import ( | |||
) | |||
|
|||
var ( | |||
migrateNoTTL bool |
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.
migrateExcludeTTLKey
@@ -55,6 +56,7 @@ func NewMigrateCommand() *cobra.Command { | |||
Run: migrateCommandFunc, | |||
} | |||
|
|||
mc.Flags().BoolVar(&migrateNoTTL, "no-ttl", false, "Do not convert TTL keys") |
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.
I'm fine with the flag name.
Can you change the var to "migrateExcludeTTLKey"?
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.
Sure.
@@ -311,6 +313,10 @@ func defaultTransformer() (io.WriteCloser, io.ReadCloser, chan error) { | |||
return | |||
} | |||
|
|||
if migrateExcludeTTLKey && node.TTL != 0 { |
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.
we should move this to writeKey func, which emits the keys to transformer. or this flag only works for the default transformer.
Please also change the commit message to ctlv3: Add a no-ttl flag to etcdctl migrate to discard keys on transform. Or CI wont pass. |
LGTM. Will merge when CI turns green. |
/cc me |
@xiang90 - it seems that test passed |
Fixes: #6767
Adds a simple no-ttl flag to allow users to skip any ttl keys.