diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-25 13:26:45 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-27 16:00:54 +0900 |
commit | aa5a11501251da31a542553c0abcb81d5857b924 (patch) | |
tree | bb1dca2a3f408211532532d664b36002ca8a8ffd /table/table_manager.go | |
parent | 6faa02f93c91022420bd53631973a96ed5938f2a (diff) |
table: avoid cloning path for withdraw
when a peer having lots of routes goes down, the cloning paths consume
too much memory.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table_manager.go')
-rw-r--r-- | table/table_manager.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/table/table_manager.go b/table/table_manager.go index 32531056..3060dda0 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -185,7 +185,7 @@ func (manager *TableManager) DeleteVrf(name string) ([]*Path, error) { return msgs, nil } -func (manager *TableManager) calculate(ids []string, destinations []*Destination) (map[string][]*Path, map[string][]*Path, [][]*Path) { +func (manager *TableManager) calculate(ids []string, destinations []*Destination, peerDown bool) (map[string][]*Path, map[string][]*Path, [][]*Path) { best := make(map[string][]*Path, len(ids)) old := make(map[string][]*Path, len(ids)) @@ -200,7 +200,7 @@ func (manager *TableManager) calculate(ids []string, destinations []*Destination "Topic": "table", "Key": dst.GetNlri().String(), }).Debug("Processing destination") - paths, olds, m := dst.Calculate(ids) + paths, olds, m := dst.Calculate(ids, peerDown) for id, path := range paths { best[id] = append(best[id], path) old[id] = append(old[id], olds[id]) @@ -224,7 +224,7 @@ func (manager *TableManager) calculate(ids []string, destinations []*Destination func (manager *TableManager) DeletePathsByPeer(ids []string, info *PeerInfo, rf bgp.RouteFamily) (map[string][]*Path, map[string][]*Path, [][]*Path) { if t, ok := manager.Tables[rf]; ok { dsts := t.DeleteDestByPeer(info) - return manager.calculate(ids, dsts) + return manager.calculate(ids, dsts, true) } return nil, nil, nil } @@ -255,7 +255,7 @@ func (manager *TableManager) ProcessPaths(ids []string, pathList []*Path) (map[s } } } - return manager.calculate(ids, dsts) + return manager.calculate(ids, dsts, false) } // EVPN MAC MOBILITY HANDLING |