Bug #16425
closed[keepstore] should not scan directories it doesn't write in
Description
Keepstore walks all directories in its mount points, even those it never writes in. This can lead to a situation where keepstore does tons of unnecessary IO (e.g. when .snapshot directories are present, where GPFS makes daily snapshots).
Adding an option to exclude certain directories from what Keep considers would be a good solution.
Updated by Tom Clegg over 4 years ago
When indexing, it looks like we're already skipping dirs that don't conform to keepstore's storage layout: source:services/keepstore/unix_volume.go#L355
var blockDirRe = regexp.MustCompile(`^[0-9a-f]+$`)
var blockFileRe = regexp.MustCompile(`^[0-9a-f]{32}$`)
...
if !blockDirRe.MatchString(names[0]) {
continue
}
...
blockdir, err := v.os.Open(blockdirpath)
However, the "empty trash" goroutine does walk the entire tree.
err := filepath.Walk(v.Root, func(path string, info os.FileInfo, err error) error {
if err != nil {
v.logger.WithError(err).Errorf("EmptyTrash: filepath.Walk(%q) failed", path)
return nil
}
todo <- dirent{path, info}
return nil
})
That walk func should check dirnames and return filepath.SkipDir when appropriate.
Updated by Peter Amstutz over 4 years ago
- Target version changed from To Be Groomed to 2020-06-17 Sprint
- Assigned To set to Tom Clegg
Updated by Tom Clegg over 4 years ago
16425-skip-unused-dirs @ b257b5e4fca36172a79db2fd2cf8ab843cf50d1c -- developer-run-tests: #1915
Updated by Ward Vandewege over 4 years ago
Tom Clegg wrote:
16425-skip-unused-dirs @ b257b5e4fca36172a79db2fd2cf8ab843cf50d1c -- developer-run-tests: #1915
LGTM, thanks!
Updated by Anonymous over 4 years ago
- % Done changed from 0 to 100
- Status changed from In Progress to Resolved
Applied in changeset arvados|2cae80e7746d8fa32df1f819a4a41d29cdc3577a.