Apache Lucene open-source search software
Merging r1059823 through r1061974 into realtime branch
Michael Busch60adb90db34d
diff --cc lucene/src/java/org/apache/lucene/index/DocInverterPerField.javaindex b48c91cfcaf,d360fbfb230..6b4d14d5231--- a/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java+++ b/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java@@@ -169,16 -166,11 +167,12 @@@ final class DocInverterPerField extendconsumer.add();success = true;} finally {- if (!success)+ if (!success) {docState.docWriter.setAborting();+ }}+ fieldState.length++;fieldState.position++;- if (++fieldState.length >= maxFieldLength) {- if (docState.infoStream != null)- docState.infoStream.println("maxFieldLength " +maxFieldLength+ " reached for field " + fieldInfo.name + ", ignoring following tokens");- break;- }hasMoreTokens = stream.incrementToken();}diff --cc lucene/src/java/org/apache/lucene/index/DocumentsWriter.javaindex 4746952fb9c,617a70a802e..da0a7283e10--- a/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java+++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java@@@ -103,21 -110,156 +103,20 @@@ import org.apache.lucene.store.Directorfinal class DocumentsWriter {final AtomicLong bytesUsed = new AtomicLong(0);- IndexWriter writer;Directory directory;- String segment; // Current segment we are working on-- private int nextDocID; // Next docID to be added- private int numDocs; // # of docs added, but not yet flushed-- // Max # ThreadState instances; if there are more threads- // than this they share ThreadStates- private DocumentsWriterThreadState[] threadStates = new DocumentsWriterThreadState[0];- private final HashMap<Thread,DocumentsWriterThreadState> threadBindings = new HashMap<Thread,DocumentsWriterThreadState>();-boolean bufferIsFull; // True when it's time to write segment- private boolean aborting; // True if an abort is pending+ private volatile boolean closed;PrintStream infoStream;- int maxFieldLength = IndexWriterConfig.UNLIMITED_FIELD_LENGTH;Similarity similarity;- // max # simultaneous threads; if there are more than- // this, they wait for others to finish first- private final int maxThreadStates;-- // Deletes for our still-in-RAM (to be flushed next) segment- private SegmentDeletes pendingDeletes = new SegmentDeletes();-- static class DocState {- DocumentsWriter docWriter;- Analyzer analyzer;- PrintStream infoStream;- Similarity similarity;- int docID;- Document doc;- String maxTermPrefix;-- // Only called by asserts- public boolean testPoint(String name) {- return docWriter.writer.testPoint(name);- }-- public void clear() {- // don't hold onto doc nor analyzer, in case it is- // largish:- doc = null;- analyzer = null;- }- }-- /** Consumer returns this on each doc. This holds any- * state that must be flushed synchronized "in docID- * order". We gather these and flush them in order. */- abstract static class DocWriter {- DocWriter next;- int docID;- abstract void finish() throws IOException;- abstract void abort();- abstract long sizeInBytes();-- void setNext(DocWriter next) {- this.next = next;- }- }-- /**- * Create and return a new DocWriterBuffer.- */- PerDocBuffer newPerDocBuffer() {- return new PerDocBuffer();- }+ List<String> newFiles;- /**- * RAMFile buffer for DocWriters.- */- @SuppressWarnings("serial")- class PerDocBuffer extends RAMFile {-- /**- * Allocate bytes used from shared pool.- */- @Override- protected byte[] newBuffer(int size) {- assert size == PER_DOC_BLOCK_SIZE;- return perDocAllocator.getByteBlock();- }-- /**- * Recycle the bytes used.- */- synchronized void recycle() {- if (buffers.size() > 0) {- setLength(0);-- // Recycle the blocks- perDocAllocator.recycleByteBlocks(buffers);- buffers.clear();- sizeInBytes = 0;-- assert numBuffers() == 0;- }- }- }-- /**- * The IndexingChain must define the {@link #getChain(DocumentsWriter)} method- * which returns the DocConsumer that the DocumentsWriter calls to process the- * documents.- */- abstract static class IndexingChain {- abstract DocConsumer getChain(DocumentsWriter documentsWriter);- }-- static final IndexingChain defaultIndexingChain = new IndexingChain() {-- @Override- DocConsumer getChain(DocumentsWriter documentsWriter) {- /*- This is the current indexing chain:-- DocConsumer / DocConsumerPerThread- --> code: DocFieldProcessor / DocFieldProcessorPerThread- --> DocFieldConsumer / DocFieldConsumerPerThread / DocFieldConsumerPerField- --> code: DocFieldConsumers / DocFieldConsumersPerThread / DocFieldConsumersPerField- --> code: DocInverter / DocInverterPerThread / DocInverterPerField- --> InvertedDocConsumer / InvertedDocConsumerPerThread / InvertedDocConsumerPerField- --> code: TermsHash / TermsHashPerThread / TermsHashPerField- --> TermsHashConsumer / TermsHashConsumerPerThread / TermsHashConsumerPerField- --> code: FreqProxTermsWriter / FreqProxTermsWriterPerThread / FreqProxTermsWriterPerField- --> code: TermVectorsTermsWriter / TermVectorsTermsWriterPerThread / TermVectorsTermsWriterPerField- --> InvertedDocEndConsumer / InvertedDocConsumerPerThread / InvertedDocConsumerPerField- --> code: NormsWriter / NormsWriterPerThread / NormsWriterPerField- --> code: StoredFieldsWriter / StoredFieldsWriterPerThread / StoredFieldsWriterPerField- */-- // Build up indexing chain:-- final TermsHashConsumer termVectorsWriter = new TermVectorsTermsWriter(documentsWriter);- final TermsHashConsumer freqProxWriter = new FreqProxTermsWriter();- /*- * nesting TermsHash instances here to allow the secondary (TermVectors) share the interned postings- * via a shared ByteBlockPool. See TermsHashPerField for details.- */- final TermsHash termVectorsTermHash = new TermsHash(documentsWriter, false, termVectorsWriter, null);- final InvertedDocConsumer termsHash = new TermsHash(documentsWriter, true, freqProxWriter, termVectorsTermHash);- final NormsWriter normsWriter = new NormsWriter();- final DocInverter docInverter = new DocInverter(termsHash, normsWriter);- return new DocFieldProcessor(documentsWriter, docInverter);- }- };+ final IndexWriter indexWriter;- final DocConsumer consumer;+ private AtomicInteger numDocsInRAM = new AtomicInteger(0);+ private AtomicLong ramUsed = new AtomicLong(0);// How much RAM we can use before flushing. This is 0 if// we are flushing by doc count instead.@@@ -241,26 -352,15 +240,20 @@@* here. */synchronized void setInfoStream(PrintStream infoStream) {this.infoStream = infoStream;- for(int i=0;i<threadStates.length;i++) {- threadStates[i].docState.infoStream = infoStream;- }+ pushConfigChange();}- synchronized void setMaxFieldLength(int maxFieldLength) {- this.maxFieldLength = maxFieldLength;- pushConfigChange();- }-synchronized void setSimilarity(Similarity similarity) {this.similarity = similarity;- for(int i=0;i<threadStates.length;i++) {- threadStates[i].docState.similarity = similarity;+ pushConfigChange();+ }++ private final void pushConfigChange() {+ Iterator<ThreadState> it = perThreadPool.getAllPerThreadsIterator();+ while (it.hasNext()) {+ DocumentsWriterPerThread perThread = it.next().perThread;+ perThread.docState.infoStream = this.infoStream;- perThread.docState.maxFieldLength = this.maxFieldLength;+ perThread.docState.similarity = this.similarity;}}diff --cc lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.javaindex d0144d1e2a7,00000000000..12fd2de097bmode 100644,000000..100644--- a/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java+++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java@@@ -1,365 -1,0 +1,363 @@@+package org.apache.lucene.index;++/**+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import static org.apache.lucene.util.ByteBlockPool.BYTE_BLOCK_MASK;+import static org.apache.lucene.util.ByteBlockPool.BYTE_BLOCK_SIZE;++import java.io.IOException;+import java.io.PrintStream;+import java.text.NumberFormat;+import java.util.concurrent.atomic.AtomicLong;++import org.apache.lucene.analysis.Analyzer;+import org.apache.lucene.document.Document;+import org.apache.lucene.search.Query;+import org.apache.lucene.search.Similarity;+import org.apache.lucene.store.Directory;+import org.apache.lucene.util.ByteBlockPool.DirectAllocator;+import org.apache.lucene.util.RamUsageEstimator;++public class DocumentsWriterPerThread {++ /**+ * The IndexingChain must define the {@link #getChain(DocumentsWriter)} method+ * which returns the DocConsumer that the DocumentsWriter calls to process the+ * documents.+ */+ abstract static class IndexingChain {+ abstract DocConsumer getChain(DocumentsWriterPerThread documentsWriterPerThread);+ }+++ static final IndexingChain defaultIndexingChain = new IndexingChain() {++ @Override+ DocConsumer getChain(DocumentsWriterPerThread documentsWriterPerThread) {+ /*+ This is the current indexing chain:++ DocConsumer / DocConsumerPerThread+ --> code: DocFieldProcessor / DocFieldProcessorPerThread+ --> DocFieldConsumer / DocFieldConsumerPerThread / DocFieldConsumerPerField+ --> code: DocFieldConsumers / DocFieldConsumersPerThread / DocFieldConsumersPerField+ --> code: DocInverter / DocInverterPerThread / DocInverterPerField+ --> InvertedDocConsumer / InvertedDocConsumerPerThread / InvertedDocConsumerPerField+ --> code: TermsHash / TermsHashPerThread / TermsHashPerField+ --> TermsHashConsumer / TermsHashConsumerPerThread / TermsHashConsumerPerField+ --> code: FreqProxTermsWriter / FreqProxTermsWriterPerThread / FreqProxTermsWriterPerField+ --> code: TermVectorsTermsWriter / TermVectorsTermsWriterPerThread / TermVectorsTermsWriterPerField+ --> InvertedDocEndConsumer / InvertedDocConsumerPerThread / InvertedDocConsumerPerField+ --> code: NormsWriter / NormsWriterPerThread / NormsWriterPerField+ --> code: StoredFieldsWriter / StoredFieldsWriterPerThread / StoredFieldsWriterPerField+ */++ // Build up indexing chain:++ final TermsHashConsumer termVectorsWriter = new TermVectorsTermsWriter(documentsWriterPerThread);+ final TermsHashConsumer freqProxWriter = new FreqProxTermsWriter();++ final InvertedDocConsumer termsHash = new TermsHash(documentsWriterPerThread, freqProxWriter,+ new TermsHash(documentsWriterPerThread, termVectorsWriter, null));+ final NormsWriter normsWriter = new NormsWriter();+ final DocInverter docInverter = new DocInverter(documentsWriterPerThread.docState, termsHash, normsWriter);+ return new DocFieldProcessor(documentsWriterPerThread, docInverter);+ }+ };++ // Deletes for our still-in-RAM (to be flushed next) segment+ SegmentDeletes pendingDeletes = new SegmentDeletes();++ static class DocState {+ final DocumentsWriterPerThread docWriter;+ Analyzer analyzer;- int maxFieldLength;+ PrintStream infoStream;+ Similarity similarity;+ int docID;+ Document doc;+ String maxTermPrefix;++ DocState(DocumentsWriterPerThread docWriter) {+ this.docWriter = docWriter;+ }++ // Only called by asserts+ public boolean testPoint(String name) {+ return docWriter.writer.testPoint(name);+ }+ }++ /** Called if we hit an exception at a bad time (when+ * updating the index files) and must discard all+ * currently buffered docs. This resets our state,+ * discarding any docs added since last flush. */+ void abort() throws IOException {+ aborting = true;+ try {+ if (infoStream != null) {+ message("docWriter: now abort");+ }+ try {+ consumer.abort();+ } catch (Throwable t) {+ }++ pendingDeletes.clear();+ // Reset all postings data+ doAfterFlush();++ } finally {+ aborting = false;+ if (infoStream != null) {+ message("docWriter: done abort");+ }+ }+ }++ final DocumentsWriter parent;+ final IndexWriter writer;++ final Directory directory;+ final DocState docState;+ final DocConsumer consumer;+ private DocFieldProcessor docFieldProcessor;++ String segment; // Current segment we are working on+ boolean aborting; // True if an abort is pending++ private final PrintStream infoStream;+ private int numDocsInRAM;+ private int flushedDocCount;+ SegmentWriteState flushState;++ final AtomicLong bytesUsed = new AtomicLong(0);++ private final FieldInfos fieldInfos;++ public DocumentsWriterPerThread(Directory directory, DocumentsWriter parent, IndexingChain indexingChain) {+ this.directory = directory;+ this.parent = parent;+ this.writer = parent.indexWriter;+ this.fieldInfos = new FieldInfos();+ this.infoStream = parent.indexWriter.getInfoStream();+ this.docState = new DocState(this);+ this.docState.similarity = parent.indexWriter.getConfig().getSimilarity();- this.docState.maxFieldLength = IndexWriterConfig.UNLIMITED_FIELD_LENGTH;++ consumer = indexingChain.getChain(this);+ if (consumer instanceof DocFieldProcessor) {+ docFieldProcessor = (DocFieldProcessor) consumer;+ }+ }++ void setAborting() {+ aborting = true;+ }++ public void updateDocument(Document doc, Analyzer analyzer, Term delTerm) throws IOException {+ assert writer.testPoint("DocumentsWriterPerThread addDocument start");+ docState.doc = doc;+ docState.analyzer = analyzer;+ docState.docID = numDocsInRAM;+ if (delTerm != null) {+ pendingDeletes.addTerm(delTerm, docState.docID);+ }++ if (segment == null) {+ // this call is synchronized on IndexWriter.segmentInfos+ segment = writer.newSegmentName();+ assert numDocsInRAM == 0;+ }++ boolean success = false;+ try {+ consumer.processDocument();++ success = true;+ } finally {+ if (!success) {+ if (!aborting) {+ // mark document as deleted+ deleteDocID(docState.docID);+ numDocsInRAM++;+ } else {+ abort();+ }+ }+ }++ success = false;+ try {+ numDocsInRAM++;+ consumer.finishDocument();++ success = true;+ } finally {+ if (!success) {+ abort();+ }+ }+ }++ // Buffer a specific docID for deletion. Currently only+ // used when we hit a exception when adding a document+ void deleteDocID(int docIDUpto) {+ pendingDeletes.addDocID(docIDUpto);+ // NOTE: we do not trigger flush here. This is+ // potentially a RAM leak, if you have an app that tries+ // to add docs but every single doc always hits a+ // non-aborting exception. Allowing a flush here gets+ // very messy because we are only invoked when handling+ // exceptions so to do this properly, while handling an+ // exception we'd have to go off and flush new deletes+ // which is risky (likely would hit some other+ // confounding exception).+ }++ void deleteQueries(Query... queries) {+ for (Query query : queries) {+ pendingDeletes.addQuery(query, numDocsInRAM);+ }+ }++ void deleteTerms(Term... terms) {+ for (Term term : terms) {+ pendingDeletes.addTerm(term, numDocsInRAM);+ }+ }++ int getNumDocsInRAM() {+ return numDocsInRAM;+ }++ /** Returns true if any of the fields in the current+ * buffered docs have omitTermFreqAndPositions==false */+ boolean hasProx() {+ return (docFieldProcessor != null) ? docFieldProcessor.fieldInfos.hasProx()+ : true;+ }++ SegmentCodecs getCodec() {+ return flushState.segmentCodecs;+ }++ /** Reset after a flush */+ private void doAfterFlush() throws IOException {+ segment = null;+ parent.substractFlushedNumDocs(numDocsInRAM);+ numDocsInRAM = 0;+ }++ /** Flush all pending docs to a new segment */+ SegmentInfo flush() throws IOException {+ assert numDocsInRAM > 0;++ flushState = new SegmentWriteState(infoStream, directory, segment, fieldInfos,+ numDocsInRAM, writer.getConfig().getTermIndexInterval(),+ SegmentCodecs.build(fieldInfos, writer.codecs));++ if (infoStream != null) {+ message("flush postings as segment " + flushState.segmentName + " numDocs=" + numDocsInRAM);+ }++ if (aborting) {+ if (infoStream != null) {+ message("flush: skip because aborting is set");+ }+ return null;+ }++ boolean success = false;++ try {++ SegmentInfo newSegment = new SegmentInfo(segment, flushState.numDocs, directory, false, fieldInfos.hasProx(), flushState.segmentCodecs, false);+ consumer.flush(flushState);+ newSegment.setHasVectors(flushState.hasVectors);++ if (infoStream != null) {+ message("new segment has " + (flushState.hasVectors ? "vectors" : "no vectors"));+ message("flushedFiles=" + newSegment.files());+ message("flushed codecs=" + newSegment.getSegmentCodecs());+ }+ flushedDocCount += flushState.numDocs;++ doAfterFlush();++ success = true;++ return newSegment;+ } finally {+ if (!success) {+ if (segment != null) {+ synchronized(parent.indexWriter) {+ parent.indexWriter.deleter.refresh(segment);+ }+ }++ abort();+ }+ }+ }++ /** Get current segment name we are writing. */+ String getSegment() {+ return segment;+ }++ long bytesUsed() {+ return bytesUsed.get();+ }++ FieldInfos getFieldInfos() {+ return fieldInfos;+ }++ void message(String message) {+ writer.message("DW: " + message);+ }++ NumberFormat nf = NumberFormat.getInstance();++ /* Initial chunks size of the shared byte[] blocks used to+ store postings data */+ final static int BYTE_BLOCK_NOT_MASK = ~BYTE_BLOCK_MASK;++ /* if you increase this, you must fix field cache impl for+ * getTerms/getTermsIndex requires <= 32768 */+ final static int MAX_TERM_LENGTH_UTF8 = BYTE_BLOCK_SIZE-2;++ /* Initial chunks size of the shared int[] blocks used to+ store postings data */+ final static int INT_BLOCK_SHIFT = 13;+ final static int INT_BLOCK_SIZE = 1 << INT_BLOCK_SHIFT;+ final static int INT_BLOCK_MASK = INT_BLOCK_SIZE - 1;++ /* Allocate another int[] from the shared pool */+ int[] getIntBlock() {+ int[] b = new int[INT_BLOCK_SIZE];+ bytesUsed.addAndGet(INT_BLOCK_SIZE*RamUsageEstimator.NUM_BYTES_INT);+ return b;+ }++ final DirectAllocator byteBlockAllocator = new DirectAllocator();++ String toMB(long v) {+ return nf.format(v/1024./1024.);+ }++}diff --cc lucene/src/java/org/apache/lucene/index/IndexWriter.javaindex 95ef0b98f52,34b13037cc0..271dc2a83a1--- a/lucene/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/src/java/org/apache/lucene/index/IndexWriter.java@@@ -766,9 -762,8 +765,8 @@@ public class IndexWriter implements ClosetRollbackSegmentInfos(segmentInfos);- docWriter = new DocumentsWriter(directory, this, conf.getIndexingChain(), conf.getMaxThreadStates(), getCurrentFieldInfos(), bufferedDeletes);+ docWriter = new DocumentsWriter(directory, this, conf.getIndexingChain(), conf.getIndexerThreadPool(), getCurrentFieldInfos(), bufferedDeletes);docWriter.setInfoStream(infoStream);- docWriter.setMaxFieldLength(maxFieldLength);// Default deleter (for backwards compatibility) is// KeepOnlyLastCommitDeleter:@@@ -1176,26 -1171,8 +1174,10 @@@return false;}- /**- * The maximum number of terms that will be indexed for a single field in a- * document. This limits the amount of memory required for indexing, so that- * collections with very large files will not crash the indexing process by- * running out of memory.<p/>- * Note that this effectively truncates large documents, excluding from the- * index terms that occur further in the document. If you know your source- * documents are large, be sure to set this value high enough to accommodate- * the expected size. If you set it to Integer.MAX_VALUE, then the only limit- * is your memory, but you should anticipate an OutOfMemoryError.<p/>- * By default, no more than 10,000 terms will be indexed for a field.- *- * @see MaxFieldLength- */- private int maxFieldLength;-/**- * Adds a document to this index.+ * Adds a document to this index. If the document contains more than+ * {@link IndexWriterConfig#setMaxFieldLength(int)} terms for a given field,+ * the remainder are discarded.** <p> Note that if an Exception is hit (for example disk full)* then the index will be consistent, but this documentdiff --cc lucene/src/java/org/apache/lucene/index/IndexWriterConfig.javaindex 551538655e2,e8b6eb4a2c3..80ad08e5b3b--- a/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java+++ b/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java@@@ -53,9 -51,9 +51,9 @@@ public final class IndexWriterConfig im* </ul>*/public static enum OpenMode { CREATE, APPEND, CREATE_OR_APPEND }-+/** Default value is 32. Change using {@link #setTermIndexInterval(int)}. */- public static final int DEFAULT_TERM_INDEX_INTERVAL = 32; // TODO: this should be private to the codec, not settable here+ public static final int DEFAULT_TERM_INDEX_INTERVAL = 32; // TODO: this should be private to the codec, not settable here/** Denotes a flush trigger is disabled. */public final static int DISABLE_AUTO_FLUSH = -1;diff --cc lucene/src/test/org/apache/lucene/index/TestIndexWriter.javaindex d6da14e7350,554fa5bc165..33d6c6b91e7--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java@@@ -782,9 -782,9 +782,9 @@@ public class TestIndexWriter extends Lu}public void testHighFreqTerm() throws IOException {- MockDirectoryWrapper dir = newDirectory();+ MockDirectoryWrapper dir = newDirectory();IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(- TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxFieldLength(100000000).setRAMBufferSizeMB(0.01));+ TEST_VERSION_CURRENT, new MockAnalyzer()).setRAMBufferSizeMB(0.01));// Massive doc that has 128 K a'sStringBuilder b = new StringBuilder(1024*1024);for(int i=0;i<4096;i++) {diff --cc lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.javaindex 557fddf17dc,909e67833d7..ee2e5497d5c--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterConfig.java@@@ -25,8 -24,7 +24,7 @@@ import java.util.HashSetimport java.util.Set;import org.apache.lucene.analysis.MockAnalyzer;-import org.apache.lucene.index.DocumentsWriter.IndexingChain;+import org.apache.lucene.index.DocumentsWriterPerThread.IndexingChain;- import org.apache.lucene.index.IndexWriter.IndexReaderWarmer;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.search.DefaultSimilarity;import org.apache.lucene.search.Similarity;@@@ -43,21 -41,12 +41,12 @@@ public class TestIndexWriterConfig exte// Does not implement anything - used only for type checking on IndexWriterConfig.@Override- DocConsumer getChain(DocumentsWriter documentsWriter) {+ DocConsumer getChain(DocumentsWriterPerThread documentsWriter) {return null;}-+}- private static final class MyWarmer extends IndexReaderWarmer {- // Does not implement anything - used only for type checking on IndexWriterConfig.-- @Override- public void warm(IndexReader reader) throws IOException {- }-- }-@Testpublic void testDefaults() throws Exception {IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer());diff --cc lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.javaindex 4ad1a458f8e,cc5638fc56d..c0a8294a801--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java@@@ -49,9 -49,9 +49,9 @@@ public class TestIndexWriterOnJRECrash@Overridepublic void testNRTThreads() throws Exception {String vendor = Constants.JAVA_VENDOR;- assumeTrue(vendor + " JRE not supported.",+ assumeTrue(vendor + " JRE not supported.",- vendor.startsWith("Sun") || vendor.startsWith("IBM") || vendor.startsWith("Apple"));+ vendor.startsWith("Sun") || vendor.startsWith("Apple"));-+// if we are not the forkif (System.getProperty("tests.crashmode") == null) {// try up to 10 times to create an index