Watch channel return immediately if revision is very large
I had encountered an unexpected scenario:
- watch from, say rev:100, where the rev of etcd is < 10.
- the watch response channel return immediately with empty response
Is it unexpected? I figure that it should wait until some change with later rev happens.
@hongchaodeng etcd does not accept future revision. What is the use case for waiting for a future revision? I know etcd2 support that, but I really cannot think of a valid use case.
/cc @heyitsanthony
the watch response channel return immediately with empty response
Also, you should always do resp,ok:= <-ch. When there is an error, client will close the chan.
See this: https://github.com/kubernetes/kubernetes/blob/c5260c8c7133d84f903d41a32ef6562c6c69e762/pkg/storage/etcd/etcd_watcher.go#L186
I want to get changes after specific rev:
opts := etcd.WatcherOptions{
Recursive: w.list,
AfterIndex: resourceVersion,
}
@hongchaodeng the way I've been doing it is open a watcher wch on resourceVersion, drop the first event, then the rest of the stream is greater than resourceVersion
@magicwang-cn