Skip to content

Apache Lucene open-source search software

SOLR-9284: Reduce off heap cache size and fix test asserts.

markrmiller358c164620f7
diff --git a/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java b/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
index f21b5aae1d1..5e4f1c59a23 100644
--- a/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
+++ b/solr/core/src/test/org/apache/solr/store/blockcache/BlockDirectoryTest.java
@@ -115,7 +115,7 @@ public class BlockDirectoryTest extends SolrTestCaseJ4 {
Metrics metrics = new Metrics();
int blockSize = 8192;
int slabSize = blockSize * 32768;
- long totalMemory = 2 * slabSize;
+ long totalMemory = 1 * slabSize;
BlockCache blockCache = new BlockCache(metrics, true, totalMemory, slabSize, blockSize);
BlockDirectoryCache cache = new BlockDirectoryCache(blockCache, "/collection1", metrics, true);
directory = new BlockDirectory("test", dir, cache, null, true, false);
@@ -267,7 +267,11 @@ public class BlockDirectoryTest extends SolrTestCaseJ4 {
BlockDirectory d = directory;
assertTrue(d.useReadCache("", IOContext.DEFAULT));
- assertTrue(d.useWriteCache("", IOContext.DEFAULT));
+ if (d.getCache() instanceof MapperCache) {
+ assertTrue(d.useWriteCache("", IOContext.DEFAULT));
+ } else {
+ assertFalse(d.useWriteCache("", IOContext.DEFAULT));
+ }
assertFalse(d.useWriteCache("", mergeContext));
d = new BlockDirectory("test", directory, mapperCache, null, true, false);
@@ -277,7 +281,11 @@ public class BlockDirectoryTest extends SolrTestCaseJ4 {
d = new BlockDirectory("test", directory, mapperCache, null, false, true);
assertFalse(d.useReadCache("", IOContext.DEFAULT));
- assertTrue(d.useWriteCache("", IOContext.DEFAULT));
+ if (d.getCache() instanceof MapperCache) {
+ assertTrue(d.useWriteCache("", IOContext.DEFAULT));
+ } else {
+ assertFalse(d.useWriteCache("", IOContext.DEFAULT));
+ }
assertFalse(d.useWriteCache("", mergeContext));
}
}