LUCENE-2118: fix separate failure in TestIndexWriter.testOptimizeMaxNumSegments2; cutover to IndexWriter.waitForMerges

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1034011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-11-11 17:58:26 +00:00
parent 3701a49475
commit c23af909ad
2 changed files with 5 additions and 4 deletions

View File

@ -235,7 +235,8 @@ public class TestIndexWriter extends LuceneTestCase {
for(int i=0;i<19;i++)
writer.addDocument(doc);
((ConcurrentMergeScheduler) writer.getConfig().getMergeScheduler()).sync();
writer.commit();
writer.waitForMerges();
writer.commit();
SegmentInfos sis = new SegmentInfos();
@ -245,9 +246,9 @@ public class TestIndexWriter extends LuceneTestCase {
writer.optimize(7);
writer.commit();
writer.waitForMerges();
sis = new SegmentInfos();
((ConcurrentMergeScheduler) writer.getConfig().getMergeScheduler()).sync();
sis.read(dir);
final int optSegCount = sis.size();

View File

@ -164,7 +164,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
addDoc(writer);
}
writer.commit();
((ConcurrentMergeScheduler) writer.getConfig().getMergeScheduler()).sync();
writer.waitForMerges();
writer.commit();
checkInvariants(writer);
@ -203,7 +203,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
addDoc(writer);
}
writer.commit();
((ConcurrentMergeScheduler) writer.getConfig().getMergeScheduler()).sync();
writer.waitForMerges();
writer.commit();
checkInvariants(writer);
assertEquals(10, writer.maxDoc());