-
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
Normalize plan to increase the plan apply throughput #5602
Conversation
nomad/state/state_store.go
Outdated
return nil, fmt.Errorf("alloc lookup failed: %v", err) | ||
} | ||
if alloc == nil { | ||
continue |
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.
Continuing the discussion from
https://github.com/hashicorp/nomad/pull/5407/files/c242adea8786e7541c8c108c342026730b028ff4#diff-ccbd515c67aa55098b48f1106de134aaR4134
There are a few reasons I don't think returning an error is the right approach here:
- We do diffs for only stopped or preempted allocs. If they don’t exist, it means they have already been stopped/preempted. If that's the case, it’s fine for the update to not make it to the alloc in that case.
- The raft log has already been dispatched at this point, and this code just applies the log to the state store. I'm not sure it'd even be 'correct' to not apply this to the state store, given that we can't remove the raft log entry. Wouldn't the state store be stuck whenever it has to apply this log entry?
- It looks like existing code for preempted allocs dealt with this in the same way.
nomad/nomad/state/state_store.go
Line 236 in 987ed01
if existing == 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.
- should not happen unless the plan applier is acting on stale state store data. We asked about returning an error so that its very visible when this happens. ie. this suggestion was for safety
Re: 2) - returning the error will fail the optimistic apply to the leader's state store in
Line 226 in 95297c6
if snap != nil { |
Line 324 in 95297c6
if err := w.srv.RPC("Plan.Submit", &req, &resp); err != nil { |
Line 20 in 95297c6
type PlanFuture interface { |
Line 43 in 95297c6
result, err := future.Wait() |
Re: 3) that logic could be worth changing as well, I will address that in a future PR since I am going to be touching the plan applier again after this PR is merged, you don't need to change that right now though.
nomad/util.go
Outdated
// MinVersionPlanNormalization is the minimum version to support the | ||
// normalization of Plan in SubmitPlan, and the denormalization raft log entry committed | ||
// in ApplyPlanResultsRequest | ||
var MinVersionPlanNormalization = version.Must(version.NewVersion("0.9.1")) |
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.
var MinVersionPlanNormalization = version.Must(version.NewVersion("0.9.1")) | |
var MinVersionPlanNormalization = version.Must(version.NewVersion("0.9.2")) |
31ec8d8
to
37f6757
Compare
37f6757
to
23bc1f2
Compare
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.
LGTM, great work overall
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. |
This PR adds normalization of the plan to commit only the diff for stopped and preempted allocs to the raft log to enable better throughput. It also starts using omitempty on some of the structs during msgpack serialization to omit the empty fields.