nandini12396 commented on code in PR #21089:
URL: https://github.com/apache/kafka/pull/21089#discussion_r2644793403


##########
storage/src/test/java/org/apache/kafka/storage/internals/log/RemoteIndexCacheTest.java:
##########
@@ -1309,4 +1309,103 @@ private Set<Thread> getRunningCleanerThread() {
                 .filter(t -> t.isAlive() && 
t.getName().startsWith(REMOTE_LOG_INDEX_CACHE_CLEANER_THREAD))
                 .collect(Collectors.toSet());
     }
+
+    @Test
+    public void testCacheTtlCanBeDisabled() throws IOException {
+        // Test that TTL can be disabled by setting it to -1
+        long ttlMs = -1L;
+        FakeTicker fakeTicker = new FakeTicker();
+        RemoteIndexCache ttlCache = new RemoteIndexCache(1024 * 1024L, ttlMs, 
rsm, logDir.toString(), fakeTicker);
+        try {
+            RemoteIndexCache.Entry entry = ttlCache.getIndexEntry(rlsMetadata);
+            assertNotNull(entry);
+
+            fakeTicker.advance(TimeUnit.HOURS.toNanos(24));
+            ttlCache.internalCache().cleanUp();
+
+            RemoteIndexCache.Entry cachedEntry = 
ttlCache.internalCache().getIfPresent(rlsMetadata.remoteLogSegmentId().id());
+            assertNotNull(cachedEntry, "Entry should remain cached when TTL 
disabled");
+        } finally {
+            Utils.closeQuietly(ttlCache, "RemoteIndexCache");
+        }
+    }
+
+    @Test
+    public void testCacheTtlEviction() throws IOException {

Review Comment:
   Added, PTAL



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