Skip to content

Commit

Permalink
Merge pull request #11462 from jingyih/etcdctl_support_watch_progress…
Browse files Browse the repository at this point in the history
…_notify

etcdctl: support progress notify option
  • Loading branch information
spzala committed Jan 14, 2020
2 parents b95a465 + e90c560 commit 908f45e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-3.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Note that any `etcd_debugging_*` metrics are experimental and subject to change.
### etcdctl v3

- Fix [`etcdctl member add`](https://github.com/etcd-io/etcd/pull/11194) command to prevent potential timeout.
- Add [`etcdctl watch --progress-notify`](https://github.com/etcd-io/etcd/pull/11462) flag.

### gRPC gateway

Expand Down
5 changes: 5 additions & 0 deletions etcdctl/ctlv3/command/watch_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
watchPrefix bool
watchInteractive bool
watchPrevKey bool
progressNotify bool
)

// NewWatchCommand returns the cobra command for "watch".
Expand All @@ -54,6 +55,7 @@ func NewWatchCommand() *cobra.Command {
cmd.Flags().BoolVar(&watchPrefix, "prefix", false, "Watch on a prefix if prefix is set")
cmd.Flags().Int64Var(&watchRev, "rev", 0, "Revision to start watching")
cmd.Flags().BoolVar(&watchPrevKey, "prev-kv", false, "get the previous key-value pair before the event happens")
cmd.Flags().BoolVar(&progressNotify, "progress-notify", false, "get periodic watch progress notification from server")

return cmd
}
Expand Down Expand Up @@ -154,6 +156,9 @@ func getWatchChan(c *clientv3.Client, args []string) (clientv3.WatchChan, error)
if watchPrevKey {
opts = append(opts, clientv3.WithPrevKV())
}
if progressNotify {
opts = append(opts, clientv3.WithProgressNotify())
}
return c.Watch(clientv3.WithRequireLeader(context.Background()), key, opts...), nil
}

Expand Down

0 comments on commit 908f45e

Please sign in to comment.