Browse Source

Fix DataBackend nil pointer (#4641)

pull/4651/head
wusong 1 year ago
committed by GitHub
parent
commit
61553beba2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      weed/storage/store_vacuum.go

5
weed/storage/store_vacuum.go

@ -33,7 +33,10 @@ func (s *Store) CommitCompactVolume(vid needle.VolumeId) (bool, int64, error) {
if v := s.findVolume(vid); v != nil { if v := s.findVolume(vid); v != nil {
isReadOnly := v.IsReadOnly() isReadOnly := v.IsReadOnly()
err := v.CommitCompact() err := v.CommitCompact()
volumeSize, _, _ := v.DataBackend.GetStat()
var volumeSize int64 = 0
if err == nil && v.DataBackend != nil {
volumeSize, _, _ = v.DataBackend.GetStat()
}
return isReadOnly, volumeSize, err return isReadOnly, volumeSize, err
} }
return false, 0, fmt.Errorf("volume id %d is not found during commit compact", vid) return false, 0, fmt.Errorf("volume id %d is not found during commit compact", vid)

Loading…
Cancel
Save