From 81d615929068878ed5dd5d0b8c555c64b4cda1ed Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 29 May 2022 16:59:30 -0700 Subject: [PATCH] volume: report error if a volume has nil data backend fix https://github.com/chrislusf/seaweedfs/issues/3105 --- weed/storage/volume_vacuum.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weed/storage/volume_vacuum.go b/weed/storage/volume_vacuum.go index ac6f8f8d5..1ad468958 100644 --- a/weed/storage/volume_vacuum.go +++ b/weed/storage/volume_vacuum.go @@ -79,6 +79,9 @@ func (v *Volume) Compact2(preallocate int64, compactionBytePerSecond int64, prog v.lastCompactIndexOffset = v.IndexFileSize() v.lastCompactRevision = v.SuperBlock.CompactionRevision glog.V(3).Infof("creating copies for volume %d ...", v.Id) + if v.DataBackend == nil { + return fmt.Errorf("volume %d backend is empty remote:%v", v.Id, v.HasRemoteFile()) + } if err := v.DataBackend.Sync(); err != nil { glog.V(0).Infof("compact2 fail to sync volume dat %d: %v", v.Id, err) }