aboutsummaryrefslogtreecommitdiff
path: root/weed/storage
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage')
-rw-r--r--weed/storage/store.go6
-rw-r--r--weed/storage/volume.go3
2 files changed, 5 insertions, 4 deletions
diff --git a/weed/storage/store.go b/weed/storage/store.go
index cfc409c39..43d4595bf 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -509,12 +509,12 @@ func (s *Store) UnmountVolume(i needle.VolumeId) error {
func (s *Store) DeleteVolume(i needle.VolumeId, onlyEmpty bool) error {
v := s.findVolume(i)
- if onlyEmpty && !v.IsEmpty() {
- return fmt.Errorf("delete volume %d not empty", i)
- }
if v == nil {
return fmt.Errorf("delete volume %d not found on disk", i)
}
+ if onlyEmpty && !v.IsEmpty() {
+ return fmt.Errorf("delete volume %d not empty", i)
+ }
message := master_pb.VolumeShortInformationMessage{
Id: uint32(v.Id),
Collection: v.Collection,
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 31960451c..066f06604 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -333,5 +333,6 @@ func (v *Volume) IsReadOnly() bool {
return v.noWriteOrDelete || v.noWriteCanDelete || v.location.isDiskSpaceLow
}
func (v *Volume) IsEmpty() bool {
- return v.ContentSize() == 0
+ size, _, _ := v.DataBackend.GetStat()
+ return size <= 8 && v.ContentSize() == 0
}