diff options
| author | wusong <75450248+wusongANKANG@users.noreply.github.com> | 2023-07-05 14:22:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-04 23:22:10 -0700 |
| commit | 61553beba280d75f6676a57c2be41b57f519823c (patch) | |
| tree | 7e9ca6402f614473a290302a5a02f897c7474990 | |
| parent | a315490f7d4d2aa8b5226ea4029cb112edb88137 (diff) | |
| download | seaweedfs-61553beba280d75f6676a57c2be41b57f519823c.tar.xz seaweedfs-61553beba280d75f6676a57c2be41b57f519823c.zip | |
Fix DataBackend nil pointer (#4641)
| -rw-r--r-- | weed/storage/store_vacuum.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/storage/store_vacuum.go b/weed/storage/store_vacuum.go index 26cd370a4..531d859b8 100644 --- a/weed/storage/store_vacuum.go +++ b/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 { isReadOnly := v.IsReadOnly() 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 false, 0, fmt.Errorf("volume id %d is not found during commit compact", vid) |
