mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix no more writables volumes while disk free space is sufficient (#4491)
Co-authored-by: wang wusong <wangwusong@virtaitech.com>
This commit is contained in:
parent
8f3bd202e5
commit
8fffe3e822
|
@ -243,6 +243,7 @@ func (n *NodeImpl) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSi
|
||||||
if n.IsRack() {
|
if n.IsRack() {
|
||||||
for _, c := range n.Children() {
|
for _, c := range n.Children() {
|
||||||
dn := c.(*DataNode) //can not cast n to DataNode
|
dn := c.(*DataNode) //can not cast n to DataNode
|
||||||
|
dn.RLock()
|
||||||
for _, v := range dn.GetVolumes() {
|
for _, v := range dn.GetVolumes() {
|
||||||
if v.Size >= volumeSizeLimit {
|
if v.Size >= volumeSizeLimit {
|
||||||
//fmt.Println("volume",v.Id,"size",v.Size,">",volumeSizeLimit)
|
//fmt.Println("volume",v.Id,"size",v.Size,">",volumeSizeLimit)
|
||||||
|
@ -259,6 +260,7 @@ func (n *NodeImpl) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dn.RUnlock()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for _, c := range n.Children() {
|
for _, c := range n.Children() {
|
||||||
|
|
|
@ -172,6 +172,21 @@ func (t *Topology) batchVacuumVolumeCommit(grpcDialOption grpc.DialOption, vl *V
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCommitSuccess {
|
if isCommitSuccess {
|
||||||
|
//reset all vacuumed volumes size
|
||||||
|
for _, dn := range vacuumLocationList.list {
|
||||||
|
vInfo, err := dn.GetVolumesById(vid)
|
||||||
|
if err != nil {
|
||||||
|
glog.V(0).Infof("get volume info for volume: %d failed %v", vid, err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
dn.Lock()
|
||||||
|
disk := dn.getOrCreateDisk(vInfo.DiskType)
|
||||||
|
vInfo.Size = 0
|
||||||
|
disk.doAddOrUpdateVolume(vInfo)
|
||||||
|
dn.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
for _, dn := range vacuumLocationList.list {
|
for _, dn := range vacuumLocationList.list {
|
||||||
vl.SetVolumeAvailable(dn, vid, isReadOnly)
|
vl.SetVolumeAvailable(dn, vid, isReadOnly)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue