Skip to content

Apache Lucene open-source search software

SOLR-2410: add test that normally hits phase3 cleaning w/ PQ

Yonik Seeleybcc16311a158
diff --git a/solr/src/test/org/apache/solr/search/TestFastLRUCache.java b/solr/src/test/org/apache/solr/search/TestFastLRUCache.java
index d313eb4d597..2d226fbab0f 100644
--- a/solr/src/test/org/apache/solr/search/TestFastLRUCache.java
+++ b/solr/src/test/org/apache/solr/search/TestFastLRUCache.java
@@ -254,6 +254,18 @@ public class TestFastLRUCache extends LuceneTestCase {
cache.destroy();
}
+ // enough randomness to exercise all of the different cache purging phases
+ public void testRandom() {
+ int sz = random.nextInt(100)+5;
+ int lowWaterMark = random.nextInt(sz-3)+1;
+ int keyrange = random.nextInt(sz*3)+1;
+ ConcurrentLRUCache<Integer, String> cache = new ConcurrentLRUCache<Integer, String>(sz, lowWaterMark);
+ for (int i=0; i<10000; i++) {
+ cache.put(random.nextInt(keyrange), "");
+ cache.get(random.nextInt(keyrange));
+ }
+ }
+
void doPerfTest(int iter, int cacheSize, int maxKey) {
long start = System.currentTimeMillis();