mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-24 14:53:03 +08:00
use Lock instead of RLock
fix https://github.com/chrislusf/seaweedfs/issues/364
This commit is contained in:
parent
c4b7966dbe
commit
0559aa9673
@ -53,7 +53,7 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (deletedVo
|
|||||||
for _, v := range actualVolumes {
|
for _, v := range actualVolumes {
|
||||||
actualVolumeMap[v.Id] = v
|
actualVolumeMap[v.Id] = v
|
||||||
}
|
}
|
||||||
dn.RLock()
|
dn.Lock()
|
||||||
for vid, v := range dn.volumes {
|
for vid, v := range dn.volumes {
|
||||||
if _, ok := actualVolumeMap[vid]; !ok {
|
if _, ok := actualVolumeMap[vid]; !ok {
|
||||||
glog.V(0).Infoln("Deleting volume id:", vid)
|
glog.V(0).Infoln("Deleting volume id:", vid)
|
||||||
@ -62,8 +62,8 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (deletedVo
|
|||||||
dn.UpAdjustVolumeCountDelta(-1)
|
dn.UpAdjustVolumeCountDelta(-1)
|
||||||
dn.UpAdjustActiveVolumeCountDelta(-1)
|
dn.UpAdjustActiveVolumeCountDelta(-1)
|
||||||
}
|
}
|
||||||
} //TODO: adjust max volume id, if need to reclaim volume ids
|
}
|
||||||
dn.RUnlock()
|
dn.Unlock()
|
||||||
for _, v := range actualVolumes {
|
for _, v := range actualVolumes {
|
||||||
dn.AddOrUpdateVolume(v)
|
dn.AddOrUpdateVolume(v)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user