Skip to content

Commit 94bcf89

Browse files
committed
Eliminate warning about endpoint count store delete
Commit 380ded6 restored a now-unused endpoint count to the store, so that when the daemon is downgraded it exists for the old code to find. But, on network deletion, the endpoint count was not loaded from the store - so the delete code saw the wrong "index", and logged a warning before deleting it anyway. Use DeleteObject instead of DeleteObjectAtomic, so the old index isn't checked. Signed-off-by: Rob Murray <[email protected]>
1 parent 42233dd commit 94bcf89

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

daemon/libnetwork/network.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,18 +1109,17 @@ func (n *Network) delete(force bool, rmLBEndpoint bool) error {
11091109
}
11101110

11111111
removeFromStore:
1112-
// deleteFromStore performs an atomic delete operation and the
1113-
// Network.epCnt will help prevent any possible
1114-
// race between endpoint join and network delete
1115-
//
11161112
// TODO(robmry) - remove this once downgrade past 28.1.0 is no longer supported.
11171113
// The endpoint count is no longer used, it's created in the store to make
11181114
// downgrade work, versions older than 28.1.0 expect to read it and error if they
1119-
// can't. The stored count is not maintained, so the downgraded version will
1120-
// always find it's zero (which is usually correct because the daemon had
1121-
// stopped), but older daemons fix it on startup anyway.
1122-
if err = c.deleteFromStore(&endpointCnt{n: n}); err != nil {
1123-
log.G(context.TODO()).Debugf("Error deleting endpoint count from store for stale network %s (%s) for deletion: %v", n.Name(), n.ID(), err)
1115+
// can't.
1116+
if err := c.store.DeleteObject(&endpointCnt{n: n}); err != nil {
1117+
if !errors.Is(err, datastore.ErrKeyNotFound) {
1118+
log.G(context.TODO()).WithFields(log.Fields{
1119+
"network": n.name,
1120+
"error": err,
1121+
}).Debug("Error deleting network endpoint count from store")
1122+
}
11241123
}
11251124

11261125
if err = c.deleteStoredNetwork(n); err != nil {

0 commit comments

Comments
 (0)