Repository navigation
fix(acl): scope locking reads to the repository primary-key range - #28
Merged
Merged
Conversation
This was referenced Oct 23, 2026
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.
Incident and cause
The 2026-10-23 DEV incident showed the transaction-side final ACL query executing as
type=index, key=acl_shared_subjectovercf_dir_acl: therepo_id=? OR repo_id IN(SELECT origin_repo...)expression caused a broad index scan and lock amplification under REPEATABLE READ. This is independent of Hub's cached per-library ACL rules.Small, schema-free fix
OR/INlocking read with an exactrepo_id=?check, using the existing primary-key prefix (FORCE INDEX (PRIMARY)).VirtualRepomapping through its existing uniquerepo_idindex; when present, repeat the same exact-key ACL check for its origin.FOR UPDATEcurrent-read semantics under the Branch transaction.Design boundary
This reduces scanned/locked ACL index scope; it does not claim to eliminate all gap/next-key locks for empty key ranges. Do not replace the final transaction check with a possibly stale Hub/Redis snapshot. Deeper ACL model/table shrinkage, multi-repo lock hierarchy and batch publication remain separate proposals.
Required validation before merge (disposable MariaDB + native C/Go)
EXPLAINwith 0, 17, and 10,000 ACL rows: targetkey=PRIMARY, no full secondary-index scan.performance_schema.data_locks/information_schema.INNODB_LOCK_WAITS(as appropriate) to verify no unrelated-library scan amplification, including empty-range gap locks.python3 -m unittest tests.test_cf_acl_lock_scope tests.test_v2_no_managed_library.No DEV/PROD access, live testing, schema changes or deployment performed. Independent of PR #27, which fixes infinite retry/error classification.