mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove ticker
update the topology before each file
This commit is contained in:
parent
e2d991d8d0
commit
c5189c343b
|
@ -11,11 +11,8 @@ import (
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const topologyInfoUpdateInterval = 5 * time.Minute
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Commands = append(Commands, &commandVolumeServerEvacuate{})
|
Commands = append(Commands, &commandVolumeServerEvacuate{})
|
||||||
}
|
}
|
||||||
|
@ -117,23 +114,18 @@ func (c *commandVolumeServerEvacuate) evacuateNormalVolumes(commandEnv *CommandE
|
||||||
}
|
}
|
||||||
|
|
||||||
// move away normal volumes
|
// move away normal volumes
|
||||||
ticker := time.NewTicker(topologyInfoUpdateInterval)
|
|
||||||
defer ticker.Stop()
|
|
||||||
for _, thisNode := range thisNodes {
|
for _, thisNode := range thisNodes {
|
||||||
for _, diskInfo := range thisNode.info.DiskInfos {
|
for _, diskInfo := range thisNode.info.DiskInfos {
|
||||||
if applyChange {
|
if applyChange {
|
||||||
select {
|
if topologyInfo, _, err := collectTopologyInfo(commandEnv, 0); err != nil {
|
||||||
case <-ticker.C:
|
fmt.Fprintf(writer, "update topologyInfo %v", err)
|
||||||
if topologyInfo, _, err := collectTopologyInfo(commandEnv, 0); err != nil {
|
} else {
|
||||||
fmt.Fprintf(writer, "update topologyInfo %v", err)
|
_, otherNodesNew := c.nodesOtherThan(
|
||||||
} else {
|
collectVolumeServersByDc(topologyInfo, ""), volumeServer)
|
||||||
_, otherNodesNew := c.nodesOtherThan(
|
if len(otherNodesNew) > 0 {
|
||||||
collectVolumeServersByDc(topologyInfo, ""), volumeServer)
|
otherNodes = otherNodesNew
|
||||||
if len(otherNodesNew) > 0 {
|
c.topologyInfo = topologyInfo
|
||||||
otherNodes = otherNodesNew
|
fmt.Fprintf(writer, "topologyInfo updated %v\n", len(otherNodes))
|
||||||
c.topologyInfo = topologyInfo
|
|
||||||
fmt.Fprintf(writer, "topologyInfo updated %v\n", len(otherNodes))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue