Skip to content

StreamPathsLexicographically: one-level glob (dir/*) walks the entire subtree instead of pruning #338

Description

@iamjoemccormick

StreamPathsLexicographically applies the glob only at emit time but recurses into every subdirectory unconditionally. There's no prefix prune, so a non-recursive pattern like dir/* still readDirs every directory beneath dir, then discards the deep entries because * doesn't cross /.

Concretely, beegfs remote push /mnt/beegfs/* correctly uploads only the mount root's direct children, but to do so it stats/reads every directory in the whole mount.

Impact: wasted I/O on large mounts for RST push/pull globs. Correctness is fine. The index path is unaffected (it uses GlobMatchDirs → doublestar.GlobWalk, which prunes).
Suggested fix: before recursing at walk.go:263, skip a subdirectory when the pattern can't match anything beneath it — e.g. when the pattern contains no ** and the candidate's depth already exceeds the pattern's segment count. (Patterns containing ** must still recurse fully.)

Metadata

Metadata

Assignees

Labels

performance-optimizationIssues related to enhancing the efficiency, speed, and overall performance of existing code.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions