aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume.go
diff options
context:
space:
mode:
authorBai Jie <2063169+bai-jie@users.noreply.github.com>2023-06-18 15:13:40 +0800
committerGitHub <noreply@github.com>2023-06-18 00:13:40 -0700
commit44b9d72ef0ac883d382a54cd7a188e3c20870db8 (patch)
tree133ee3f7d998c47d332fcd0414b3bf529ac5c4bf /weed/storage/volume.go
parent572cc440ce50eef590fd9d2de536e6ec5ed4b34d (diff)
downloadseaweedfs-44b9d72ef0ac883d382a54cd7a188e3c20870db8.tar.xz
seaweedfs-44b9d72ef0ac883d382a54cd7a188e3c20870db8.zip
doIsEmpty() return error if v.DataBackend is nil (#4587)
Diffstat (limited to 'weed/storage/volume.go')
-rw-r--r--weed/storage/volume.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 81c466f8f..b1f5e6c12 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -134,16 +134,20 @@ func (v *Volume) ContentSize() uint64 {
}
func (v *Volume) doIsEmpty() (bool, error) {
- if v.DataBackend != nil {
+ // check v.DataBackend.GetStat()
+ if v.DataBackend == nil {
+ return false, fmt.Errorf("v.DataBackend is nil")
+ } else {
datFileSize, _, e := v.DataBackend.GetStat()
if e != nil {
glog.V(0).Infof("Failed to read file size %s %v", v.DataBackend.Name(), e)
- return false, e
+ return false, fmt.Errorf("v.DataBackend.GetStat(): %v", e)
}
if datFileSize > super_block.SuperBlockSize {
return false, nil
}
}
+ // check v.nm.ContentSize()
if v.nm != nil {
if v.nm.ContentSize() > 0 {
return false, nil