From cb5dae0c9cd0e19c7e865ebf1ddfdf5138e8a74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=BE=BD?= Date: Sat, 13 Jul 2024 01:49:15 +0800 Subject: [PATCH] Fix "no more writable volumes" error when volume grows and master leader changed at the same time (#5771) --- weed/server/master_grpc_server_volume.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/weed/server/master_grpc_server_volume.go b/weed/server/master_grpc_server_volume.go index 503da7fd4..86b66a818 100644 --- a/weed/server/master_grpc_server_volume.go +++ b/weed/server/master_grpc_server_volume.go @@ -27,9 +27,13 @@ func (ms *MasterServer) ProcessGrowRequest() { break } + option := req.Option + vl := ms.Topo.GetVolumeLayout(option.Collection, option.ReplicaPlacement, option.Ttl, option.DiskType) + if !ms.Topo.IsLeader() { //discard buffered requests time.Sleep(time.Second * 1) + vl.DoneGrowRequest() continue } @@ -42,9 +46,6 @@ func (ms *MasterServer) ProcessGrowRequest() { return !found }) - option := req.Option - vl := ms.Topo.GetVolumeLayout(option.Collection, option.ReplicaPlacement, option.Ttl, option.DiskType) - // not atomic but it's okay if !found && vl.ShouldGrowVolumes(option) { filter.Store(req, nil)