Skip to content

Commit

Permalink
Suppress duplicate notifications at update granularity
Browse files Browse the repository at this point in the history
Change duplicate suppression for a non-atomic notification to fail on individual
updates when multiple are present, instead of failing the whole notification early on a
single bad update.
  1) Prevents accrual of stale leaves due to a single duplicate update failing the whole
     notification (remaining updates not processed).
  2) Allows deletes to independently complete when duplicate updates are present.
  3) Avoids errant implicit deletions, since some updates (including duplicates) will no
     longer be stale due to #1.

Increase test coverage for interaction between updates/deletes/stale leaves and suppression.

PiperOrigin-RevId: 258587893
  • Loading branch information
mkhsueh committed Aug 23, 2019
1 parent 52dcbf2 commit 69c8afb
Show file tree
Hide file tree
Showing 8 changed files with 324 additions and 1,343 deletions.
7 changes: 5 additions & 2 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/openconfig/gnmi/client"
"github.com/openconfig/gnmi/ctree"
"github.com/openconfig/gnmi/errlist"
"github.com/openconfig/gnmi/metadata"
"github.com/openconfig/gnmi/path"
"github.com/openconfig/gnmi/value"
Expand Down Expand Up @@ -343,12 +344,14 @@ func (t *Target) GnmiUpdate(n *gpb.Notification) error {
n.Update = updates
n.Delete = deletes
}()
errs := &errlist.List{}
for _, u := range updates {
noti := proto.Clone(n).(*gpb.Notification)
noti.Update = []*gpb.Update{u}
nd, err := t.gnmiUpdate(noti)
if err != nil {
return err
errs.Add(err)
continue
}
t.meta.AddInt(metadata.UpdateCount, 1)
if nd != nil {
Expand All @@ -365,7 +368,7 @@ func (t *Target) GnmiUpdate(n *gpb.Notification) error {
}
}

return nil
return errs.Err()
}

func (t *Target) checkTimestamp(ts time.Time) {
Expand Down
Loading

0 comments on commit 69c8afb

Please sign in to comment.