Browse Source

avoid possible concurrent access inside ensureCorrectWritables()

pull/1633/head
Chris Lu 4 years ago
parent
commit
c7ebadc25d
  1. 4
      weed/topology/topology.go
  2. 1
      weed/topology/volume_layout.go

4
weed/topology/topology.go

@ -177,7 +177,9 @@ func (t *Topology) DeleteCollection(collectionName string) {
}
func (t *Topology) RegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) {
t.GetVolumeLayout(v.Collection, v.ReplicaPlacement, v.Ttl).RegisterVolume(&v, dn)
vl := t.GetVolumeLayout(v.Collection, v.ReplicaPlacement, v.Ttl)
vl.RegisterVolume(&v, dn)
vl.EnsureCorrectWritables(&v)
}
func (t *Topology) UnRegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) {
glog.Infof("removing volume info:%+v", v)

1
weed/topology/volume_layout.go

@ -141,7 +141,6 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
vl.accessLock.Lock()
defer vl.accessLock.Unlock()
defer vl.ensureCorrectWritables(v.Id)
defer vl.rememberOversizedVolume(v, dn)
if _, ok := vl.vid2location[v.Id]; !ok {

Loading…
Cancel
Save