mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid possible concurrent access inside ensureCorrectWritables()
This commit is contained in:
parent
92f906b6fc
commit
c7ebadc25d
|
@ -177,7 +177,9 @@ func (t *Topology) DeleteCollection(collectionName string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Topology) RegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) {
|
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) {
|
func (t *Topology) UnRegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) {
|
||||||
glog.Infof("removing volume info:%+v", v)
|
glog.Infof("removing volume info:%+v", v)
|
||||||
|
|
|
@ -141,7 +141,6 @@ func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
|
||||||
vl.accessLock.Lock()
|
vl.accessLock.Lock()
|
||||||
defer vl.accessLock.Unlock()
|
defer vl.accessLock.Unlock()
|
||||||
|
|
||||||
defer vl.ensureCorrectWritables(v.Id)
|
|
||||||
defer vl.rememberOversizedVolume(v, dn)
|
defer vl.rememberOversizedVolume(v, dn)
|
||||||
|
|
||||||
if _, ok := vl.vid2location[v.Id]; !ok {
|
if _, ok := vl.vid2location[v.Id]; !ok {
|
||||||
|
|
Loading…
Reference in a new issue