From 3bb5a320d737790b2f5b851cfaf39c61732fe1b2 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 15 Dec 2022 15:15:43 +0300 Subject: [PATCH] [#2154] services/tree: Do not log an error when synchronizing container of 1 node Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 1 + pkg/services/tree/sync.go | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 995f4941e..3cc38e4b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ Changelog for NeoFS Node - Incomplete object put errors do contain the deepest error's message (#2092) - Prioritize internal addresses for clients (#2156) - Force object removal via control service (#2145) +- Synchronizing a tree now longer reports an error for a single-node container (#2154) ### Removed - `-g` option from `neofs-cli control ...` and `neofs-cli container create` commands (#2089) diff --git a/pkg/services/tree/sync.go b/pkg/services/tree/sync.go index 896dea557..d14b4c540 100644 --- a/pkg/services/tree/sync.go +++ b/pkg/services/tree/sync.go @@ -21,7 +21,6 @@ import ( // ErrNotInContainer is returned when operation could not be performed // because the node is not included in the container. var ErrNotInContainer = errors.New("node is not in container") -var errNoOtherNodes = errors.New("no nodes to fetch trees from") // SynchronizeAllTrees synchronizes all the trees of the container. It fetches // tree IDs from the other container nodes. Returns ErrNotInContainer if the node @@ -43,7 +42,7 @@ func (s *Service) SynchronizeAllTrees(ctx context.Context, cid cid.ID) error { nodes = randomizeNodeOrder(nodes, pos) if len(nodes) == 0 { - return errNoOtherNodes + return nil } rawCID := make([]byte, sha256.Size) @@ -112,7 +111,7 @@ func (s *Service) SynchronizeTree(ctx context.Context, cid cid.ID, treeID string nodes = randomizeNodeOrder(nodes, pos) if len(nodes) == 0 { - return errNoOtherNodes + return nil } return s.synchronizeTree(ctx, d, treeID, nodes)