[#98] fstree: Do not fail iteration over just removed files
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
A directory is read and files are saved to a local variable. The iteration
over such files may lead to a non-existing files reading due to a normal SN
operation cycle and, therefore, may lead to a returning the OS error to a
caller. Skip just removed (or lost) files as the golang std library does in
similar situations:
5f1a0320b9/src/os/dir_unix.go (L128-L133)
.
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
49234b915e
commit
da8da1c63a
2 changed files with 7 additions and 3 deletions
|
@ -50,6 +50,7 @@ Changelog for FrostFS Node
|
||||||
- Actually use `object.put.pool_size_local` and independent pool for local puts (#64).
|
- Actually use `object.put.pool_size_local` and independent pool for local puts (#64).
|
||||||
- Pretty printer of basic ACL in the NeoFS CLI (#2259)
|
- Pretty printer of basic ACL in the NeoFS CLI (#2259)
|
||||||
- Adding of public key for nns group `group.frostfs` at init step (#130)
|
- Adding of public key for nns group `group.frostfs` at init step (#130)
|
||||||
|
- Iterating over just removed files by FSTree (#98)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
### Updated
|
### Updated
|
||||||
|
|
|
@ -135,13 +135,16 @@ func (t *FSTree) iterate(depth uint64, curPath []string, prm common.IteratePrm)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data, err := os.ReadFile(filepath.Join(curPath...))
|
||||||
|
if err != nil && os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if prm.LazyHandler != nil {
|
if prm.LazyHandler != nil {
|
||||||
err = prm.LazyHandler(addr, func() ([]byte, error) {
|
err = prm.LazyHandler(addr, func() ([]byte, error) {
|
||||||
return os.ReadFile(filepath.Join(curPath...))
|
return data, err
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
var data []byte
|
|
||||||
data, err = os.ReadFile(filepath.Join(curPath...))
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
data, err = t.Decompress(data)
|
data, err = t.Decompress(data)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue