ec repair: fix detection metadata

This commit is contained in:
Chris Lu
2026-02-26 00:31:58 -08:00
parent 0a6a76b71e
commit df6f325574
2 changed files with 12 additions and 7 deletions
+10 -3
View File
@@ -20,6 +20,8 @@ import (
"google.golang.org/protobuf/proto"
)
const recentTaskWindowSize = 10
type ecRepairWorkerConfig struct {
MinIntervalSeconds int
}
@@ -410,8 +412,13 @@ func (h *EcRepairHandler) rebuildMissingShards(ctx context.Context, plan *ecrepa
}); err != nil {
return nil, err
}
if len(rebuilt) == 0 && len(plan.MissingShards) > 0 {
return nil, fmt.Errorf("rebuild shards for volume %d completed but returned no rebuilt shard IDs", plan.VolumeID)
if len(rebuilt) == 0 {
if len(plan.MissingShards) > 0 {
glog.V(1).Infof("EC Repair: resp.RebuiltShardIds empty; assuming all missing shards rebuilt for volume %d (%d shards)", plan.VolumeID, len(plan.MissingShards))
} else {
glog.V(1).Infof("EC Repair: resp.RebuiltShardIds empty for volume %d with no missing shards declared", plan.VolumeID)
}
rebuilt = append(rebuilt, plan.MissingShards...)
}
return rebuilt, nil
}
@@ -562,7 +569,7 @@ func (h *EcRepairHandler) fetchTopology(ctx context.Context, masterAddresses []s
if response == nil || response.TopologyInfo == nil {
continue
}
activeTopology := topology.NewActiveTopology(10)
activeTopology := topology.NewActiveTopology(recentTaskWindowSize)
if err := activeTopology.UpdateTopology(response.TopologyInfo); err != nil {
return nil, nil, err
}
+2 -4
View File
@@ -56,7 +56,7 @@ func Detect(topoInfo *master_pb.TopologyInfo, collectionFilter string, maxResult
var candidates []*RepairCandidate
hasMore := false
for _, key := range keys {
for idx, key := range keys {
state := states[key]
if state == nil {
continue
@@ -80,9 +80,7 @@ func Detect(topoInfo *master_pb.TopologyInfo, collectionFilter string, maxResult
})
if maxResults > 0 && len(candidates) >= maxResults {
if len(candidates) < len(keys) {
hasMore = true
}
hasMore = idx < len(keys)-1
break
}
}