diff --git a/cmd/frostfs-node/cache.go b/cmd/frostfs-node/cache.go index f8266e56..6a5d5d18 100644 --- a/cmd/frostfs-node/cache.go +++ b/cmd/frostfs-node/cache.go @@ -165,8 +165,7 @@ func newCachedContainerStorage(v container.Source, ttl time.Duration) ttlContain func (s ttlContainerStorage) handleRemoval(cnr cid.ID) { s.containerCache.set(cnr, nil, new(apistatus.ContainerNotFound)) - // The removal causes the cache miss and thus deletion info (that contains - // ownerID and epoch) for the container will be updated from sidechain. + // The removal invalidates possibly stored error response. s.delInfoCache.remove(cnr) } diff --git a/cmd/frostfs-node/container.go b/cmd/frostfs-node/container.go index 8c2ae54b..5d88ff9e 100644 --- a/cmd/frostfs-node/container.go +++ b/cmd/frostfs-node/container.go @@ -28,7 +28,6 @@ import ( containerMorph "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/container/morph" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" apiClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" - apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" @@ -133,7 +132,6 @@ func configureEACLAndContainerSources(c *cfg, client *cntClient.Client, cnrSrc c if err == nil { cachedContainerLister.update(cnr.Value.Owner(), ev.ID, true) cachedContainerStorage.containerCache.set(ev.ID, cnr, nil) - cachedContainerStorage.delInfoCache.set(ev.ID, nil, new(apistatus.ContainerNotFound)) } else { // unlike removal, we expect successful receive of the container // after successful creation, so logging can be useful diff --git a/internal/logs/logs.go b/internal/logs/logs.go index b826ae08..95961cd4 100644 --- a/internal/logs/logs.go +++ b/internal/logs/logs.go @@ -42,6 +42,7 @@ const ( NotificatorNotificatorStartProcessingObjectNotifications = "notificator: start processing object notifications" NotificatorNotificatorProcessingObjectNotification = "notificator: processing object notification" PolicerCouldNotGetContainer = "could not get container" + PolicerCouldNotConfirmContainerRemoval = "could not confirm container removal" PolicerCouldNotInhumeObjectWithMissingContainer = "could not inhume object with missing container" PolicerCouldNotBuildPlacementVectorForObject = "could not build placement vector for object" PolicerRedundantLocalObjectCopyDetected = "redundant local object copy detected" diff --git a/pkg/core/container/util.go b/pkg/core/container/util.go index 58ceb03b..98919284 100644 --- a/pkg/core/container/util.go +++ b/pkg/core/container/util.go @@ -7,9 +7,9 @@ import ( cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" ) -// EverExisted checks whether the container ever existed or +// WasRemoved checks whether the container ever existed or // it just has not been created yet at the current epoch. -func EverExisted(s Source, cid cid.ID) (bool, error) { +func WasRemoved(s Source, cid cid.ID) (bool, error) { _, err := s.DeletionInfo(cid) if err == nil { return true, nil diff --git a/pkg/morph/client/container/deletion_info.go b/pkg/morph/client/container/deletion_info.go index b34ec32d..40eb267d 100644 --- a/pkg/morph/client/container/deletion_info.go +++ b/pkg/morph/client/container/deletion_info.go @@ -20,10 +20,6 @@ type deletionInfo interface { DeletionInfo(cid []byte) (*containercore.DelInfo, error) } -func AsContainerSpecInfoProvider(w *Client) containercore.Source { - return (*containerSource)(w) -} - func DeletionInfo(c deletionInfo, cnr cid.ID) (*containercore.DelInfo, error) { binCnr := make([]byte, sha256.Size) cnr.Encode(binCnr) diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index 800ddb00..bc82b144 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -5,6 +5,7 @@ import ( "errors" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" + containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container" objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/replicator" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" @@ -27,12 +28,20 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add zap.String("error", err.Error()), ) if client.IsErrContainerNotFound(err) { - err := p.buryFn(ctx, addrWithType.Address) + existed, err := containercore.WasRemoved(p.cnrSrc, idCnr) if err != nil { - p.log.Error(logs.PolicerCouldNotInhumeObjectWithMissingContainer, + p.log.Error(logs.PolicerCouldNotConfirmContainerRemoval, zap.Stringer("cid", idCnr), zap.Stringer("oid", idObj), zap.String("error", err.Error())) + } else if existed { + err := p.buryFn(ctx, addrWithType.Address) + if err != nil { + p.log.Error(logs.PolicerCouldNotInhumeObjectWithMissingContainer, + zap.Stringer("cid", idCnr), + zap.Stringer("oid", idObj), + zap.String("error", err.Error())) + } } } diff --git a/pkg/services/tree/sync.go b/pkg/services/tree/sync.go index c681bb07..9cff8b35 100644 --- a/pkg/services/tree/sync.go +++ b/pkg/services/tree/sync.go @@ -454,7 +454,7 @@ func (s *Service) removeContainers(ctx context.Context, newContainers map[cid.ID continue } - existed, err := containerCore.EverExisted(s.cnrSource, cnr) + existed, err := containerCore.WasRemoved(s.cnrSource, cnr) if err != nil { s.log.Error(logs.TreeCouldNotCheckIfContainerExisted, zap.Stringer("cid", cnr),