Skip to content

Commit d6a5ff6

Browse files
rastislavsjoestringer
authored andcommitted
bgp: Use changes iterator for triggering BGP CP events
In CI we saw a very occasional flake where BGP CP reconciliation is missed upon a service delete. Let's use this way of table tracking to see if this makes the flake to go away. Signed-off-by: Rastislav Szabo <rastislav.szabo@isovalent.com>
1 parent ebc3230 commit d6a5ff6

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

pkg/bgpv1/manager/reconcilerv2/service.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,25 @@ func (r *ServiceReconciler) processFrontendEvents(ctx context.Context, _ cell.He
100100
defer limiter.Stop()
101101

102102
// watch for changes in the frontends table
103-
_, watch := r.frontends.AllWatch(r.db.ReadTxn())
103+
wtxn := r.db.WriteTxn(r.frontends)
104+
changeIter, err := r.frontends.Changes(wtxn)
105+
if err != nil {
106+
wtxn.Abort()
107+
return err
108+
}
109+
wtxn.Commit()
104110

105111
for {
112+
changes, watch := changeIter.Next(r.db.ReadTxn())
113+
signal := false
114+
for range changes {
115+
signal = true // do not break, always consume all changes
116+
}
117+
if signal {
118+
r.signaler.Event(struct{}{}) // signal BGP CP
119+
}
106120
select {
107121
case <-watch:
108-
// re-start the watch and emit reconciliation event
109-
_, watch = r.frontends.AllWatch(r.db.ReadTxn())
110-
r.signaler.Event(struct{}{})
111122
case <-ctx.Done():
112123
return ctx.Err()
113124
}

0 commit comments

Comments
 (0)