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 Aliaksandr Valialkin
parent bf6eb624f0
commit cf1d2f289b
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
2 changed files with 2 additions and 4 deletions

View file

@ -133,9 +133,6 @@ func (r *Restore) Run() error {
} }
deleteSize += size deleteSize += size
} }
if err != nil {
return err
}
if err := dst.RemoveEmptyDirs(); err != nil { if err := dst.RemoveEmptyDirs(); err != nil {
return fmt.Errorf("cannot remove empty directories at %s: %w", dst, err) 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 { 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. // String returns human-readable representation of the part.