diff --git a/pkg/local_object_storage/writecache/init.go b/pkg/local_object_storage/writecache/init.go index 5cfa50434d..63cf5ab8b4 100644 --- a/pkg/local_object_storage/writecache/init.go +++ b/pkg/local_object_storage/writecache/init.go @@ -61,18 +61,14 @@ func (c *cache) initFlushMarks() { } func (c *cache) isFlushed(addr oid.Address) bool { - var existsPrm meta.ExistsPrm - existsPrm.SetAddress(addr) + var prm meta.StorageIDPrm + prm.SetAddress(addr) - mRes, err := c.metabase.Exists(existsPrm) + mRes, err := c.metabase.StorageID(prm) if err != nil { - return errors.Is(err, meta.ErrObjectIsExpired) || errors.As(err, new(apistatus.ObjectAlreadyRemoved)) + return errors.Is(err, meta.ErrObjectIsExpired) || errors.As(err, new(apistatus.ObjectAlreadyRemoved)) || errors.Is(err, apistatus.ObjectNotFound{}) } - if !mRes.Exists() { - return false - } - - res, err := c.blobstor.Exists(common.ExistsPrm{Address: addr}) + res, err := c.blobstor.Exists(common.ExistsPrm{Address: addr, StorageID: mRes.StorageID()}) return err == nil && res.Exists } diff --git a/pkg/local_object_storage/writecache/options.go b/pkg/local_object_storage/writecache/options.go index dec5c1b1a6..31f291feec 100644 --- a/pkg/local_object_storage/writecache/options.go +++ b/pkg/local_object_storage/writecache/options.go @@ -17,6 +17,7 @@ type Option func(*options) // meta is an interface for a metabase. type metabase interface { Exists(meta.ExistsPrm) (meta.ExistsRes, error) + StorageID(meta.StorageIDPrm) (meta.StorageIDRes, error) UpdateStorageID(meta.UpdateStorageIDPrm) (meta.UpdateStorageIDRes, error) }