Skip to content

Commit

Permalink
Add a no-ttl flag to etcdctl migrate to discard keys on transform.
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy St. Clair committed Nov 2, 2016
1 parent 3782571 commit 7cfc6dc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions etcdctl/ctlv3/command/migrate_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
)

var (
migrateNoTTL bool
migrateDatadir string
migrateWALdir string
migrateTransformer string
Expand All @@ -55,6 +56,7 @@ func NewMigrateCommand() *cobra.Command {
Run: migrateCommandFunc,
}

mc.Flags().BoolVar(&migrateNoTTL, "no-ttl", false, "Do not convert TTL keys")
mc.Flags().StringVar(&migrateDatadir, "data-dir", "", "Path to the data directory")
mc.Flags().StringVar(&migrateWALdir, "wal-dir", "", "Path to the WAL directory")
mc.Flags().StringVar(&migrateTransformer, "transformer", "", "Path to the user-provided transformer program")
Expand Down Expand Up @@ -311,6 +313,10 @@ func defaultTransformer() (io.WriteCloser, io.ReadCloser, chan error) {
return
}

if migrateNoTTL && node.TTL != 0 {
continue
}

kv := transform(node)
if kv == nil {
continue
Expand Down

0 comments on commit 7cfc6dc

Please sign in to comment.