diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-02-07 20:16:15 +0500 |
|---|---|---|
| committer | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-02-07 20:16:15 +0500 |
| commit | fb97e234c9f4c0f14c1075b775bd0db94b13af78 (patch) | |
| tree | 339fd5325955c3988a72746ede2a8661c0d05f57 | |
| parent | 433fde4b186a8244aabeb8659bb901a89b56e213 (diff) | |
| download | seaweedfs-fb97e234c9f4c0f14c1075b775bd0db94b13af78.tar.xz seaweedfs-fb97e234c9f4c0f14c1075b775bd0db94b13af78.zip | |
skips compact if store is stopping
| -rw-r--r-- | weed/storage/store_vacuum.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/weed/storage/store_vacuum.go b/weed/storage/store_vacuum.go index 0d6e0b0f1..cbd716b32 100644 --- a/weed/storage/store_vacuum.go +++ b/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) } 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 { return v.IsReadOnly(), v.CommitCompact() } |
