Conversation
…questors (+ repro IT) Rendering notifications resolved objectId with service finds per row (up to 3 for role types) plus role assignments per row and requestors per row. Measured on a 12-notification/9-object fixture: legacy 71 SELECTs. - InAppNotificationsJsonPrinter: preload() partitions ids by target kind and loads everything with fixed IN queries (dv objects, files with to-one closure, versions, display graphs); per-page cache for effective role assignments; 4-arg addFieldsByType resolves from the preload (same JSON branches as before). - New batch service methods: DvObjectServiceBean.findDvObjectsByIds, DataFileServiceBean.findFilesByIds, DatasetVersionServiceBean .findVersionsByIds, DatasetServiceBean.preloadDisplayGraphs, DataFileServiceBean.preloadFileMetadatas. To-one fetch closures only (no cartesian products, no 6169 exposure: batch annotations are deliberately NOT used - measured @BatchFetch does not reroute EAGER-at-build loading with weaving disabled). - JsonPrinter.json loop preloads once per page. - UserNotificationServiceBean.findByUser fetches requestors (11->7). - NotificationRenderBudgetIT: legacy-vs-preloaded (71->50), repeat notifications add ~zero queries, JSON content asserts, zero writes. Draft: for private perf review; not yet proposed upstream.
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.
Problem (upstream IQSS#2892, private repro)
Rendering a notifications page resolves each row's
objectIdwith servicefind()calls (up to 3 sequential finds for role notifications), plusgetEffectiveRoleAssignmentsper row and requestor loads per row. Measured on a 12-notification/9-object fixture: 71 SELECTs for the legacy per-row pattern.Fix
InAppNotificationsJsonPrinter.preload(): partitions notification ids by target kind (from the type switch) and loads everything with a fixed set ofINqueries - dv objects, files with full to-one closure, versions, dataset display graphs (versions+fields), file metadatas - plus a per-page cache of effective role assignments keyed by (user, object).DvObjectServiceBean.findDvObjectsByIds,DataFileServiceBean.findFilesByIds,DatasetVersionServiceBean.findVersionsByIds,DatasetServiceBean.preloadDisplayGraphs,DataFileServiceBean.preloadFileMetadatas. To-one fetch closures only: no cartesian products. Inverse-side collections are set, never join-fetched (verified zero writes).JsonPrinter.jsonloop preloads once per page; new 4-argaddFieldsByTyperesolves from the preload with identical JSON branches (old 3-arg delegates for single use).UserNotificationServiceBean.findByUserfetch-joins requestors (11 -> 7 on the fixture; delta is exactly the 4 requestor loads).Verification
NotificationRenderBudgetIT(real services wired with the test EM, incl. the permission/group chain): legacy-vs-preloaded 71 -> 50, repeated notifications add ~zero queries (51 vs 50, 1 query of documented L1-order tolerance), JSON content asserts per type, zero writes.Notes / follow-ups
@BatchFetchdoes NOT reroute EAGER-at-build loading with weaving disabled (24 queries before and after annotating), so to-one EAGER residuals need fetch joins, not batch annotations. Relevant when reviewing upstream Faster file and dataset pages for datasets with many files IQSS/dataverse#12740's to-one annotations.