Improve contention around policy_membership table (35484) (#40853)

Resolves #35484

Concurrent execution of GitOps apply runs and
RecordPolicyQueryExecutions led to database locking issues when the
policy_membership table was large. This occurred because the cleanup
process (DELETE operations) was bundled within the same transaction as
the GitOps policy updates. To resolve this, the deletion logic has been
batched and moved outside the primary GitOps transaction, reducing lock
contention.
This commit is contained in:
Juan Fernandez
2026-03-16 15:12:25 -04:00
committed by GitHub
parent 700370a298
commit 139e365d42
5 changed files with 704 additions and 168 deletions
@@ -0,0 +1 @@
* Fixed database locking issues on the policy_membership table by batching cleanup DELETE operations and moving them outside the primary GitOps apply transaction.