master: broadcast new volume locations to clients to avoid possible racing condition

fix https://github.com/chrislusf/seaweedfs/issues/3220
This commit is contained in:
chrislu
2022-06-23 00:41:33 -07:00
parent 52c44d646e
commit 96496d5286
2 changed files with 30 additions and 16 deletions

View File

@@ -52,8 +52,13 @@ func (ms *MasterServer) ProcessGrowRequest() {
go func() {
glog.V(1).Infoln("starting automatic volume grow")
start := time.Now()
_, err := ms.vg.AutomaticGrowByType(req.Option, ms.grpcDialOption, ms.Topo, req.Count)
newVidLocations, err := ms.vg.AutomaticGrowByType(req.Option, ms.grpcDialOption, ms.Topo, req.Count)
glog.V(1).Infoln("finished automatic volume grow, cost ", time.Now().Sub(start))
if err == nil {
for _, newVidLocation := range newVidLocations {
ms.broadcastToClients(&master_pb.KeepConnectedResponse{VolumeLocation: newVidLocation})
}
}
vl.DoneGrowRequest()
if req.ErrCh != nil {