diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e1cb1baba..7abe55ff34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Changelog for NeoFS Node - The parent of the split object is not removed from the metabase (#3089) - A split expired object is not deleted after the lock is removed or expired (#3089) - `neofs_node_engine_list_containers_time_bucket` and `neofs_node_engine_exists_time_bucket` metrics (#3014) +- `neofs_node_engine_list_objects_time_bucket` metric (#3120) ### Changed - Number of cuncurrenly handled notifications from the chain was increased from 10 to 300 for IR (#3068) diff --git a/pkg/local_object_storage/engine/list.go b/pkg/local_object_storage/engine/list.go index 000c426777..40f0e73306 100644 --- a/pkg/local_object_storage/engine/list.go +++ b/pkg/local_object_storage/engine/list.go @@ -28,6 +28,10 @@ type Cursor struct { // Returns ErrEndOfListing if there are no more objects to return or count // parameter set to zero. func (e *StorageEngine) ListWithCursor(count uint32, cursor *Cursor) ([]objectcore.AddressWithType, *Cursor, error) { + if e.metrics != nil { + defer elapsed(e.metrics.AddListObjectsDuration)() + } + result := make([]objectcore.AddressWithType, 0, count) // 1. Get available shards and sort them. diff --git a/pkg/local_object_storage/engine/select.go b/pkg/local_object_storage/engine/select.go index 3c4572a187..1b63a1a068 100644 --- a/pkg/local_object_storage/engine/select.go +++ b/pkg/local_object_storage/engine/select.go @@ -49,46 +49,3 @@ func (e *StorageEngine) Select(cnr cid.ID, filters object.SearchFilters) ([]oid. return addrList, nil } - -// List returns `limit` available physically storage object addresses in engine. -// If limit is zero, then returns all available object addresses. -// -// Returns an error if executions are blocked (see BlockExecution). -func (e *StorageEngine) List(limit uint64) ([]oid.Address, error) { - if e.metrics != nil { - defer elapsed(e.metrics.AddListObjectsDuration)() - } - - e.blockMtx.RLock() - defer e.blockMtx.RUnlock() - - if e.blockErr != nil { - return nil, e.blockErr - } - - addrList := make([]oid.Address, 0, limit) - uniqueMap := make(map[string]struct{}) - ln := uint64(0) - - // consider iterating over shuffled shards - for _, sh := range e.unsortedShards() { - res, err := sh.List() // consider limit result of shard iterator - if err != nil { - e.reportShardError(sh, "could not select objects from shard", err) - continue - } - for _, addr := range res { // save only unique values - if _, ok := uniqueMap[addr.EncodeToString()]; !ok { - uniqueMap[addr.EncodeToString()] = struct{}{} - addrList = append(addrList, addr) - - ln++ - if limit > 0 && ln >= limit { - return addrList, nil - } - } - } - } - - return addrList, nil -}