ROX-35013: Replace full-table Walks with targeted WalkByQuery in compliance operator manager#21059
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Skipping CI for Draft Pull Request. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🚀 Build Images ReadyImages are ready for commit d668412. To use with deploy scripts: export MAIN_IMAGE_TAG=4.12.x-147-gd668412785 |
…liance operator manager Added search tags to ComplianceOperatorProfile name and cluster_id fields, enabled search category 201 on the profile store, and replaced 3 of 4 full-table Walk calls in the manager with WalkByQuery filtered by profile name or cluster ID. addProfileNoLock: Walk all profiles → WalkByQuery(name = X), filter cluster in callback. Reduces O(N) table scan to indexed query. DeleteProfile: Walk all profiles → WalkByQuery(name = X), same pattern. GetMachineConfigs: Walk all profiles → WalkByQuery(clusterId = X). findProfilesWithRuleNoLock: Unchanged (searches inside repeated field). Benchmark (20 clusters, 200 profiles concurrent): master: 234ms, 316MB, 3.39M allocs WalkByQuery: 103ms, 40MB, 449K allocs Improvement: 2.3x faster, 8x less memory, 7.5x fewer allocations Partially generated by AI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5cc3639 to
e30417e
Compare
bc3fa1d to
d668412
Compare
Added search tags to ComplianceOperatorProfile name and cluster_id
fields, enabled search category 201 on the profile store, and replaced
3 of 4 full-table Walk calls in the manager with WalkByQuery filtered
by profile name or cluster ID.
addProfileNoLock: Walk all profiles → WalkByQuery(name = X), filter
cluster in callback. Reduces O(N) table scan to indexed query.
DeleteProfile: Walk all profiles → WalkByQuery(name = X), same pattern.
GetMachineConfigs: Walk all profiles → WalkByQuery(clusterId = X).
findProfilesWithRuleNoLock: Unchanged (searches inside repeated field).
Benchmark (20 clusters, 200 profiles concurrent):
master: 234ms, 316MB, 3.39M allocs
WalkByQuery: 103ms, 40MB, 449K allocs
Improvement: 2.3x faster, 8x less memory, 7.5x fewer allocations
Partially generated by AI.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Description
change me!
User-facing documentation
Testing and quality
Automated testing
How I validated my change
change me!