Fix too many open files Exception for some tests (#13035)

* init

* fix review

* fix review

* iter
This commit is contained in:
Zhang Chao 2024-02-19 18:35:24 +08:00 committed by GitHub
parent 9a88d8ad25
commit 55df3e02f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -154,6 +154,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
IndexWriter writer =
new IndexWriter(
directory, newIndexWriterConfig(new MockAnalyzer(random())).setMergePolicy(mp));
TestUtil.reduceOpenFiles(writer);
Document doc = new Document();
Field idField = newStringField("id", "", Field.Store.YES);
@ -779,6 +780,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()));
iwc.setMergePolicy(NoMergePolicy.INSTANCE);
iwc.setMaxBufferedDocs(2);
iwc.setUseCompoundFile(true); // reduce open files
IndexWriter w = new IndexWriter(dir, iwc);
int numDocs = TEST_NIGHTLY ? 1000 : 100;
for (int i = 0; i < numDocs; i++) {

View File

@ -258,6 +258,7 @@ public class TestIndexWriterThreadsToSegments extends LuceneTestCase {
IndexWriterConfig iwc = newIndexWriterConfig(r, new MockAnalyzer(r));
iwc.setCommitOnClose(false);
final RandomIndexWriter w = new RandomIndexWriter(r, dir, iwc);
TestUtil.reduceOpenFiles(w.w);
w.setDoRandomForceMerge(false);
Thread[] threads = new Thread[TestUtil.nextInt(random(), 4, 30)];
final CountDownLatch startingGun = new CountDownLatch(1);