Skip to content

Commit fbf2fe8

Browse files
robmrythaJeztah
authored andcommitted
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]> (cherry picked from commit 94bcf89) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 252a1eb commit fbf2fe8

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

libnetwork/network.go

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

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

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

0 commit comments

Comments
 (0)