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

core: do not create evaluations within batch deregister endpoint. #20510

Merged
merged 4 commits into from
May 7, 2024

Conversation

jrasell
Copy link
Member

@jrasell jrasell commented May 2, 2024

The batch deregister RPC endpoint is only used by the internal garbage collection process, it is not exposed via the HTTP API or used anywhere else.

The GC process ensures that a job can only be removed from state if all related evaluations and allocations are in a state that means they can also be removed from state. This means that we do not need to create evaluations when jobs are being deregistered via this endpoint.

Seeing that the endpoint is internal only, this change also removes the ACL capability check per namespace and moves it to a simpler and more efficient management check.

Notes:

  • I took this opportunity to move some structs into their related file, ever so slightly making structs.go smaller.
  • The added tests build on existing tests, and help understand code for future readers as well as acted as learning for myself
  • I deprecated params as we cannot remove them due to the struct being persisted via Raft

@jrasell jrasell self-assigned this May 2, 2024
The batch deregister RPC endpoint is only used by the internal
garbage collection process, it is not exposed via the HTTP API or
used anywhere else.

The GC process ensures that a job can only be removed from state
if all related evaluations and allocations are in a state that
means they can also be removed from state. This means that we do
not need to create evaluations when jobs are being deregistered
via this endpoint.
@jrasell jrasell force-pushed the f-job-batch-deregister-no-eval branch from 6ec1f3a to 8fd33cb Compare May 2, 2024 13:24
@jrasell jrasell marked this pull request as ready for review May 2, 2024 13:51
nomad/job_endpoint.go Outdated Show resolved Hide resolved
nomad/structs/job.go Outdated Show resolved Hide resolved
nomad/structs/job.go Outdated Show resolved Hide resolved
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM!

@jrasell jrasell merged commit 5041460 into main May 7, 2024
19 checks passed
@jrasell jrasell deleted the f-job-batch-deregister-no-eval branch May 7, 2024 06:39
Copy link
Member

@schmichael schmichael left a comment

Choose a reason for hiding this comment

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

Love it! Sorry for the late review. I don't see any upgrade/backward compat concerns, but would it be worth manually forcing a system gc with a 1.8 leader and 1.7 followers or similar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants