Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async propagation polishing #4921

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
butonic marked this conversation as resolved.
Show resolved Hide resolved
}

// 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
Loading