let tests.verbose tell the story

This commit is contained in:
Robert Muir 2015-04-18 13:48:33 -04:00
parent 5bcd599cb3
commit d301567ecf
2 changed files with 10 additions and 1 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.index.engine; package org.elasticsearch.index.engine;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.lucene.index.*; import org.apache.lucene.index.*;
import org.apache.lucene.index.IndexWriter.IndexReaderWarmer; import org.apache.lucene.index.IndexWriter.IndexReaderWarmer;
import org.apache.lucene.search.*; import org.apache.lucene.search.*;
@ -27,6 +28,7 @@ import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.LockObtainFailedException; import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.InfoStream;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.cluster.routing.DjbHashFunction; import org.elasticsearch.cluster.routing.DjbHashFunction;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
@ -999,7 +1001,12 @@ public class InternalEngine extends Engine {
iwc.setCommitOnClose(false); // we by default don't commit on close iwc.setCommitOnClose(false); // we by default don't commit on close
iwc.setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND); iwc.setOpenMode(create ? IndexWriterConfig.OpenMode.CREATE : IndexWriterConfig.OpenMode.APPEND);
iwc.setIndexDeletionPolicy(deletionPolicy); iwc.setIndexDeletionPolicy(deletionPolicy);
iwc.setInfoStream(new LoggerInfoStream(logger)); // with tests.verbose, lucene sets this up: plumb to align with filesystem stream
boolean verbose = false;
try {
verbose = Boolean.parseBoolean(System.getProperty("tests.verbose"));
} catch (Throwable ignore) {}
iwc.setInfoStream(verbose ? InfoStream.getDefault() : new LoggerInfoStream(logger));
iwc.setMergeScheduler(mergeScheduler.newMergeScheduler()); iwc.setMergeScheduler(mergeScheduler.newMergeScheduler());
MergePolicy mergePolicy = mergePolicyProvider.getMergePolicy(); MergePolicy mergePolicy = mergePolicyProvider.getMergePolicy();
// Give us the opportunity to upgrade old segments while performing // Give us the opportunity to upgrade old segments while performing

View File

@ -1405,6 +1405,7 @@ public class InternalEngineTests extends ElasticsearchTestCase {
@Test @Test
public void testIndexWriterInfoStream() { public void testIndexWriterInfoStream() {
assumeFalse("who tests the tester?", VERBOSE);
MockAppender mockAppender = new MockAppender(); MockAppender mockAppender = new MockAppender();
Logger rootLogger = Logger.getRootLogger(); Logger rootLogger = Logger.getRootLogger();
@ -1433,6 +1434,7 @@ public class InternalEngineTests extends ElasticsearchTestCase {
// #8603: make sure we can separately log IFD's messages // #8603: make sure we can separately log IFD's messages
public void testIndexWriterIFDInfoStream() { public void testIndexWriterIFDInfoStream() {
assumeFalse("who tests the tester?", VERBOSE);
MockAppender mockAppender = new MockAppender(); MockAppender mockAppender = new MockAppender();
// Works when running this test inside Intellij: // Works when running this test inside Intellij: