mirror of https://github.com/apache/lucene.git
LUCENE-1254: don't reject segments > maxMergeDocs/Size in IW.addIndexesNoOptimize
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@643303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
21b22f8515
commit
378442872f
|
@ -317,13 +317,6 @@ public abstract class LogMergePolicy extends MergePolicy {
|
|||
final SegmentInfo info = infos.info(i);
|
||||
long size = size(info);
|
||||
|
||||
// Refuse to import a segment that's too large
|
||||
if (info.docCount > maxMergeDocs && info.dir != directory)
|
||||
throw new IllegalArgumentException("Segment is too large (" + info.docCount + " docs vs max docs " + maxMergeDocs + ")");
|
||||
|
||||
if (size >= maxMergeSize && info.dir != directory)
|
||||
throw new IllegalArgumentException("Segment is too large (" + size + " vs max size " + maxMergeSize + ")");
|
||||
|
||||
// Floor tiny segments
|
||||
if (size < 1)
|
||||
size = 1;
|
||||
|
|
|
@ -262,20 +262,6 @@ public class TestAddIndexesNoOptimize extends LuceneTestCase {
|
|||
writer.close();
|
||||
|
||||
writer = newWriter(dir, false);
|
||||
int maxMergeDocs = writer.getMaxMergeDocs();
|
||||
writer.setMaxMergeDocs(99);
|
||||
|
||||
try {
|
||||
// upper bound cannot exceed maxMergeDocs
|
||||
writer.addIndexesNoOptimize(new Directory[] { aux });
|
||||
assertTrue(false);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
assertEquals(100, writer.docCount());
|
||||
assertEquals(1, writer.getSegmentCount());
|
||||
}
|
||||
|
||||
writer.setMaxMergeDocs(maxMergeDocs);
|
||||
try {
|
||||
// cannot add self
|
||||
writer.addIndexesNoOptimize(new Directory[] { aux, dir });
|
||||
|
|
Loading…
Reference in New Issue