gianm commented on code in PR #19160:
URL: https://github.com/apache/druid/pull/19160#discussion_r2937269413
##########
server/src/test/java/org/apache/druid/segment/loading/StorageLocationTest.java:
##########
@@ -369,6 +369,33 @@ public void testReserveWeakExistsConcurrency() throws
ExecutionException, Interr
Assertions.assertEquals(0, loc.getActiveWeakHolds());
}
+ @Test
+ public void testReclaimRestoreDoesNotCreateZombieEntries()
+ {
+ StorageLocation location = new StorageLocation(tempDir, 100L, null);
+ CacheEntry entry1 = new TestCacheEntry("1", 10);
+ CacheEntry entry2 = new TestCacheEntry("2", 90);
+ CacheEntry entry3 = new TestCacheEntry("3", 20);
+
+ location.reserveWeak(entry1);
+ // hold entry2 so it cannot be evicted by reclaim
+ StorageLocation.ReservationHold<?> hold2 = location.addWeakReservationHold(
+ entry2.getId(),
+ () -> entry2
+ );
+
+ // must free 20 bytes but can only evict entry1 (10). Fails and restores
entry1
+ // where the bug was a mistmatch caused by creating a new entry in the
list but re-using the old entry for the map.
Review Comment:
mismatch (spelling)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]