Skip to content

Commit

Permalink
mvcc: restore unsynced watchers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Iwasaki Yudai committed Feb 6, 2018
1 parent 3903385 commit 36cfb33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/mvcc/watchable_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 36cfb33

Please sign in to comment.