From bcc16311a158b18027ff8a02d5dbb49f7a5229e9 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Wed, 9 Mar 2011 15:12:16 +0000 Subject: [PATCH] SOLR-2410: add test that normally hits phase3 cleaning w/ PQ git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1079827 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/search/TestFastLRUCache.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 cache = new ConcurrentLRUCache(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();