From 36cfb3383e088420313cd6669661c5c289de3761 Mon Sep 17 00:00:00 2001 From: Iwasaki Yudai Date: Mon, 5 Feb 2018 17:08:24 -0800 Subject: [PATCH] mvcc: restore unsynced watchers In case syncWatchersLoop() starts before Restore() is called, watchers already added at that moment are moved to s.synced by the loop. However, there is a broken logic that moves watchers from s.synced to s.uncyned without setting keyWatchers of the watcherGroup. Eventually syncWatchers() fails to pickup those watchers from s.unsynced and no events are sent to the watchers, because newWatcherBatch() called in the function uses wg.watcherSetByKey() internally that requires a proper keyWatchers value. --- internal/mvcc/watchable_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/mvcc/watchable_store.go b/internal/mvcc/watchable_store.go index 34d4d32656bc..054be1034cb4 100644 --- a/internal/mvcc/watchable_store.go +++ b/internal/mvcc/watchable_store.go @@ -192,7 +192,7 @@ func (s *watchableStore) Restore(b backend.Backend) error { } for wa := range s.synced.watchers { - s.unsynced.watchers.add(wa) + s.unsynced.add(wa) } s.synced = newWatcherGroup() return nil