Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

prevent dead loop for followers of master node (#6007)

dsd151f2ff7a9f5
diff --git a/weed/server/master_grpc_server_volume.go b/weed/server/master_grpc_server_volume.go
index 6d5ee03850..e2e6cda42a 100644
--- a/weed/server/master_grpc_server_volume.go
+++ b/weed/server/master_grpc_server_volume.go
@@ -3,12 +3,13 @@ package weed_server
import (
"context"
"fmt"
- "github.com/seaweedfs/seaweedfs/weed/stats"
"math/rand/v2"
"strings"
"sync"
"time"
+ "github.com/seaweedfs/seaweedfs/weed/stats"
+
"github.com/seaweedfs/seaweedfs/weed/topology"
"github.com/seaweedfs/raft"
@@ -42,7 +43,13 @@ func (ms *MasterServer) DoAutomaticVolumeGrow(req *topology.VolumeGrowRequest) {
func (ms *MasterServer) ProcessGrowRequest() {
go func() {
ctx := context.Background()
+ firstRun := true
for {
+ if firstRun {
+ firstRun = false
+ } else {
+ time.Sleep(14*time.Minute + time.Duration(120*rand.Float32())*time.Second)
+ }
if !ms.Topo.IsLeader() {
continue
}
@@ -84,7 +91,6 @@ func (ms *MasterServer) ProcessGrowRequest() {
glog.V(0).Infof("volume grow request failed: %+v", err)
}
}
- time.Sleep(14*time.Minute + time.Duration(120*rand.Float32())*time.Second)
}
}()
go func() {