diff --git a/internal/watch/watch.go b/internal/watch/watch.go index 2dfbad6..fe684d4 100644 --- a/internal/watch/watch.go +++ b/internal/watch/watch.go @@ -854,20 +854,19 @@ func (w *Watcher) extractSnippets() { // syncGossip runs one anti-entropy sweep against configured peers and rebuilds // derived state if anything new arrived. func (w *Watcher) syncGossip() { - peers := PeerAddrs() - if len(peers) == 0 { - return + // Taken before the peer check: a replica with no seed peers still receives + // pushes, and that is the only thing that ever changes its log. Returning + // early on an empty peer list would leave its entries cache empty forever. + pushedIn := w.pendingReconcile.Swap(false) + + pulled := 0 + if peers := PeerAddrs(); len(peers) > 0 { + pulled = Run(w.knoxDB, w.metrics, peers) } - pulled := Run(w.knoxDB, w.metrics, peers) - - // A pull only appends to the observation log; the entries cache and - // auto-threads are derived state that reconcile rebuilds. Comparing entry - // counts can never trigger this (pushes/pulls never touch entries directly), - // so reconcile fires on the sweep's newly-inserted observation count. // Reconcile when this sweep changed the log, in either direction: a pull - // inserts rows here, a peer's push inserted them in the HTTP handler. - pushedIn := w.pendingReconcile.Swap(false) + // inserts rows here, a peer's push inserted them in the HTTP handler. The + // entries cache and auto-threads are derived state that reconcile rebuilds. if pulled > 0 || pushedIn { created, linked, err := Reconcile(w.knoxDB) if err != nil {