1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-06-03 09:10:10 +02:00

reduce the window size between unregistering a volume server and creating volumes on that server

fix https://github.com/seaweedfs/seaweedfs/issues/4467
This commit is contained in:
chrislu 2023-05-30 08:20:00 -07:00
parent b0da8788a1
commit ca7cc61319
3 changed files with 13 additions and 7 deletions

View file

@ -14,12 +14,13 @@ import (
type DataNode struct {
NodeImpl
Ip string
Port int
GrpcPort int
PublicUrl string
LastSeen int64 // unix time in seconds
Counter int // in race condition, the previous dataNode was not dead
Ip string
Port int
GrpcPort int
PublicUrl string
LastSeen int64 // unix time in seconds
Counter int // in race condition, the previous dataNode was not dead
IsTerminating bool
}
func NewDataNode(id string) *DataNode {

View file

@ -179,7 +179,11 @@ func (n *NodeImpl) ReserveOneVolume(r int64, option *VolumeGrowOption) (assigned
} else {
if node.IsDataNode() && node.AvailableSpaceFor(option) > 0 {
// fmt.Println("vid =", vid, " assigned to node =", node, ", freeSpace =", node.FreeSpace())
return node.(*DataNode), nil
dn := node.(*DataNode)
if dn.IsTerminating {
continue
}
return dn, nil
}
assignedNode, err = node.ReserveOneVolume(r, option)
if err == nil {

View file

@ -82,6 +82,7 @@ func (t *Topology) SetVolumeCrowded(volumeInfo storage.VolumeInfo) {
}
func (t *Topology) UnRegisterDataNode(dn *DataNode) {
dn.IsTerminating = true
for _, v := range dn.GetVolumes() {
glog.V(0).Infoln("Removing Volume", v.Id, "from the dead volume server", dn.Id())
diskType := types.ToDiskType(v.DiskType)