[master] avoid timeout when assigning for main request with filter by DC or rack (#6291)

* avoid timeout when assigning for main request with filter by DC or rack

https://github.com/seaweedfs/seaweedfs/issues/6290

* use constant NoWritableVolumes
This commit is contained in:
Konstantin Lebedev
2024-11-26 21:33:31 +05:00
committed by GitHub
parent fec88e64eb
commit e2e97db917
3 changed files with 8 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/stats"
"strings"
"time"
"github.com/seaweedfs/raft"
@@ -100,6 +101,9 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
glog.V(1).Infof("assign %v %v: %v", req, option.String(), err)
stats.MasterPickForWriteErrorCounter.Inc()
lastErr = err
if (req.DataCenter != "" || req.Rack != "") && strings.Contains(err.Error(), topology.NoWritableVolumes) {
break
}
time.Sleep(200 * time.Millisecond)
continue
}