mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00: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:
parent
b0da8788a1
commit
ca7cc61319
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue