Skip to content

Commit

Permalink
Merge pull request #4921 from butonic/dasync-propagation-polishing
Browse files Browse the repository at this point in the history
async propagation polishing
  • Loading branch information
butonic authored Nov 21, 2024
2 parents c486f05 + 4da5203 commit d2f84b6
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 d2f84b6

Please sign in to comment.