fix: reconcile pushes even when this node has no seed peers (#8)
The sweep returned early on an empty peer list, which is precisely the replica case: dhg.lol configures no peers, receives pushes, and never rebuilt entries. Check for pending pushes before bailing out.
This commit is contained in:
+10
-11
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user