security: store ACLs in a non-contiguous chunked set - #30967
Merged
Conversation
7 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the security::acl_store internal ACL map to avoid large contiguous allocations that can lead to OOMs when many ACLs are present, while preserving the reference-stability requirements used by authorization lookups and the prefix index.
Changes:
- Replace
_aclsstorage fromabsl::node_hash_maptochunked_hash_mapand introduce astd::unique_ptr-owned node to keep referenced data address-stable. - Update ACL lookup, iteration, removal, and reset paths to dereference the new node layout (
pattern/entries). - Add Bazel dependency for
chunked_hash_map.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/v/security/BUILD |
Adds //src/v/container:chunked_hash_map dependency for the new container usage in acl_store. |
src/v/security/acl.cc |
Updates lookups/iteration/removal to use _acls values as heap-stable nodes (unique_ptr indirection). |
src/v/security/acl_store.h |
Replaces _acls type with chunked_hash_map + heap node indirection to preserve reference stability without large contiguous allocations. |
Comments suppressed due to low confidence (1)
src/v/security/acl_store.h:112
chunked_hash_map’s default hashers (seecontainer/chunked_hash_map.h) returnuint64_tand arenoexcept. This custom hasher returnssize_tand isn’t markednoexcept; matching the 64-bit/noexcept pattern would keep hashing consistent with other chunked_hash_map users and avoids any potential truncation on non-64-bit platforms.
struct resource_pattern_hash {
using is_transparent = void;
// absl::HashOf already mixes well; tell unordered_dense not to re-mix.
using is_avalanching = void;
size_t operator()(const auto& p) const {
return absl::HashOf(pattern_key(p));
}
};
WillemKauf
commented
Jun 30, 2026
`acl_store::_acls` was an `absl::node_hash_map`, chosen for reference stability. Unfortunately this means allocations are contiguous, which can lead to oversized allocations and OOMs. Rewrite it using `chunked_hash_set`; because reference stability across insertions/erasures is still required, we use a second layer of indirection via `std::unique_ptr<>` to `acl_node`s.
WillemKauf
force-pushed
the
trie-chunked-vector
branch
from
June 30, 2026 18:36
746dfd4 to
635cd75
Compare
security: store ACLs in a non-contiguous chunked mapsecurity: store ACLs in a non-contiguous chunked set
dotnwat
approved these changes
Jun 30, 2026
7 tasks
Collaborator
CI test resultstest results on build#86529
|
oleiman
approved these changes
Jun 30, 2026
oleiman
left a comment
Member
There was a problem hiding this comment.
nice. i also had assumed we needed resource_pattern lookups on _acls.
| * they must not move when other patterns are added or removed. | ||
| */ | ||
| struct acls_node { | ||
| resource_pattern pattern; |
Member
There was a problem hiding this comment.
Late comment, but should we consider making the pattern const?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
acl_store::_aclswas anabsl::node_hash_map, chosen for reference stability. Unfortunately this means allocations are contiguous, which can lead to oversized allocations and OOMs.Rewrite it using
chunked_hash_set; because reference stability across insertions/erasures is still required, we use a second layer of indirection viastd::unique_ptr<>toacl_nodes.Backports Required
Release Notes
Improvements
redpanda