ignore setting job summary when oldstatus == newstatus #9884
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ignoring setting job summary when job status has not changed.
firstPass
was an invalid approach to prevent double job summary updates sinceapplyUpsertJob
callssetJobStatus
twice, once duringUpsertJob
and once duringUpertEval
(atomic eval insertion).When setting the job status, if oldstatus == newstatus, truly no-op instead of calculating the Jobsummary.
Before #9768,
setJobStatus
setoldStatus = ""
which allowed the job summary to increment and decrement properlyhttps://github.com/hashicorp/nomad/blob/release-1.0.1/nomad/state/state_store.go#L4482-L4484
The current situation seems to be mostly related to test setup, before we could rely on the implementation to empty out the job status when it was created, but in reality the job comes in through the FSM without a job status set.
fixes #9875