wait a bit before getting the next volume id if the leader is recently elected
This commit is contained in:
@@ -55,6 +55,8 @@ type Topology struct {
|
||||
|
||||
UuidAccessLock sync.RWMutex
|
||||
UuidMap map[string][]string
|
||||
|
||||
LastLeaderChangeTime time.Time
|
||||
}
|
||||
|
||||
func NewTopology(id string, seq sequence.Sequencer, volumeSizeLimit uint64, pulse int, replicationAsMin bool) *Topology {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/server/constants"
|
||||
"math/rand/v2"
|
||||
"reflect"
|
||||
"sync"
|
||||
@@ -126,6 +127,10 @@ func (vg *VolumeGrowth) findAndGrow(grpcDialOption grpc.DialOption, topo *Topolo
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
for !topo.LastLeaderChangeTime.Add(constants.VolumePulseSeconds * 2).Before(time.Now()) {
|
||||
glog.V(0).Infof("wait for volume servers to join back")
|
||||
time.Sleep(constants.VolumePulseSeconds / 2)
|
||||
}
|
||||
vid, raftErr := topo.NextVolumeId()
|
||||
if raftErr != nil {
|
||||
return nil, raftErr
|
||||
|
||||
Reference in New Issue
Block a user