Skip to content

Commit

Permalink
clientv3: only update initReq.rev == 0 with creation watch revision
Browse files Browse the repository at this point in the history
Always updating the initReq.rev on watch create will resume from the wrong
revision if initReq is ever nonzero.
  • Loading branch information
Anthony Romano committed Apr 21, 2017
1 parent cf9d86b commit fd7e951
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clientv3/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,11 +615,17 @@ 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
nextRev = wr.Header.Revision
}
}
}
} else {
// current progress of watch; <= store revision
nextRev = wr.Header.Revision
}

nextRev = wr.Header.Revision
if len(wr.Events) > 0 {
nextRev = wr.Events[len(wr.Events)-1].Kv.ModRevision + 1
}
Expand Down

0 comments on commit fd7e951

Please sign in to comment.