Being smarter about refreshing object graph

Andrus Adamchik <[email protected]> Thu, 16 Jan 2025 16:29:56 -0500
Newsgroups gmane.comp.java.cayenne.devel
Message-ID <[email protected]>
Hi there,

I wanted to share some findings on our object graph refresh algorithms.

For many years I've mostly relied on query cache to refresh data graphs, almost never depending on on-demand faulting and the shared snapshot cache. But recently I came across a few use cases that exposed pretty big holes in our object graph management:

1. https://issues.apache.org/jira/browse/CAY-2877 

Here multiple somewhat unrelated queries instead of collaborating in retrieving data, stomp on each other, invalidating other's prefetches. 

2. https://issues.apache.org/jira/browse/CAY-2878 

When resolving a certain category of to-one relationships (optional PK to PK), we run a query where we could've taken the object from the cache. 

I probably wouldn't have easily identified #1, if #2 worked as expected, as all those invalidated relationships would've been picked up transparently from the cache. But that of course wouldn't have been very efficient.

I suspect there may be more similar issues, but these are the ones I was able to reproduce. 

Andrus