aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2016-11-26 12:14:06 -0800
committerChris Lu <chris.lu@gmail.com>2016-11-26 12:14:06 -0800
commit9ba52db5858c480cb8cf4125b0d698f188f22ba8 (patch)
tree50ab3ffa83ea4fc345b440b989d159fc3091147d
parentdcaf1796fe0e41e39ac5c9602cb190cf150e7849 (diff)
downloadseaweedfs-9ba52db5858c480cb8cf4125b0d698f188f22ba8.tar.xz
seaweedfs-9ba52db5858c480cb8cf4125b0d698f188f22ba8.zip
add writable checking
fix https://github.com/chrislusf/seaweedfs/issues/405
-rw-r--r--weed/topology/topology_vacuum.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/topology/topology_vacuum.go b/weed/topology/topology_vacuum.go
index 3a6fcbae2..a7ef52336 100644
--- a/weed/topology/topology_vacuum.go
+++ b/weed/topology/topology_vacuum.go
@@ -86,7 +86,14 @@ func (t *Topology) Vacuum(garbageThreshold string) int {
for _, vl := range c.storageType2VolumeLayout.Items() {
if vl != nil {
volumeLayout := vl.(*VolumeLayout)
+ writableSet := make(map[storage.VolumeId]bool)
+ for _, id := range volumeLayout.writables {
+ writableSet[id] = true
+ }
for vid, locationlist := range volumeLayout.vid2location {
+ if _, isWritable := writableSet[vid]; !isWritable {
+ continue
+ }
glog.V(0).Infof("check vacuum on collection:%s volume:%d", c.Name, vid)
if batchVacuumVolumeCheck(volumeLayout, vid, locationlist, garbageThreshold) {
if batchVacuumVolumeCompact(volumeLayout, vid, locationlist) {