diff options
| author | chrislu <chris.lu@gmail.com> | 2022-05-29 16:59:30 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-05-29 16:59:30 -0700 |
| commit | 81d615929068878ed5dd5d0b8c555c64b4cda1ed (patch) | |
| tree | 88f1f619a5468d30feeca2f8b968637753242db3 | |
| parent | ca16fbf0ef7acfae48a4dedb17bd4d9f2491052e (diff) | |
| download | seaweedfs-81d615929068878ed5dd5d0b8c555c64b4cda1ed.tar.xz seaweedfs-81d615929068878ed5dd5d0b8c555c64b4cda1ed.zip | |
volume: report error if a volume has nil data backend
fix https://github.com/chrislusf/seaweedfs/issues/3105
| -rw-r--r-- | weed/storage/volume_vacuum.go | 3 |
1 files changed, 3 insertions, 0 deletions
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) } |
