diff options
Diffstat (limited to 'weed/topology/topology.go')
| -rw-r--r-- | weed/topology/topology.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/topology/topology.go b/weed/topology/topology.go index cee156dc1..177c2a181 100644 --- a/weed/topology/topology.go +++ b/weed/topology/topology.go @@ -6,10 +6,10 @@ import ( "github.com/chrislusf/raft" "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/pb/master_pb" "github.com/chrislusf/seaweedfs/weed/sequence" "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/chrislusf/seaweedfs/weed/pb/master_pb" ) type Topology struct { @@ -132,7 +132,11 @@ func (t *Topology) RegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) { } func (t *Topology) UnRegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) { glog.Infof("removing volume info:%+v", v) - t.GetVolumeLayout(v.Collection, v.ReplicaPlacement, v.Ttl).UnRegisterVolume(&v, dn) + volumeLayout := t.GetVolumeLayout(v.Collection, v.ReplicaPlacement, v.Ttl) + volumeLayout.UnRegisterVolume(&v, dn) + if volumeLayout.isEmpty() { + t.DeleteCollection(v.Collection) + } } func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter { |
