use SMS when testing LogMP's strict invariants

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1086629 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2011-03-29 15:33:45 +00:00
parent 5da11b6bff
commit 447b497c57
1 changed files with 7 additions and 6 deletions

View File

@ -131,7 +131,8 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer())
.setMaxBufferedDocs(101).setMergePolicy(new LogDocMergePolicy()));
.setMaxBufferedDocs(101).setMergePolicy(new LogDocMergePolicy())
.setMergeScheduler(new SerialMergeScheduler()));
// leftmost* segment has 1 doc
// rightmost* segment has 100 docs
@ -144,8 +145,8 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT,
new MockAnalyzer()).setOpenMode(
OpenMode.APPEND).setMaxBufferedDocs(101).setMergePolicy(
new LogDocMergePolicy()));
OpenMode.APPEND).setMaxBufferedDocs(101).setMergePolicy(new LogDocMergePolicy())
.setMergeScheduler(new SerialMergeScheduler()));
}
writer.close();
@ -153,7 +154,7 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
ldmp.setMergeFactor(10);
writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT,
new MockAnalyzer()).setOpenMode(
OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(ldmp).setMergeScheduler(new ConcurrentMergeScheduler()));
OpenMode.APPEND).setMaxBufferedDocs(10).setMergePolicy(ldmp).setMergeScheduler(new SerialMergeScheduler()));
// merge policy only fixes segments on levels where merges
// have been triggered, so check invariants after all adds
@ -236,13 +237,13 @@ public class TestIndexWriterMergePolicy extends LuceneTestCase {
int segmentCount = writer.getSegmentCount();
for (int i = segmentCount - 1; i >= 0; i--) {
int docCount = writer.getDocCount(i);
assertTrue("docCount=" + docCount + " lowerBound=" + lowerBound + " i=" + i + " segmentCount=" + segmentCount + " index=" + writer.segString(), docCount > lowerBound);
assertTrue("docCount=" + docCount + " lowerBound=" + lowerBound + " upperBound=" + upperBound + " i=" + i + " segmentCount=" + segmentCount + " index=" + writer.segString() + " config=" + writer.getConfig(), docCount > lowerBound);
if (docCount <= upperBound) {
numSegments++;
} else {
if (upperBound * mergeFactor <= maxMergeDocs) {
assertTrue("maxMergeDocs=" + maxMergeDocs + "; numSegments=" + numSegments + "; upperBound=" + upperBound + "; mergeFactor=" + mergeFactor + "; segs=" + writer.segString(), numSegments < mergeFactor);
assertTrue("maxMergeDocs=" + maxMergeDocs + "; numSegments=" + numSegments + "; upperBound=" + upperBound + "; mergeFactor=" + mergeFactor + "; segs=" + writer.segString() + " config=" + writer.getConfig(), numSegments < mergeFactor);
}
do {