diff --git a/mvcc/watcher_group.go b/mvcc/watcher_group.go index 4b654b751..4394f8ee0 100644 --- a/mvcc/watcher_group.go +++ b/mvcc/watcher_group.go @@ -83,6 +83,10 @@ func (wb watcherBatch) contains(w *watcher) bool { // newWatcherBatch maps watchers to their matched events. It enables quick // events look up by watcher. func newWatcherBatch(wg *watcherGroup, evs []mvccpb.Event) watcherBatch { + if len(wg.watchers) == 0 { + return nil + } + wb := make(watcherBatch) for _, ev := range evs { for w := range wg.watcherSetByKey(string(ev.Kv.Key)) {