Browse Source

Merge pull request #2643 from kmlebedev/graceful_volume_stop

pull/2646/head
Chris Lu 3 years ago
committed by GitHub
parent
commit
1b7fb3ce84
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      weed/storage/store_vacuum.go

3
weed/storage/store_vacuum.go

@ -26,6 +26,9 @@ func (s *Store) CompactVolume(vid needle.VolumeId, preallocate int64, compaction
return fmt.Errorf("volume id %d is not found during compact", vid) return fmt.Errorf("volume id %d is not found during compact", vid)
} }
func (s *Store) CommitCompactVolume(vid needle.VolumeId) (bool, error) { func (s *Store) CommitCompactVolume(vid needle.VolumeId) (bool, error) {
if s.isStopping {
return false, fmt.Errorf("volume id %d skips compact because volume is stopping", vid)
}
if v := s.findVolume(vid); v != nil { if v := s.findVolume(vid); v != nil {
return v.IsReadOnly(), v.CommitCompact() return v.IsReadOnly(), v.CommitCompact()
} }

Loading…
Cancel
Save