nfsantos opened a new pull request, #3150:
URL: https://github.com/apache/jackrabbit-oak/pull/3150

   ## Summary
   
`WriterCacheManager.AccessTrackingCacheManager#getStringCache`/`getTemplateCache`/`getNodeCache`
 are invoked once per record written. Each call currently re-registers the 
corresponding `CounterStats` via `StatisticsProvider#getCounterStats` and 
allocates a new `CacheAccessTracker` wrapper, which does a map lookup/insert in 
the statistics registry on every write.
   
   - Register the six `CounterStats` (access/miss count per cache kind) once in 
the `AccessTrackingCacheManager` constructor.
   - Add a `CacheAccessTracker` constructor that accepts already-registered 
`CounterStats` directly, so the per-write path only allocates the lightweight 
wrapper.
   - Keep the existing `CacheAccessTracker(String, StatisticsProvider, Cache)` 
constructor, deprecated in favor of the new one, for compatibility.
   
   No functional/API change: the wrapper cache is still resolved from the 
delegate on every call (not memoized), so cache generation eviction/recreation 
semantics are preserved; only the statistics registration is hoisted out of the 
hot path.
   
   Jira: https://issues.apache.org/jira/browse/OAK-12416
   
   ## Test plan
   - `mvn -pl oak-segment-tar test 
-Dtest=CacheAccessTrackerTest,WriteCacheManagerTest` — 5/5 and 5/5 pass 
(including new tests covering delegate forwarding, staleness-avoidance after 
eviction, and shared statistics across calls).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to