lint and review changes

Log an error in the probably-irrelevant case where we ended up with
a file, but Stat failed, which shouldn't ever happen we hope anyway.

Also explicitly discard the status from RemapRoaringStorage in a case
where we don't care.
This commit is contained in:
Seebs 2020-02-07 11:43:10 -06:00 committed by Matt Jaffee
parent cb686dcad0
commit 337e451cc7
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -296,6 +296,9 @@ func (f *fragment) applyStorage(data []byte, file *os.File, newGen generation, m
if len(data) == 0 {
if file != nil {
fi, err := file.Stat()
if err != nil {
f.Logger.Printf("trying to apply new storage to existing bitmap, stat failed: %v", err)
}
if err == nil && fi != nil && fi.Size() == 0 {
return f.emptyStorage(file)
}
@ -305,7 +308,7 @@ func (f *fragment) applyStorage(data []byte, file *os.File, newGen generation, m
// our containers to use that storage *to take advantage of
// mmap*, we'll just make sure our containers aren't pointing to
// old storage and say "nope".
f.storage.RemapRoaringStorage(nil)
_, _ = f.storage.RemapRoaringStorage(nil)
f.storage.SetSource(nil)
return false, nil
}