better logging for volume growth

This commit is contained in:
chrislu
2024-09-07 12:38:34 -07:00
parent accba3070a
commit ff3d46637d
5 changed files with 11 additions and 3 deletions

View File

@@ -93,10 +93,11 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
ms.volumeGrowthRequestChan <- &topology.VolumeGrowRequest{ ms.volumeGrowthRequestChan <- &topology.VolumeGrowRequest{
Option: option, Option: option,
Count: req.WritableVolumeCount, Count: req.WritableVolumeCount,
Reason: "grpc assign",
} }
} }
if err != nil { if err != nil {
glog.V(0).Infof("assign %v %v: %v", req, option.String(), err) glog.V(1).Infof("assign %v %v: %v", req, option.String(), err)
stats.MasterPickForWriteErrorCounter.Inc() stats.MasterPickForWriteErrorCounter.Inc()
lastErr = err lastErr = err
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
@@ -128,5 +129,8 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
Replicas: replicas, Replicas: replicas,
}, nil }, nil
} }
if lastErr != nil {
glog.V(0).Infof("assign %v %v: %v", req, option.String(), lastErr)
}
return nil, lastErr return nil, lastErr
} }

View File

@@ -51,6 +51,7 @@ func (ms *MasterServer) ProcessGrowRequest() {
ms.volumeGrowthRequestChan <- &topology.VolumeGrowRequest{ ms.volumeGrowthRequestChan <- &topology.VolumeGrowRequest{
Option: vlc.ToGrowOption(), Option: vlc.ToGrowOption(),
Count: vl.GetLastGrowCount(), Count: vl.GetLastGrowCount(),
Reason: "collection autogrow",
} }
} else { } else {
for _, dc := range dcs { for _, dc := range dcs {
@@ -62,6 +63,7 @@ func (ms *MasterServer) ProcessGrowRequest() {
Option: volumeGrowOption, Option: volumeGrowOption,
Count: vl.GetLastGrowCount(), Count: vl.GetLastGrowCount(),
Force: true, Force: true,
Reason: "per-dc autogrow",
} }
} }
} }
@@ -108,6 +110,7 @@ func (ms *MasterServer) ProcessGrowRequest() {
filter.Store(req, nil) filter.Store(req, nil)
// we have lock called inside vg // we have lock called inside vg
glog.V(0).Infof("volume grow %+v", req)
go func(req *topology.VolumeGrowRequest, vl *topology.VolumeLayout) { go func(req *topology.VolumeGrowRequest, vl *topology.VolumeLayout) {
ms.DoAutomaticVolumeGrow(req) ms.DoAutomaticVolumeGrow(req)
vl.DoneGrowRequest() vl.DoneGrowRequest()

View File

@@ -151,6 +151,7 @@ func (ms *MasterServer) dirAssignHandler(w http.ResponseWriter, r *http.Request)
ms.volumeGrowthRequestChan <- &topology.VolumeGrowRequest{ ms.volumeGrowthRequestChan <- &topology.VolumeGrowRequest{
Option: option, Option: option,
Count: uint32(writableVolumeCount), Count: uint32(writableVolumeCount),
Reason: "http assign",
} }
} }
if err != nil { if err != nil {

View File

@@ -34,7 +34,7 @@ type VolumeGrowRequest struct {
} }
func (vg *VolumeGrowRequest) Equals(req *VolumeGrowRequest) bool { func (vg *VolumeGrowRequest) Equals(req *VolumeGrowRequest) bool {
return reflect.DeepEqual(existingReq.Option, req.Option) && vg.Count == req.Count return reflect.DeepEqual(vg.Option, req.Option) && vg.Count == req.Count && vg.Force == req.Force
} }
type volumeGrowthStrategy struct { type volumeGrowthStrategy struct {

View File

@@ -301,7 +301,7 @@ func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (vi
lenWriters := len(vl.writables) lenWriters := len(vl.writables)
if lenWriters <= 0 { if lenWriters <= 0 {
return 0, 0, nil, true, fmt.Errorf("%s in volume layout", noWritableVolumes) return 0, 0, nil, true, fmt.Errorf("%s", noWritableVolumes)
} }
if option.DataCenter == "" && option.Rack == "" && option.DataNode == "" { if option.DataCenter == "" && option.Rack == "" && option.DataNode == "" {
vid := vl.writables[rand.Intn(lenWriters)] vid := vl.writables[rand.Intn(lenWriters)]