You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PAP.isLoaded always checks the isLoaded(entity, hint)
populateDataLoader skips calling PAP.load for any non-maybe-dirty PAPs
For PAR:
PAR.load conditionally pulls in the full load hint only if dirty, otherwise loads the ref
PAR.isLoaded checks maybe-dirty, if dirty checks isLoaded(entity, hint), otherwise loaded
populateDataLoader always calls PAR.load to ensure the ref is loaded
Ideally we want to be able to:
Have a list of ~1000 books with PAPs like isPublic
Create a new 1001st book, and have it calc's isPublic
Have the author that owns 1001 books count a.books.get.sum(b.isPublic.get) without causing the 1000 existing books to load their properties
Also:
In em.flush, we do specifically walk from "actually changed/dirty fields" to "actually need recalced", i.e. em.flush/ReactionsManager will itself only recall relation.load() on known-dirty entities. However this accurate reversal retries async hopping.
We do have a heuristic of "maybe dirty", which can be asked synchronously, but it is just a guess--if we have 1000 books loaded in memory, all of their book.isPublic-s will be "maybe dirty"
It seems like ideally we only want to use "maybe dirty" in synchronous checks like isLoaded, and then once we have the opportunity to be async, i.e. load, we should switch away from the lossy "maybe dirty" and ask ReactionsManager to tell if we're "actually dirty"
This will mean that PAP.load() and PAR.load() become (for PAP) or stay (for PAR) opaque and "ignore" the user's request to load the full load hint. This should be fine.
The only place that needs to override this is em.touch and/or em.recalc.
All other usages of forceReload (that is not touch/recalc) should go away
The text was updated successfully, but these errors were encountered:
stephenh
changed the title
Align PersistedAsyncProperty & Reference behavior
Align ReactiveField & Reference behavior
Mar 23, 2024
Currently:
PAP.load
always pulls in its full load hintPAP.isLoaded
always checks theisLoaded(entity, hint)
populateDataLoader
skips callingPAP.load
for any non-maybe-dirty PAPsFor PAR:
PAR.load
conditionally pulls in the full load hint only if dirty, otherwise loads the refPAR.isLoaded
checks maybe-dirty, if dirty checksisLoaded(entity, hint)
, otherwise loadedpopulateDataLoader
always callsPAR.load
to ensure the ref is loadedIdeally we want to be able to:
isPublic
isPublic
a.books.get.sum(b.isPublic.get)
without causing the 1000 existing books to load their propertiesAlso:
em.flush
, we do specifically walk from "actually changed/dirty fields" to "actually need recalced", i.e.em.flush
/ReactionsManager will itself only recallrelation.load()
on known-dirty entities. However this accurate reversal retries async hopping.book.isPublic
-s will be "maybe dirty"isLoaded
, and then once we have the opportunity to be async, i.e.load
, we should switch away from the lossy "maybe dirty" and ask ReactionsManager to tell if we're "actually dirty"PAP.load()
andPAR.load()
become (for PAP) or stay (for PAR) opaque and "ignore" the user's request to load the full load hint. This should be fine.em.touch
and/orem.recalc
.forceReload
(that is not touch/recalc) should go awayThe text was updated successfully, but these errors were encountered: