Skip to content

api: prefer table index on initial GetClientAllocs - #28394

Merged
chrisroberts merged 1 commit into
mainfrom
f-get-client-allocs-dels
Aug 10, 2026
Merged

chrisroberts merged 1 commit into
mainfrom
f-get-client-allocs-dels

Conversation

@chrisroberts

Copy link
Copy Markdown
Member

Description

When the Node.GetClientAllocs query is initially run, the previous count of allocations is unknown. If the request is made with a minimum query index value and an allocation has just been deleted, this will not be correctly detected and the query will block. To prevent this, always prefer the allocs table index on the initial run.

This surfaced in #28242 where the existing behavior resulted in allocations that were still running after being deleted.

Testing & Reproduction steps

Test included.

Links

Fixes #28242

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad product documentation, which is stored in the
    web-unified-docs repo. Refer to the web-unified-docs contributor guide for docs guidelines.
    Please also consider whether the change requires notes within the upgrade
    guide
    . If you would like help with the docs, tag the nomad-docs team in this PR.
  • LLM Usage If an LLM was used to generate any code, please ensure and confirm you have read
    and followed the AI usage guide.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

@chrisroberts
chrisroberts requested review from a team as code owners August 6, 2026 22:07
@chrisroberts chrisroberts added backport/ent/1.10.x+ent backport to 1.10.x+ent release line backport/ent/1.11.x+ent backport to 1.11.x+ent release line backport/ent/2.0.x+ent backport to 2.0.x+ent release line labels Aug 6, 2026
When the query is initially run, the previous count of allocations
is unknown. If the request is made with a minimum query index value
and an allocation has just been deleted, this will not be correctly
detected and the query will block. To prevent this, always prefer
the allocs table index on the initial run.

@gulducat gulducat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@tgross tgross left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

But is there any strong reason not to always use the table index here instead of having the branch?

@chrisroberts

Copy link
Copy Markdown
Member Author

@tgross Yeah, it's to limit the client to only reloading the allocations here when applicable to the node vs on any allocation change.

@chrisroberts
chrisroberts merged commit 8a59a33 into main Aug 10, 2026
37 checks passed
@chrisroberts
chrisroberts deleted the f-get-client-allocs-dels branch August 10, 2026 20:29
@chrisroberts chrisroberts added the backport/2.0.x backport to 2.0.x release line label Aug 10, 2026
schmichael pushed a commit to vercel/nomad that referenced this pull request Sep 25, 2026
When the query is initially run, the previous count of allocations
is unknown. If the request is made with a minimum query index value
and an allocation has just been deleted, this will not be correctly
detected and the query will block. To prevent this, always prefer
the allocs table index on the initial run.

This branch was successfully deployed

1 active deployment
Preview — bf062dfa Deployed Aug 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/ent/1.10.x+ent backport to 1.10.x+ent release line backport/ent/1.11.x+ent backport to 1.11.x+ent release line backport/ent/2.0.x+ent backport to 2.0.x+ent release line backport/2.0.x backport to 2.0.x release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node.GetClientAllocs can miss consecutive allocation deletions between blocking RPCs, leaving purged jobs running on clients

3 participants