mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-19 22:44:18 +00:00
ec repair: fix detection metadata
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user