Skip to content

Commit

Permalink
scheduler: Disable failed replica reusage for SPDK
Browse files Browse the repository at this point in the history
Longhorn 7199

Signed-off-by: Shuo Wu <shuo.wu@suse.com>
  • Loading branch information
shuo-wu committed Jul 24, 2024
1 parent 078f605 commit a16560e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controller/volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4836,6 +4836,10 @@ func (c *VolumeController) shouldCleanUpFailedReplica(v *longhorn.Volume, r *lon
log.Warnf("Replica %v failed to rebuild too many times", r.Name)
return true
}
// TODO: Remove it once we can reuse failed replicas during v2 rebuilding
if types.IsDataEngineV2(v.Spec.DataEngine) {
return true
}
// Failed too long ago to be useful during a rebuild.
if v.Spec.StaleReplicaTimeout > 0 &&
util.TimestampAfterTimeout(r.Spec.FailedAt, time.Duration(v.Spec.StaleReplicaTimeout)*time.Minute) {
Expand Down
10 changes: 10 additions & 0 deletions scheduler/replica_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,11 @@ func filterActiveReplicas(replicas map[string]*longhorn.Replica) map[string]*lon
}

func (rcs *ReplicaScheduler) CheckAndReuseFailedReplica(replicas map[string]*longhorn.Replica, volume *longhorn.Volume, hardNodeAffinity string) (*longhorn.Replica, error) {
// TODO: Remove it once we can reuse failed replicas during v2 rebuilding
if types.IsDataEngineV2(volume.Spec.DataEngine) {
return nil, nil
}

replicas = filterActiveReplicas(replicas)

allNodesInfo, err := rcs.getNodeInfo()
Expand Down Expand Up @@ -654,6 +659,11 @@ func (rcs *ReplicaScheduler) RequireNewReplica(replicas map[string]*longhorn.Rep
return 0
}

// TODO: Remove it once we can reuse failed replicas during v2 rebuilding
if types.IsDataEngineV2(volume.Spec.DataEngine) {
return 0
}

timeUntilNext, timeOfNext, err := rcs.timeToReplacementReplica(volume)
if err != nil {
msg := "Failed to get time until replica replacement, will directly replenish a new replica"
Expand Down

0 comments on commit a16560e

Please sign in to comment.