From 299ebc6137e3ce1fe0135cddb91abb71b7aa630c Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 20 Jul 2016 11:37:20 -0700 Subject: [PATCH 1/2] v3rpc: don't elide next progress notification on progress notification Fixes #5878 --- etcdserver/api/v3rpc/watch.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etcdserver/api/v3rpc/watch.go b/etcdserver/api/v3rpc/watch.go index 0630a7480..fbf8f06a6 100644 --- a/etcdserver/api/v3rpc/watch.go +++ b/etcdserver/api/v3rpc/watch.go @@ -295,7 +295,8 @@ func (sws *serverWatchStream) sendLoop() { } sws.mu.Lock() - if _, ok := sws.progress[wresp.WatchID]; ok { + if len(evs) > 0 && sws.progress[wresp.WatchID] { + // elide next progress update if sent a key update sws.progress[wresp.WatchID] = false } sws.mu.Unlock() From 8c8742f43c9923277b5dc11cb41897fe8e6c94aa Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 20 Jul 2016 11:39:06 -0700 Subject: [PATCH 2/2] integration: change timeouts for TestWatchWithProgressNotify a) 2 * progress interval was passing with dropped notifies b) waitResponse was waiting so long that it expected a dropped notify --- clientv3/integration/watch_test.go | 2 +- integration/v3_watch_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clientv3/integration/watch_test.go b/clientv3/integration/watch_test.go index 27e890ed8..efd2ef65c 100644 --- a/clientv3/integration/watch_test.go +++ b/clientv3/integration/watch_test.go @@ -487,7 +487,7 @@ func testWatchWithProgressNotify(t *testing.T, watchOnPut bool) { } else if len(resp.Events) != 0 { // wait for notification otherwise t.Fatalf("expected no events, but got %+v", resp.Events) } - case <-time.After(2 * pi): + case <-time.After(time.Duration(1.5 * float64(pi))): t.Fatalf("watch response expected in %v, but timed out", pi) } } diff --git a/integration/v3_watch_test.go b/integration/v3_watch_test.go index 08cb565c9..54394acec 100644 --- a/integration/v3_watch_test.go +++ b/integration/v3_watch_test.go @@ -971,7 +971,7 @@ func TestWatchWithProgressNotify(t *testing.T) { } // no more notification - rok, resp := waitResponse(wStream, testInterval+time.Second) + rok, resp := waitResponse(wStream, time.Second) if !rok { t.Errorf("unexpected pb.WatchResponse is received %+v", resp) }