Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes auto reverts robust against previously stable job that fail to start correctly upon reverting #3496

Merged
merged 8 commits into from
Nov 3, 2017

Conversation

preetapan
Copy link
Member

No description provided.

…ting. This prevents infinite reverting when reverting to a job version that was previously stable, but not so after attempting a revert.
@preetapan preetapan changed the title B auto revert stable Makes auto reverts robust against previously stable job that fail to start correctly upon reverting Nov 3, 2017
@preetapan preetapan requested a review from dadgar November 3, 2017 01:02
// DeploymentStatusDescriptionRollbackFailed is used to get the status description of
// a deployment when rolling back to an older job is not possible because it has the same specification
func DeploymentStatusDescriptionRollbackFailed(baseDescription string, jobVersion uint64, jobVersionOld uint64) string {
return fmt.Sprintf("%s - rolling back to job version %d failed because it had the same specification as job version %d ", baseDescription, jobVersion, jobVersionOld)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" - not rolling back to stable job version %d as current job has same specification"? If we can get across the same message in less the better. Also want to avoid saying the roll back failed since it didn't, we just won't do it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I am not a fan of my wording, I like your suggestion, will fix

} else {
desc = structs.DeploymentStatusDescriptionRollbackFailed(desc, j.Version, w.j.Version)
j = nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to do the same on SetAllocHealth and FailDeployment

@@ -371,7 +371,13 @@ func (w *deploymentWatcher) watch() {
// Description should include that the job is being rolled back to
// version N
if j != nil {
desc = structs.DeploymentStatusDescriptionRollback(desc, j.Version)
// only revert if job being changed has a different spec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Capitalize the start of your comments.
  2. Can we add more detail in the comment explaining how this can avoid an infinite revert cycle.

}, func(err error) {
t.Fatal(err)
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to assert the job version hasn't changed?

@@ -184,6 +184,18 @@ func (w *deploymentWatcher) SetAllocHealth(
w.setLatestEval(index)
return nil
}
func (w *deploymentWatcher) handleRollbackValidity(j *structs.Job, desc string) (*structs.Job, string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on the inputs and outputs


// verify that the job version hasn't changed after upsert
m.state.JobByID(nil, structs.DefaultNamespace, j.ID)
if j.Version != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use assert where possible

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants