rishabhdaim commented on code in PR #3071:
URL: https://github.com/apache/jackrabbit-oak/pull/3071#discussion_r3766820322


##########
oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/api/EvictionListener.java:
##########
@@ -22,9 +22,13 @@
 /**
  * Callback invoked when an entry is removed from the cache.
  *
- * <p>Register via {@link CacheBuilder#evictionListener(EvictionListener)}.
- * The callback is invoked synchronously during cache operations that trigger
- * removal (eviction, invalidation, replacement).</p>
+ * <p>Register via {@link CacheBuilder#evictionListener(EvictionListener)}.</p>
+ *
+ * <p>The callback runs on the cache's maintenance executor, not on the 
triggering thread, so it
+ * may lag behind and observe a key that was already re-inserted. Use {@link 
Cache#cleanUp()} to
+ * drain pending callbacks before relying on external accounting they 
maintain. Exception: with
+ * {@link CacheBuilder#FT_OAK_12290_ASYNC_CACHE_MAINTENANCE_ENABLED} disabled, 
the callback runs
+ * synchronously on the triggering thread instead, as it always did before 
that toggle existed.</p>

Review Comment:
   fixed in 
https://github.com/apache/jackrabbit-oak/pull/3071/commits/9a664888e298537fe6feefb04fdca234204336a5



##########
oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/api/Cache.java:
##########
@@ -144,9 +144,10 @@ public interface Cache<K, V> {
     /**
      * Performs any pending maintenance operations needed by the cache.
      *
-     * <p><em>Note: no Oak module currently calls this method; the CacheLIRS
-     * implementation is a no-op. It may be removed from the interface in a
-     * future release if it remains unused.</em></p>
+     * <p>Applies pending evictions to the cache's internal state before 
returning, but does not
+     * wait for their {@link EvictionListener} callbacks, which still run 
asynchronously (unless
+     * async cache maintenance is disabled, in which case those callbacks 
already ran inline
+     * before this method was even called). The CacheLIRS implementation is a 
no-op.</p>

Review Comment:
   fixed in 
https://github.com/apache/jackrabbit-oak/pull/3071/commits/9a664888e298537fe6feefb04fdca234204336a5



##########
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreRegistrar.java:
##########
@@ -282,6 +283,12 @@ private SegmentNodeStore register() throws IOException {
                 new FeatureToggle(SegmentCache.FT_OAK_12214, 
SegmentCache.FT_OAK_12214_PROPAGATE_L1_HITS_TO_L2_ENABLED),
                 Collections.emptyMap()));
 
+        // OAK-12290: bug-fix toggle (default on) so Caffeine maintenance 
never runs inline
+        // on request, indexer or writer threads while holding the eviction 
lock

Review Comment:
   fixed in 
https://github.com/apache/jackrabbit-oak/pull/3071/commits/9a664888e298537fe6feefb04fdca234204336a5



-- 
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