Skip to content

Commit eb90734

Browse files
Fix neofs_node_engine_list_objects_time_bucket metric (#3120)
2 parents 64dac4c + 87441c3 commit eb90734

File tree

3 files changed

+5
-43
lines changed

3 files changed

+5
-43
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Changelog for NeoFS Node
1919
- The parent of the split object is not removed from the metabase (#3089)
2020
- A split expired object is not deleted after the lock is removed or expired (#3089)
2121
- `neofs_node_engine_list_containers_time_bucket` and `neofs_node_engine_exists_time_bucket` metrics (#3014)
22+
- `neofs_node_engine_list_objects_time_bucket` metric (#3120)
2223

2324
### Changed
2425
- Number of cuncurrenly handled notifications from the chain was increased from 10 to 300 for IR (#3068)

pkg/local_object_storage/engine/list.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ type Cursor struct {
2828
// Returns ErrEndOfListing if there are no more objects to return or count
2929
// parameter set to zero.
3030
func (e *StorageEngine) ListWithCursor(count uint32, cursor *Cursor) ([]objectcore.AddressWithType, *Cursor, error) {
31+
if e.metrics != nil {
32+
defer elapsed(e.metrics.AddListObjectsDuration)()
33+
}
34+
3135
result := make([]objectcore.AddressWithType, 0, count)
3236

3337
// 1. Get available shards and sort them.

pkg/local_object_storage/engine/select.go

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -49,46 +49,3 @@ func (e *StorageEngine) Select(cnr cid.ID, filters object.SearchFilters) ([]oid.
4949

5050
return addrList, nil
5151
}
52-
53-
// List returns `limit` available physically storage object addresses in engine.
54-
// If limit is zero, then returns all available object addresses.
55-
//
56-
// Returns an error if executions are blocked (see BlockExecution).
57-
func (e *StorageEngine) List(limit uint64) ([]oid.Address, error) {
58-
if e.metrics != nil {
59-
defer elapsed(e.metrics.AddListObjectsDuration)()
60-
}
61-
62-
e.blockMtx.RLock()
63-
defer e.blockMtx.RUnlock()
64-
65-
if e.blockErr != nil {
66-
return nil, e.blockErr
67-
}
68-
69-
addrList := make([]oid.Address, 0, limit)
70-
uniqueMap := make(map[string]struct{})
71-
ln := uint64(0)
72-
73-
// consider iterating over shuffled shards
74-
for _, sh := range e.unsortedShards() {
75-
res, err := sh.List() // consider limit result of shard iterator
76-
if err != nil {
77-
e.reportShardError(sh, "could not select objects from shard", err)
78-
continue
79-
}
80-
for _, addr := range res { // save only unique values
81-
if _, ok := uniqueMap[addr.EncodeToString()]; !ok {
82-
uniqueMap[addr.EncodeToString()] = struct{}{}
83-
addrList = append(addrList, addr)
84-
85-
ln++
86-
if limit > 0 && ln >= limit {
87-
return addrList, nil
88-
}
89-
}
90-
}
91-
}
92-
93-
return addrList, nil
94-
}

0 commit comments

Comments
 (0)