mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
lib/backup: remove logging duplicate path values in a single error message
This commit is contained in:
parent
6910b1de2e
commit
dc890ab80c
3 changed files with 5 additions and 5 deletions
|
@ -45,7 +45,7 @@ func fsync(path string) error {
|
||||||
func AppendFiles(dst []string, dir string) ([]string, error) {
|
func AppendFiles(dst []string, dir string) ([]string, error) {
|
||||||
d, err := os.Open(dir)
|
d, err := os.Open(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot open %q: %w", dir, err)
|
return nil, fmt.Errorf("cannot open directory: %w", err)
|
||||||
}
|
}
|
||||||
dst, err = appendFilesInternal(dst, d)
|
dst, err = appendFilesInternal(dst, d)
|
||||||
if err1 := d.Close(); err1 != nil {
|
if err1 := d.Close(); err1 != nil {
|
||||||
|
|
|
@ -159,7 +159,7 @@ func (fs *FS) DeletePath(path string) (uint64, error) {
|
||||||
// The file could be deleted earlier via symlink.
|
// The file could be deleted earlier via symlink.
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
return 0, fmt.Errorf("cannot open %q at %q: %w", path, fullPath, err)
|
return 0, fmt.Errorf("cannot open %q: %w", path, err)
|
||||||
}
|
}
|
||||||
fi, err := f.Stat()
|
fi, err := f.Stat()
|
||||||
_ = f.Close()
|
_ = f.Close()
|
||||||
|
|
|
@ -107,12 +107,12 @@ func (fs *FS) CopyPart(srcFS common.OriginFS, p common.Part) error {
|
||||||
// Cannot create hardlink. Just copy file contents
|
// Cannot create hardlink. Just copy file contents
|
||||||
srcFile, err := os.Open(srcPath)
|
srcFile, err := os.Open(srcPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot open file %q: %w", srcPath, err)
|
return fmt.Errorf("cannot open source file: %w", err)
|
||||||
}
|
}
|
||||||
dstFile, err := os.Create(dstPath)
|
dstFile, err := os.Create(dstPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = srcFile.Close()
|
_ = srcFile.Close()
|
||||||
return fmt.Errorf("cannot create file %q: %w", dstPath, err)
|
return fmt.Errorf("cannot create destination file: %w", err)
|
||||||
}
|
}
|
||||||
n, err := io.Copy(dstFile, srcFile)
|
n, err := io.Copy(dstFile, srcFile)
|
||||||
if err1 := dstFile.Close(); err1 != nil {
|
if err1 := dstFile.Close(); err1 != nil {
|
||||||
|
@ -141,7 +141,7 @@ func (fs *FS) DownloadPart(p common.Part, w io.Writer) error {
|
||||||
path := fs.path(p)
|
path := fs.path(p)
|
||||||
r, err := os.Open(path)
|
r, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot open %q: %w", path, err)
|
return err
|
||||||
}
|
}
|
||||||
n, err := io.Copy(w, r)
|
n, err := io.Copy(w, r)
|
||||||
if err1 := r.Close(); err1 != nil && err == nil {
|
if err1 := r.Close(); err1 != nil && err == nil {
|
||||||
|
|
Loading…
Reference in a new issue