From 4da5203580cb71312bc589755051afb6dcc0663f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 8 Nov 2024 09:44:19 +0100 Subject: [PATCH] async propagation polishing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit decrease noise Signed-off-by: Jörn Friedrich Dreyer use more robust space root check Signed-off-by: Jörn Friedrich Dreyer add changelog Signed-off-by: Jörn Friedrich Dreyer fix typo Signed-off-by: Jörn Friedrich Dreyer revert import reordering Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/propagation-polishing.md | 6 ++++++ pkg/storage/utils/decomposedfs/node/node.go | 3 +-- pkg/storage/utils/decomposedfs/tree/propagator/async.go | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelog/unreleased/propagation-polishing.md diff --git a/changelog/unreleased/propagation-polishing.md b/changelog/unreleased/propagation-polishing.md new file mode 100644 index 0000000000..c5efcedef2 --- /dev/null +++ b/changelog/unreleased/propagation-polishing.md @@ -0,0 +1,6 @@ +Enhancement: polish propagation related code + +We polished some corner cases for propagation that reduce log messages in normal operation. + +https://github.com/cs3org/reva/pull/4921 + diff --git a/pkg/storage/utils/decomposedfs/node/node.go b/pkg/storage/utils/decomposedfs/node/node.go index 795ce65c0e..0cf113bc8d 100644 --- a/pkg/storage/utils/decomposedfs/node/node.go +++ b/pkg/storage/utils/decomposedfs/node/node.go @@ -1261,8 +1261,7 @@ func (n *Node) ProcessingID(ctx context.Context) (string, error) { // IsSpaceRoot checks if the node is a space root func (n *Node) IsSpaceRoot(ctx context.Context) bool { - _, err := n.Xattr(ctx, prefixes.SpaceNameAttr) - return err == nil + return n.ID == n.SpaceID } // SetScanData sets the virus scan info to the node diff --git a/pkg/storage/utils/decomposedfs/tree/propagator/async.go b/pkg/storage/utils/decomposedfs/tree/propagator/async.go index 2f55b1b99a..14e65dea06 100644 --- a/pkg/storage/utils/decomposedfs/tree/propagator/async.go +++ b/pkg/storage/utils/decomposedfs/tree/propagator/async.go @@ -183,7 +183,7 @@ func (p AsyncPropagator) queuePropagation(ctx context.Context, spaceID, nodeID s ready = true break } - log.Error().Err(err).Msg("failed to write Change to disk (retrying)") + log.Debug().Err(err).Msg("failed to write Change to disk (retrying)") err = os.Mkdir(filepath.Dir(changePath), 0700) triggerPropagation = err == nil || os.IsExist(err) // only the first goroutine, which succeeds to create the directory, is supposed to actually trigger the propagation } @@ -386,7 +386,7 @@ func (p AsyncPropagator) propagate(ctx context.Context, spaceID, nodeID string, // a negative new treesize. Something must have gone wrong with the accounting. // Reset the current treesize to 0. log.Error().Uint64("treeSize", treeSize).Int64("sizeDiff", pc.SizeDiff). - Msg("Error when updating treesize of node. Updated treesize < 0. Reestting to 0") + Msg("Error when updating treesize of node. Updated treesize < 0. Resetting to 0") newSize = 0 default: newSize = treeSize - uint64(-pc.SizeDiff) @@ -414,7 +414,7 @@ func (p AsyncPropagator) propagate(ctx context.Context, spaceID, nodeID string, log.Info().Msg("Propagation done. cleaning up") cleanup() - if !n.IsSpaceRoot(ctx) { // This does not seem robust as it checks the space name property + if !n.IsSpaceRoot(ctx) { p.queuePropagation(ctx, n.SpaceID, n.ParentID, pc, log) }