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

clientv3: set current revision to create rev regardless of CreateNotify #7804

Merged
merged 1 commit into from
Apr 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions clientv3/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,13 +615,18 @@ func (w *watchGrpcStream) serveSubstream(ws *watcherStream, resumec chan struct{
// send first creation event only if requested
if ws.initReq.createdNotify {
ws.outc <- *wr
if ws.initReq.rev == 0 {
// current revision of store; returning the
// create response binds the current revision to
// this revision, so restart with it if there's a
// disconnect before receiving any events.
nextRev = wr.Header.Revision
}
}
// once the watch channel is returned, a current revision
// watch must resume at the store revision. This is necessary
// for the following case to work as expected:
// wch := m1.Watch("a")
// m2.Put("a", "b")
// <-wch
// If the revision is only bound on the first observed event,
// if wch is disconnected before the Put is issued, then reconnects
// after it is committed, it'll miss the Put.
if ws.initReq.rev == 0 {
nextRev = wr.Header.Revision
}
}
} else {
Expand Down