-
Notifications
You must be signed in to change notification settings - Fork 2k
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
state store: fix logic for evaluating job status #24974
base: main
Are you sure you want to change the base?
Conversation
@@ -3851,11 +3852,6 @@ func (s *StateStore) EvalsByJob(ws memdb.WatchSet, namespace, jobID string) ([]* | |||
|
|||
e := raw.(*structs.Evaluation) | |||
|
|||
// Filter non-exact matches | |||
if e.JobID != jobID { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary anymore because periodic jobs do not get an evaluation.
@@ -5532,6 +5527,12 @@ func (s *StateStore) setJobStatus(index uint64, txn *txn, | |||
if err := s.setJobSummary(txn, updated, index, oldStatus, newStatus); err != nil { | |||
return fmt.Errorf("job summary update failed %w", err) | |||
} | |||
|
|||
// Update the job version details | |||
if err := s.upsertJobVersion(index, updated, txn); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels odd to call here, but it's necessary to also update a job's version status anytime we are updating the job summary, or they can get out of sync.
@@ -5084,6 +5087,7 @@ func TestStateStore_DeleteEval_Eval(t *testing.T) { | |||
require.Equal(t, uint64(1002), evalsIndex) | |||
} | |||
|
|||
// This tests the evalDelete boolean by deleting a Pending eval and Pending Alloc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job tests the evalDelete
boolean, but it's an odd test because it forcefully deletes a non-terminal eval and non-terminal alloc, and then makes sure we set the job to "dead".
Description
The state store persists the correct job version for job summaries, but not for specific versions. This fix attempts to simplify the logic around evaluating a job's status, and then make's sure it is persisted.
Testing & Reproduction steps
See GH issue for replication steps
Links
Fixes GH #24957
Contributor Checklist
changelog entry using the
make cl
command.ensure regressions will be caught.
and job configuration, please update the Nomad website documentation to reflect this. Refer to
the website README for docs guidelines. Please also consider whether the
change requires notes within the upgrade guide.
Reviewer Checklist
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.