Files
nomad/.changelog/_1432.txt
Tim Gross 77dc74a301 quota: ensure quota usage is freed when jobs are purged (#20492)
When a job is purged, we delete all its allocations and the client detects the
absense of the allocations to clean up its resources locally. But the client
won't be able to send an allocation status update in this case, which frees the
quota being used by that allocation. Instead, we need to free the quota usage
inside the state store immediately. To do so, we check if the allocation is
already client-terminal before copying it and passing it into the Enterprise
code for cleanup.

This commit also refactors the job delete to make it clear there's a single
caller of this alloc deletion path. This refactoring eliminates some wasteful
logic that queries the "allocs" table, allocates a slice of strings for their
IDs, and then queries the "allocs" table one-by-one for each of them for
deletion anyways.

Tests for this code can be found in the linked ENT repo PR.

Fixes: https://github.com/hashicorp/nomad-enterprise/issues/1422
Ref: https://hashicorp.atlassian.net/browse/NOMAD-620
Ref: https://github.com/hashicorp/nomad-enterprise/pull/1432
2024-05-01 08:44:22 -04:00

4 lines
113 B
Plaintext

```release-note:bug
quota (Enterprise): Fixed a bug where quota usage would not be freed if a job was purged
```