romseygeek commented on code in PR #15723:
URL: https://github.com/apache/lucene/pull/15723#discussion_r2826475462
##########
lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java:
##########
@@ -1603,6 +1608,194 @@ public void testReaderNotSuitedForCaching() throws
IOException {
dir.close();
}
+ public void testSkipCacheIfOngoing() throws Exception {
+ Directory dir = newDirectory();
+ IndexWriterConfig iwc = new IndexWriterConfig();
+ IndexWriter w = new IndexWriter(dir, iwc);
+ int numThreads = RandomNumbers.randomIntBetween(random(), 2, 6);
+ int numDocs = numThreads * 100;
+ for (int i = 0; i < numDocs; i++) {
+ var doc = new Document();
+ doc.add(new StringField("doc", Integer.toString(i), Store.NO));
+ w.addDocument(doc);
+ }
+ DirectoryReader reader = DirectoryReader.open(w);
+ assertThat(reader.leaves(), hasSize(1));
+ LeafReaderContext singleLeaf = reader.leaves().get(0);
+
+ AtomicInteger visited = new AtomicInteger(0);
Review Comment:
It took me a while to work out what this test was actually doing (dividing
up the document space into numThreads sections, and searching each section
separately in its own thread) - maybe add some comments to make it a bit
clearer?
--
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]