diff options
| author | wusong <75450248+wusongANKANG@users.noreply.github.com> | 2023-06-06 01:17:21 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-05 10:17:21 -0700 |
| commit | 26f15d007977bd048c1908d9b2e11d512699b007 (patch) | |
| tree | fc789376e6b554bddd5393fcf0f357c8ab73e83d /weed/storage | |
| parent | fb4b61036cd6389b18efc5343b766b1c5512ad1c (diff) | |
| download | seaweedfs-26f15d007977bd048c1908d9b2e11d512699b007.tar.xz seaweedfs-26f15d007977bd048c1908d9b2e11d512699b007.zip | |
Fix no more writable volumes by delay judgment (#4548)
* fix nomore writables volumes while disk free space is sufficient by time delay
* reset
---------
Co-authored-by: wang wusong <wangwusong@virtaitech.com>
Diffstat (limited to 'weed/storage')
| -rw-r--r-- | weed/storage/store_vacuum.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/weed/storage/store_vacuum.go b/weed/storage/store_vacuum.go index 0f25c888a..26cd370a4 100644 --- a/weed/storage/store_vacuum.go +++ b/weed/storage/store_vacuum.go @@ -2,6 +2,7 @@ package storage import ( "fmt" + "github.com/seaweedfs/seaweedfs/weed/stats" "github.com/seaweedfs/seaweedfs/weed/glog" @@ -25,14 +26,17 @@ 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) { +func (s *Store) CommitCompactVolume(vid needle.VolumeId) (bool, int64, error) { if s.isStopping { - return false, fmt.Errorf("volume id %d skips compact because volume is stopping", vid) + return false, 0, fmt.Errorf("volume id %d skips compact because volume is stopping", vid) } if v := s.findVolume(vid); v != nil { - return v.IsReadOnly(), v.CommitCompact() + isReadOnly := v.IsReadOnly() + err := v.CommitCompact() + volumeSize, _, _ := v.DataBackend.GetStat() + return isReadOnly, volumeSize, err } - return false, 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) } func (s *Store) CommitCleanupVolume(vid needle.VolumeId) error { if v := s.findVolume(vid); v != nil { |
