MockRandomMP's force merge must also merge away pending but not written deletions

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1667140 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-03-16 21:54:35 +00:00
parent e18c94f1db
commit 39d6e2e38e
2 changed files with 2 additions and 1 deletions

View File

@ -388,6 +388,7 @@ public abstract class BaseNormsFormatTestCase extends BaseIndexFileFormatTestCas
}
w.forceMerge(1);
IndexReader r = w.getReader();
assertFalse(r.hasDeletions());
// Confusingly, norms should exist, and should all be 0, even though we deleted all docs that had the field "content". They should not
// be undead:

View File

@ -97,7 +97,7 @@ public class MockRandomMergePolicy extends MergePolicy {
//System.out.println("MRMP: findMerges sis=" + segmentInfos + " eligible=" + eligibleSegments);
MergeSpecification mergeSpec = null;
if (eligibleSegments.size() > 1 || (eligibleSegments.size() == 1 && eligibleSegments.get(0).hasDeletions())) {
if (eligibleSegments.size() > 1 || (eligibleSegments.size() == 1 && isMerged(segmentInfos, eligibleSegments.get(0), writer) == false)) {
mergeSpec = new MergeSpecification();
// Already shuffled having come out of a set but
// shuffle again for good measure: