forked from TrueCloudLab/frostfs-node
[#1902] engine: Search for the tree IDs in every shard
Iterate over every shard and search for the container's trees. Final result is a concatenation of shards' results. It is considered that one fixed tree is placed on one fixed shard but the different trees of a fixed container could be placed on different shards. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
aa37078570
commit
49c38d642d
1 changed files with 7 additions and 6 deletions
|
@ -183,11 +183,10 @@ func (e *StorageEngine) TreeDrop(cid cidSDK.ID, treeID string) error {
|
||||||
|
|
||||||
// TreeList implements the pilorama.Forest interface.
|
// TreeList implements the pilorama.Forest interface.
|
||||||
func (e *StorageEngine) TreeList(cid cidSDK.ID) ([]string, error) {
|
func (e *StorageEngine) TreeList(cid cidSDK.ID) ([]string, error) {
|
||||||
var ids []string
|
var resIDs []string
|
||||||
var err error
|
|
||||||
|
|
||||||
for _, sh := range e.sortShardsByWeight(cid) {
|
for _, sh := range e.unsortedShards() {
|
||||||
ids, err = sh.TreeList(cid)
|
ids, err := sh.TreeList(cid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, shard.ErrPiloramaDisabled) || errors.Is(err, shard.ErrReadOnlyMode) {
|
if errors.Is(err, shard.ErrPiloramaDisabled) || errors.Is(err, shard.ErrReadOnlyMode) {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -196,11 +195,13 @@ func (e *StorageEngine) TreeList(cid cidSDK.ID) ([]string, error) {
|
||||||
e.reportShardError(sh, "can't perform `TreeList`", err,
|
e.reportShardError(sh, "can't perform `TreeList`", err,
|
||||||
zap.Stringer("cid", cid))
|
zap.Stringer("cid", cid))
|
||||||
|
|
||||||
|
// returns as much info about
|
||||||
|
// trees as possible
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
return ids, nil
|
resIDs = append(resIDs, ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ids, err
|
return resIDs, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue