Description
Currently MongoDocumentStores routes all find query to primary. In some case it is possible to route the call to secondary safely
1. Make use of Max Age
Find call takes a maxAge parameter
find(Collection<T> collection, String key, int maxCacheAge)
If the maxAge is high then its safe to route the call to secondary as the caller explicitly does not want the latest version. This would be specially useful in fetching split documents as such docs are immutable. So logic can first check in secondary and if not found can make a call to primary
2. Make use of modified time of parent
When fetch a path its possible to check if the parent exist in the cache or not. if parent is present in cache we can make use of its modified time. If the modified time is old it indicates that subtree under it has also not been modified. So call for such child can be routed to secondary
In both cases we need to have a time interval defined to switch the logic to secondary call
Attachments
Attachments
Issue Links
- relates to
-
OAK-759 MongoMK: read from a secondary member when possible
- Closed