MID-11179 Improve user list performance for large orgRelation authorization#633
Open
MID-11179 Improve user list performance for large orgRelation authorization#633
Conversation
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.
Summary
Improves performance of user list/search/count operations when authorization contains large
orgRelation/ managed-org filters.The main problem was that users managing many organizations could produce very large OR predicates and repeated org descendant checks. This PR reduces that overhead in three places:
OrgFilterbranches.orgRelationdescendant checks.countObjectscalls during repeated Wicket size/page-count requests.Changes
Sqale org OR optimization
Adds an optimizer for OR filters containing multiple compatible subtree org filters.
Instead of emitting many similar org
EXISTSbranches, compatible branches are grouped and emitted as a single predicate usingancestorOid.in(...).The optimizer preserves fallback behavior for unsupported or mixed branches:
InOidFiltershapes are preservedBatched orgRelation post-filter checks
Adds
OrgTreeEvaluator.isDescendantOfAny(...)and sqale repository support for checking multiple ancestor org OIDs in one closure query.OrgRelationClausenow uses the batched method forALL_DESCENDANTS, while preserving existing semantics:subjectRelationfilters only the principal/subject parent org refsincludeReferenceOrgself-match is checked before descendant lookupALL_DESCENDANTSscopes continue using the existing pathGUI count cache
Adds a short-lived count cache in
SelectableBeanDataProvider.This avoids repeated
countObjectscalls when Wicket asks for provider size/page count multiple times during the same render cycle. The cache key includes:The cache is cleared on provider detach and relevant state changes, and is independent of row/object caching.
Also updates concrete count implementations to use the query passed from
internalSize(), so the counted query matches the cache key.Tests
Added/updated tests for:
isDescendantOfAny(...)OrgRelationClausebatching semanticsValidation
orgRelationbatchingisDescendantOfAny(...)