Skip to content

Commit

Permalink
Set LastHealthyAt every time a replica appears RW in an engine
Browse files Browse the repository at this point in the history
SQUASH THIS

Signed-off-by: Eric Weber <[email protected]>
  • Loading branch information
ejweber committed Jan 23, 2024
1 parent 792a7e9 commit 61660ba
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions controller/volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,16 +718,15 @@ func (c *VolumeController) ReconcileEngineReplicaState(v *longhorn.Volume, es ma
}
r.Spec.DesireState = longhorn.InstanceStateStopped
} else if mode == longhorn.ReplicaModeRW {
// record once replica became healthy, so if it
// failed in the future, we can tell it apart
// from replica failed during rebuilding
now := c.nowHandler()
if r.Spec.HealthyAt == "" {
c.backoff.DeleteEntry(r.Name)
now := c.nowHandler()
// Set HealthyAt to distinguish this replica from one that has never been rebuilt.
r.Spec.HealthyAt = now
r.Spec.LastHealthyAt = now
r.Spec.RebuildRetryCount = 0
}
// Set LastHealthyAt to record the last time this replica became RW in an engine.
r.Spec.LastHealthyAt = now
healthyCount++
}
}
Expand Down

0 comments on commit 61660ba

Please sign in to comment.