removes FileSize from backup part key (#1872)

* removes FileSize from backup part key
it should fix download restoration for backups

* Update lib/backup/common/part.go

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
This commit is contained in:
Nikolay 2021-12-01 12:01:28 +03:00 committed by GitHub
parent 5881c4ae48
commit 06eff5a72c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View file

@ -133,9 +133,6 @@ func (r *Restore) Run() error {
}
deleteSize += size
}
if err != nil {
return err
}
if err := dst.RemoveEmptyDirs(); err != nil {
return fmt.Errorf("cannot remove empty directories at %s: %w", dst, err)
}

View file

@ -34,7 +34,8 @@ type Part struct {
}
func (p *Part) key() string {
return fmt.Sprintf("%s%016X%016X%016X%016X", p.Path, p.FileSize, p.Offset, p.Size, p.ActualSize)
// Do not use p.FileSize in the key, since it cannot be properly initialized when resuming the restore for partially restored file
return fmt.Sprintf("%s%016X%016X%016X", p.Path, p.Offset, p.Size, p.ActualSize)
}
// String returns human-readable representation of the part.