Skip to content

Commit

Permalink
async propagation polishing
Browse files Browse the repository at this point in the history
decrease noise

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

use more robust space root check

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

add changelog

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

fix typo

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

revert import reordering

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Nov 20, 2024
1 parent 4f31fd9 commit 4da5203
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/propagation-polishing.md
Original file line number Diff line number Diff line change
@@ -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

3 changes: 1 addition & 2 deletions pkg/storage/utils/decomposedfs/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/storage/utils/decomposedfs/tree/propagator/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 4da5203

Please sign in to comment.