From 19d2e70a7c9fb5e3ac3e93e77630c3f7a55cfb33 Mon Sep 17 00:00:00 2001 From: William Burns Date: Tue, 30 Jan 2024 14:18:29 -0800 Subject: [PATCH] ISPN-15555 Update com.github.ben-manes.caffeine:caffeine to 3.1.8 --- build/configuration/pom.xml | 2 +- .../util/concurrent/DataOperationOrderer.java | 8 ++++++++ .../java/org/infinispan/stats/SingleStatsTest.java | 5 +++++ .../JdbcStringBasedCacheStorePassivation.java | 10 +++++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/build/configuration/pom.xml b/build/configuration/pom.xml index be069603d700..891244587911 100644 --- a/build/configuration/pom.xml +++ b/build/configuration/pom.xml @@ -134,7 +134,7 @@ 1.0.8.RELEASE 1.70 4.0.21 - 3.1.1 + 3.1.8 1.21 14.0.15.Final 6.3.1 diff --git a/core/src/main/java/org/infinispan/util/concurrent/DataOperationOrderer.java b/core/src/main/java/org/infinispan/util/concurrent/DataOperationOrderer.java index 4660d614870c..7cfa5c662416 100644 --- a/core/src/main/java/org/infinispan/util/concurrent/DataOperationOrderer.java +++ b/core/src/main/java/org/infinispan/util/concurrent/DataOperationOrderer.java @@ -20,6 +20,14 @@ public class DataOperationOrderer { private final ConcurrentMap> objectStages = new ConcurrentHashMap<>(); + /** + * Returns how many keys have pending operations waiting for their completion + * @return number of keys with pending operations + */ + public int pendingOperations() { + return objectStages.size(); + } + public enum Operation { READ, REMOVE, diff --git a/core/src/test/java/org/infinispan/stats/SingleStatsTest.java b/core/src/test/java/org/infinispan/stats/SingleStatsTest.java index 7039a8bc05d3..c2babba35020 100644 --- a/core/src/test/java/org/infinispan/stats/SingleStatsTest.java +++ b/core/src/test/java/org/infinispan/stats/SingleStatsTest.java @@ -21,7 +21,9 @@ import org.infinispan.eviction.EvictionStrategy; import org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder; import org.infinispan.test.MultipleCacheManagersTest; +import org.infinispan.test.TestingUtil; import org.infinispan.transaction.TransactionMode; +import org.infinispan.util.concurrent.DataOperationOrderer; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; @@ -146,6 +148,9 @@ public void testStats() { fail("Number of failed errors was: " + insertErrors + " manually check them."); } + DataOperationOrderer doo = TestingUtil.extractComponent(cache, DataOperationOrderer.class); + eventually(() -> doo.pendingOperations() == 0); + int expectedSize = TOTAL_ENTRIES - insertErrors; refreshStats(); diff --git a/server/tests/src/test/java/org/infinispan/server/persistence/JdbcStringBasedCacheStorePassivation.java b/server/tests/src/test/java/org/infinispan/server/persistence/JdbcStringBasedCacheStorePassivation.java index 6acce1924a85..12661ab8186c 100644 --- a/server/tests/src/test/java/org/infinispan/server/persistence/JdbcStringBasedCacheStorePassivation.java +++ b/server/tests/src/test/java/org/infinispan/server/persistence/JdbcStringBasedCacheStorePassivation.java @@ -4,6 +4,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import org.infinispan.client.hotrod.Flag; import org.infinispan.client.hotrod.RemoteCache; import org.infinispan.commons.test.Eventually; @@ -164,7 +168,11 @@ public void testFailoverWithPassivation(Database database) throws Exception { assertEquals(0, getNumberOfEntriesInMemory(cache)); assertEquals(1, table.countAllRows()); - assertEquals("v1", cache.get("k1")); + // Eviction may not always remove k1 + List> list = new ArrayList<>(cache.entrySet()); + assertEquals(1, list.size()); + Map.Entry entry = list.get(0); + assertEquals(entry.getValue().substring(1), entry.getKey().substring(1)); } }