瀏覽代碼

Merge pull request #6852 from heyitsanthony/fix-proxy-dbarrier

grpcproxy: watch next revision should be start revision when not 0
Anthony Romano 9 年之前
父節點
當前提交
7c8f13aed7
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      proxy/grpcproxy/watch_broadcast.go

+ 4 - 1
proxy/grpcproxy/watch_broadcast.go

@@ -81,7 +81,10 @@ func newWatchBroadcast(wp *watchProxy, w *watcher, update func(*watchBroadcast))
 func (wb *watchBroadcast) bcast(wr clientv3.WatchResponse) {
 	wb.mu.Lock()
 	defer wb.mu.Unlock()
-	wb.nextrev = wr.Header.Revision + 1
+	// watchers start on the given revision, if any; ignore header rev on create
+	if wb.responses > 0 || wb.nextrev == 0 {
+		wb.nextrev = wr.Header.Revision + 1
+	}
 	wb.responses++
 	for r := range wb.receivers {
 		r.send(wr)