don't allow O(N^2) merging in this test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1642829 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-12-02 09:30:15 +00:00
parent ce164ff8de
commit facb9a0158
1 changed files with 21 additions and 3 deletions

View File

@ -120,6 +120,9 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
IndexWriterConfig iwc = getIndexWriterConfig(); IndexWriterConfig iwc = getIndexWriterConfig();
iwc.setMergePolicy(new ReindexingMergePolicy(iwc.getMergePolicy())); iwc.setMergePolicy(new ReindexingMergePolicy(iwc.getMergePolicy()));
if (DEBUG) {
System.out.println("TEST: use IWC:\n" + iwc);
}
w = new IndexWriter(indexDir, iwc); w = new IndexWriter(indexDir, iwc);
w.getConfig().setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() { w.getConfig().setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
@ -644,7 +647,12 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
return new ReindexingReader(root) { return new ReindexingReader(root) {
@Override @Override
protected IndexWriterConfig getIndexWriterConfig() throws IOException { protected IndexWriterConfig getIndexWriterConfig() throws IOException {
return newIndexWriterConfig(); IndexWriterConfig iwc = newIndexWriterConfig();
TieredMergePolicy tmp = new TieredMergePolicy();
// We write tiny docs, so we need tiny floor to avoid O(N^2) merging:
tmp.setFloorSegmentMB(.01);
iwc.setMergePolicy(tmp);
return iwc;
} }
@Override @Override
@ -694,7 +702,12 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
return new ReindexingReader(root) { return new ReindexingReader(root) {
@Override @Override
protected IndexWriterConfig getIndexWriterConfig() throws IOException { protected IndexWriterConfig getIndexWriterConfig() throws IOException {
return newIndexWriterConfig(); IndexWriterConfig iwc = newIndexWriterConfig();
TieredMergePolicy tmp = new TieredMergePolicy();
// We write tiny docs, so we need tiny floor to avoid O(N^2) merging:
tmp.setFloorSegmentMB(.01);
iwc.setMergePolicy(tmp);
return iwc;
} }
@Override @Override
@ -780,7 +793,12 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
return new ReindexingReader(root) { return new ReindexingReader(root) {
@Override @Override
protected IndexWriterConfig getIndexWriterConfig() throws IOException { protected IndexWriterConfig getIndexWriterConfig() throws IOException {
return newIndexWriterConfig(); IndexWriterConfig iwc = newIndexWriterConfig();
TieredMergePolicy tmp = new TieredMergePolicy();
// We write tiny docs, so we need tiny floor to avoid O(N^2) merging:
tmp.setFloorSegmentMB(.01);
iwc.setMergePolicy(tmp);
return iwc;
} }
@Override @Override