Skip to content

Apache Lucene open-source search software

Merge r1054504 through r1058716 into realtime branch

Michael Busch2860bd2a405e
diff --cc lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
index 95f8842e91c,e7e34e5d9a5..5cb4af37c06
--- a/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
+++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriter.java
@@@ -361,263 -542,620 +361,257 @@@ final class DocumentsWriter
return pendingDeletes.any();
}
- /** Flush all pending docs to a new segment */
- // Lock order: IW -> DW
- synchronized SegmentInfo flush(IndexWriter writer, IndexFileDeleter deleter, MergePolicy mergePolicy, SegmentInfos segmentInfos) throws IOException {
-
- // We change writer's segmentInfos:
- assert Thread.holdsLock(writer);
-
- waitIdle();
-
- if (numDocs == 0) {
- // nothing to do!
- if (infoStream != null) {
- message("flush: no docs; skipping");
- }
- // Lock order: IW -> DW -> BD
- pushDeletes(null, segmentInfos);
- return null;
- }
-
- if (aborting) {
- if (infoStream != null) {
- message("flush: skip because aborting is set");
- }
- return null;
- }
+ synchronized void close() {
+ closed = true;
+ notifyAll();
+ }
- boolean success = false;
+ boolean updateDocument(final Document doc, final Analyzer analyzer, final Term delTerm)
+ throws CorruptIndexException, IOException {
+ ensureOpen();
- Collection<String> flushedFiles = null;
- SegmentInfo newSegment;
+ SegmentInfo newSegment = null;
+ ThreadState perThread = perThreadPool.getAndLock(Thread.currentThread(), this, doc);
try {
- assert nextDocID == numDocs;
- assert waitQueue.numWaiting == 0;
- assert waitQueue.waitingBytes == 0;
+ DocumentsWriterPerThread dwpt = perThread.perThread;
+ long perThreadRAMUsedBeforeAdd = dwpt.bytesUsed();
+ dwpt.addDocument(doc, analyzer);
- if (infoStream != null) {
- message("flush postings as segment " + segment + " numDocs=" + numDocs);
- }
-
- final SegmentWriteState flushState = new SegmentWriteState(infoStream, directory, segment, fieldInfos,
- numDocs, writer.getConfig().getTermIndexInterval(),
- SegmentCodecs.build(fieldInfos, writer.codecs));
-
- newSegment = new SegmentInfo(segment, numDocs, directory, false, fieldInfos.hasProx(), flushState.segmentCodecs, false);
-
- Collection<DocConsumerPerThread> threads = new HashSet<DocConsumerPerThread>();
- for (DocumentsWriterThreadState threadState : threadStates) {
- threads.add(threadState.consumer);
- }
-
- double startMBUsed = bytesUsed()/1024./1024.;
-
- consumer.flush(threads, 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());
- }
-
- if (mergePolicy.useCompoundFile(segmentInfos, newSegment)) {
- final String cfsFileName = IndexFileNames.segmentFileName(segment, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
-
- if (infoStream != null) {
- message("flush: create compound file \"" + cfsFileName + "\"");
+ synchronized(DocumentsWriter.this) {
+ if (delTerm != null) {
+ deleteTerm(delTerm);
}
-
- CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, cfsFileName);
- for(String fileName : newSegment.files()) {
- cfsWriter.addFile(fileName);
- }
- cfsWriter.close();
- deleter.deleteNewFiles(newSegment.files());
- newSegment.setUseCompoundFile(true);
+ dwpt.commitDocument();
+ numDocsInRAM.incrementAndGet();
}
- if (infoStream != null) {
- message("flush: segment=" + newSegment);
- final double newSegmentSizeNoStore = newSegment.sizeInBytes(false)/1024./1024.;
- final double newSegmentSize = newSegment.sizeInBytes(true)/1024./1024.;
- message(" ramUsed=" + nf.format(startMBUsed) + " MB" +
- " newFlushedSize=" + nf.format(newSegmentSize) + " MB" +
- " (" + nf.format(newSegmentSizeNoStore) + " MB w/o doc stores)" +
- " docs/MB=" + nf.format(numDocs / newSegmentSize) +
- " new/old=" + nf.format(100.0 * newSegmentSizeNoStore / startMBUsed) + "%");
+ newSegment = finishAddDocument(dwpt, perThreadRAMUsedBeforeAdd);
+ if (newSegment != null) {
+ perThreadPool.clearThreadBindings(perThread);
- flushedFiles = new HashSet<String>();
- flushedFiles.addAll(dwpt.flushState.flushedFiles);
}
- success = true;
} finally {
- notifyAll();
- if (!success) {
- if (segment != null) {
- deleter.refresh(segment);
- }
- abort();
- }
+ perThread.unlock();
}
- doAfterFlush();
-
- // Lock order: IW -> DW -> BD
- pushDeletes(newSegment, segmentInfos);
+ if (newSegment != null) {
- finishFlushedSegment(newSegment, flushedFiles);
++ finishFlushedSegment(newSegment);
+ return true;
+ }
- return newSegment;
+ return false;
}
- synchronized void close() {
- closed = true;
- notifyAll();
- }
+ private final SegmentInfo finishAddDocument(DocumentsWriterPerThread perThread,
+ long perThreadRAMUsedBeforeAdd) throws IOException {
+ SegmentInfo newSegment = null;
- /** Returns a free (idle) ThreadState that may be used for
- * indexing this one document. This call also pauses if a
- * flush is pending. If delTerm is non-null then we
- * buffer this deleted term after the thread state has
- * been acquired. */
- synchronized DocumentsWriterThreadState getThreadState(Document doc, Term delTerm) throws IOException {
-
- final Thread currentThread = Thread.currentThread();
- assert !Thread.holdsLock(writer);
-
- // First, find a thread state. If this thread already
- // has affinity to a specific ThreadState, use that one
- // again.
- DocumentsWriterThreadState state = threadBindings.get(currentThread);
- if (state == null) {
-
- // First time this thread has called us since last
- // flush. Find the least loaded thread state:
- DocumentsWriterThreadState minThreadState = null;
- for(int i=0;i<threadStates.length;i++) {
- DocumentsWriterThreadState ts = threadStates[i];
- if (minThreadState == null || ts.numThreads < minThreadState.numThreads) {
- minThreadState = ts;
- }
- }
- if (minThreadState != null && (minThreadState.numThreads == 0 || threadStates.length >= maxThreadStates)) {
- state = minThreadState;
- state.numThreads++;
- } else {
- // Just create a new "private" thread state
- DocumentsWriterThreadState[] newArray = new DocumentsWriterThreadState[1+threadStates.length];
- if (threadStates.length > 0) {
- System.arraycopy(threadStates, 0, newArray, 0, threadStates.length);
- }
- state = newArray[threadStates.length] = new DocumentsWriterThreadState(this);
- threadStates = newArray;
- }
- threadBindings.put(currentThread, state);
- }
-
- // Next, wait until my thread state is idle (in case
- // it's shared with other threads), and no flush/abort
- // pending
- waitReady(state);
+ int numDocsPerThread = perThread.getNumDocsInRAM();
+ if (perThread.getNumDocsInRAM() == maxBufferedDocs) {
+ newSegment = perThread.flush();
- // Allocate segment name if this is the first doc since
- // last flush:
- if (segment == null) {
- segment = writer.newSegmentName();
- assert numDocs == 0;
+ int oldValue = numDocsInRAM.get();
+ while (!numDocsInRAM.compareAndSet(oldValue, oldValue - numDocsPerThread)) {
+ oldValue = numDocsInRAM.get();
+ }
}
- state.docState.docID = nextDocID++;
-
- if (delTerm != null) {
- pendingDeletes.addTerm(delTerm, state.docState.docID);
+ long deltaRAM = perThread.bytesUsed() - perThreadRAMUsedBeforeAdd;
+ long oldValue = ramUsed.get();
+ while (!ramUsed.compareAndSet(oldValue, oldValue + deltaRAM)) {
+ oldValue = ramUsed.get();
}
- numDocs++;
- state.isIdle = false;
- return state;
- }
-
- boolean addDocument(Document doc, Analyzer analyzer) throws CorruptIndexException, IOException {
- return updateDocument(doc, analyzer, null);
+ return newSegment;
}
-
- boolean updateDocument(Document doc, Analyzer analyzer, Term delTerm)
- throws CorruptIndexException, IOException {
-
- // Possibly trigger a flush, or wait until any running flush completes:
- boolean doFlush = flushControl.waitUpdate(1, delTerm != null ? 1 : 0);
-
- // This call is synchronized but fast
- final DocumentsWriterThreadState state = getThreadState(doc, delTerm);
-
- final DocState docState = state.docState;
- docState.doc = doc;
- docState.analyzer = analyzer;
-
- boolean success = false;
- try {
- // This call is not synchronized and does all the
- // work
- final DocWriter perDoc;
- try {
- perDoc = state.consumer.processDocument();
- } finally {
- docState.clear();
- }
-
- // This call is synchronized but fast
- finishDocument(state, perDoc);
-
- success = true;
- } finally {
- if (!success) {
- // If this thread state had decided to flush, we
- // must clear it so another thread can flush
- if (doFlush) {
- flushControl.clearFlushPending();
- }
+ final boolean flushAllThreads(final boolean flushDeletes)
+ throws IOException {
- if (infoStream != null) {
- message("exception in updateDocument aborting=" + aborting);
- }
-
- synchronized(this) {
-
- state.isIdle = true;
- notifyAll();
-
- if (aborting) {
- abort();
- } else {
- skipDocWriter.docID = docState.docID;
- boolean success2 = false;
- try {
- waitQueue.add(skipDocWriter);
- success2 = true;
- } finally {
- if (!success2) {
- abort();
- return false;
- }
- }
-
- // Immediately mark this document as deleted
- // since likely it was partially added. This
- // keeps indexing as "all or none" (atomic) when
- // adding a document:
- deleteDocID(state.docState.docID);
- }
- }
+ if (flushDeletes) {
+ if (indexWriter.segmentInfos.size() > 0 && pendingDeletes.any()) {
+ bufferedDeletes.pushDeletes(pendingDeletes, indexWriter.segmentInfos.lastElement(), true);
+ pendingDeletes.clear();
}
}
- doFlush |= flushControl.flushByRAMUsage("new document");
+ Iterator<ThreadState> threadsIterator = perThreadPool.getActivePerThreadsIterator();
+ boolean anythingFlushed = false;
- return doFlush;
- }
+ while (threadsIterator.hasNext()) {
- Collection<String> flushedFiles = null;
+ SegmentInfo newSegment = null;
- public synchronized void waitIdle() {
- while (!allThreadsIdle()) {
+ ThreadState perThread = threadsIterator.next();
+ perThread.lock();
try {
- wait();
- } catch (InterruptedException ie) {
- throw new ThreadInterruptedException(ie);
- }
- }
- }
+ DocumentsWriterPerThread dwpt = perThread.perThread;
+ final int numDocs = dwpt.getNumDocsInRAM();
- synchronized void waitReady(DocumentsWriterThreadState state) {
- while (!closed && (!state.isIdle || aborting)) {
- try {
- wait();
- } catch (InterruptedException ie) {
- throw new ThreadInterruptedException(ie);
- }
- }
-
- if (closed) {
- throw new AlreadyClosedException("this IndexWriter is closed");
- }
- }
+ // Always flush docs if there are any
+ boolean flushDocs = numDocs > 0;
- /** Does the synchronized work to finish/flush the
- * inverted document. */
- private void finishDocument(DocumentsWriterThreadState perThread, DocWriter docWriter) throws IOException {
+ String segment = dwpt.getSegment();
- // Must call this w/o holding synchronized(this) else
- // we'll hit deadlock:
- balanceRAM();
+ // If we are flushing docs, segment must not be null:
+ assert segment != null || !flushDocs;
- synchronized(this) {
+ if (flushDocs) {
+ newSegment = dwpt.flush();
- assert docWriter == null || docWriter.docID == perThread.docState.docID;
-
- if (aborting) {
-
- // We are currently aborting, and another thread is
- // waiting for me to become idle. We just forcefully
- // idle this threadState; it will be fully reset by
- // abort()
- if (docWriter != null) {
- try {
- docWriter.abort();
- } catch (Throwable t) {
+ if (newSegment != null) {
+ IndexWriter.setDiagnostics(newSegment, "flush");
- flushedFiles = new HashSet<String>();
- flushedFiles.addAll(dwpt.flushState.flushedFiles);
+ dwpt.pushDeletes(newSegment, indexWriter.segmentInfos);
+ anythingFlushed = true;
+ perThreadPool.clearThreadBindings(perThread);
}
+ } else if (flushDeletes) {
+ dwpt.pushDeletes(null, indexWriter.segmentInfos);
}
-
- perThread.isIdle = true;
-
- // wakes up any threads waiting on the wait queue
- notifyAll();
-
- return;
- }
-
- final boolean doPause;
-
- if (docWriter != null) {
- doPause = waitQueue.add(docWriter);
- } else {
- skipDocWriter.docID = perThread.docState.docID;
- doPause = waitQueue.add(skipDocWriter);
+ } finally {
+ perThread.unlock();
}
- if (doPause) {
- waitForWaitQueue();
+ if (newSegment != null) {
+ // important do unlock the perThread before finishFlushedSegment
+ // is called to prevent deadlock on IndexWriter mutex
- finishFlushedSegment(newSegment, flushedFiles);
++ finishFlushedSegment(newSegment);
}
-
- perThread.isIdle = true;
-
- // wakes up any threads waiting on the wait queue
- notifyAll();
}
- }
- synchronized void waitForWaitQueue() {
- do {
- try {
- wait();
- } catch (InterruptedException ie) {
- throw new ThreadInterruptedException(ie);
- }
- } while (!waitQueue.doResume());
+ numDocsInRAM.set(0);
+ return anythingFlushed;
}
- private static class SkipDocWriter extends DocWriter {
- @Override
- void finish() {
- }
- @Override
- void abort() {
- }
- @Override
- long sizeInBytes() {
- return 0;
- }
- }
- final SkipDocWriter skipDocWriter = new SkipDocWriter();
-
- 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. Also fix
- * DeltaBytesWriter's TERM_EOF if necessary. */
- 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;
-
- private List<int[]> freeIntBlocks = new ArrayList<int[]>();
-
- /* Allocate another int[] from the shared pool */
- synchronized int[] getIntBlock() {
- final int size = freeIntBlocks.size();
- final int[] b;
- if (0 == size) {
- b = new int[INT_BLOCK_SIZE];
- bytesUsed.addAndGet(INT_BLOCK_SIZE*RamUsageEstimator.NUM_BYTES_INT);
- } else {
- b = freeIntBlocks.remove(size-1);
+ /** Build compound file for the segment we just flushed */
+ void createCompoundFile(String compoundFileName, Collection<String> flushedFiles) throws IOException {
+ CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, compoundFileName);
+ for(String fileName : flushedFiles) {
+ cfsWriter.addFile(fileName);
}
- return b;
- }
-
- long bytesUsed() {
- return bytesUsed.get() + pendingDeletes.bytesUsed.get();
- }
-
- /* Return int[]s to the pool */
- synchronized void recycleIntBlocks(int[][] blocks, int start, int end) {
- for(int i=start;i<end;i++) {
- freeIntBlocks.add(blocks[i]);
- blocks[i] = null;
- }
- }
-
- final RecyclingByteBlockAllocator byteBlockAllocator = new RecyclingByteBlockAllocator(BYTE_BLOCK_SIZE, Integer.MAX_VALUE, bytesUsed);
-
- final static int PER_DOC_BLOCK_SIZE = 1024;
-
- final RecyclingByteBlockAllocator perDocAllocator = new RecyclingByteBlockAllocator(PER_DOC_BLOCK_SIZE, Integer.MAX_VALUE, bytesUsed);
-
- String toMB(long v) {
- return nf.format(v/1024./1024.);
- }
-
- /* We have three pools of RAM: Postings, byte blocks
- * (holds freq/prox posting data) and per-doc buffers
- * (stored fields/term vectors). Different docs require
- * varying amount of storage from these classes. For
- * example, docs with many unique single-occurrence short
- * terms will use up the Postings RAM and hardly any of
- * the other two. Whereas docs with very large terms will
- * use alot of byte blocks RAM. This method just frees
- * allocations from the pools once we are over-budget,
- * which balances the pools to match the current docs. */
- void balanceRAM() {
-
- final boolean doBalance;
- final long deletesRAMUsed;
-
- deletesRAMUsed = bufferedDeletes.bytesUsed();
-
- synchronized(this) {
- if (ramBufferSize == IndexWriterConfig.DISABLE_AUTO_FLUSH || bufferIsFull) {
- return;
- }
-
- doBalance = bytesUsed() + deletesRAMUsed >= ramBufferSize;
- }
-
- if (doBalance) {
-
- if (infoStream != null) {
- message(" RAM: balance allocations: usedMB=" + toMB(bytesUsed()) +
- " vs trigger=" + toMB(ramBufferSize) +
- " deletesMB=" + toMB(deletesRAMUsed) +
- " byteBlockFree=" + toMB(byteBlockAllocator.bytesUsed()) +
- " perDocFree=" + toMB(perDocAllocator.bytesUsed()));
- }
-
- final long startBytesUsed = bytesUsed() + deletesRAMUsed;
-
- int iter = 0;
-
- // We free equally from each pool in 32 KB
- // chunks until we are below our threshold
- // (freeLevel)
-
- boolean any = true;
-
- while(bytesUsed()+deletesRAMUsed > freeLevel) {
-
- synchronized(this) {
- if (0 == perDocAllocator.numBufferedBlocks() &&
- 0 == byteBlockAllocator.numBufferedBlocks() &&
- 0 == freeIntBlocks.size() && !any) {
- // Nothing else to free -- must flush now.
- bufferIsFull = bytesUsed()+deletesRAMUsed > ramBufferSize;
- if (infoStream != null) {
- if (bytesUsed()+deletesRAMUsed > ramBufferSize) {
- message(" nothing to free; set bufferIsFull");
- } else {
- message(" nothing to free");
- }
- }
- break;
- }
-
- if ((0 == iter % 4) && byteBlockAllocator.numBufferedBlocks() > 0) {
- byteBlockAllocator.freeBlocks(1);
- }
- if ((1 == iter % 4) && freeIntBlocks.size() > 0) {
- freeIntBlocks.remove(freeIntBlocks.size()-1);
- bytesUsed.addAndGet(-INT_BLOCK_SIZE * RamUsageEstimator.NUM_BYTES_INT);
- }
- if ((2 == iter % 4) && perDocAllocator.numBufferedBlocks() > 0) {
- perDocAllocator.freeBlocks(32); // Remove upwards of 32 blocks (each block is 1K)
- }
- }
-
- if ((3 == iter % 4) && any) {
- // Ask consumer to free any recycled state
- any = consumer.freeRAM();
- }
-
- iter++;
- }
- if (infoStream != null) {
- message(" after free: freedMB=" + nf.format((startBytesUsed-bytesUsed()-deletesRAMUsed)/1024./1024.) + " usedMB=" + nf.format((bytesUsed()+deletesRAMUsed)/1024./1024.));
- }
- }
+ // Perform the merge
+ cfsWriter.close();
}
- void finishFlushedSegment(SegmentInfo newSegment, Collection<String> flushedFiles) throws IOException {
- final WaitQueue waitQueue = new WaitQueue();
-
- private class WaitQueue {
- DocWriter[] waiting;
- int nextWriteDocID;
- int nextWriteLoc;
- int numWaiting;
- long waitingBytes;
-
- public WaitQueue() {
- waiting = new DocWriter[10];
- }
-
- synchronized void reset() {
- // NOTE: nextWriteLoc doesn't need to be reset
- assert numWaiting == 0;
- assert waitingBytes == 0;
- nextWriteDocID = 0;
- }
-
- synchronized boolean doResume() {
- return waitingBytes <= waitQueueResumeBytes;
- }
-
- synchronized boolean doPause() {
- return waitingBytes > waitQueuePauseBytes;
- }
-
- synchronized void abort() {
- int count = 0;
- for(int i=0;i<waiting.length;i++) {
- final DocWriter doc = waiting[i];
- if (doc != null) {
- doc.abort();
- waiting[i] = null;
- count++;
- }
- }
- waitingBytes = 0;
- assert count == numWaiting;
- numWaiting = 0;
- }
-
- private void writeDocument(DocWriter doc) throws IOException {
- assert doc == skipDocWriter || nextWriteDocID == doc.docID;
++ void finishFlushedSegment(SegmentInfo newSegment) throws IOException {
+ if (indexWriter.useCompoundFile(newSegment)) {
+ String compoundFileName = IndexFileNames.segmentFileName(newSegment.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
+ message("creating compound file " + compoundFileName);
+ // Now build compound file
boolean success = false;
try {
- createCompoundFile(compoundFileName, flushedFiles);
- doc.finish();
- nextWriteDocID++;
- nextWriteLoc++;
- assert nextWriteLoc <= waiting.length;
- if (nextWriteLoc == waiting.length) {
- nextWriteLoc = 0;
- }
++ createCompoundFile(compoundFileName, newSegment.files());
success = true;
} finally {
if (!success) {
- setAborting();
- }
- }
- }
+ if (infoStream != null) {
+ message("hit exception " +
+ "reating compound file for newly flushed segment " + newSegment.name);
+ }
- synchronized public boolean add(DocWriter doc) throws IOException {
-
- assert doc.docID >= nextWriteDocID;
-
- if (doc.docID == nextWriteDocID) {
- writeDocument(doc);
- while(true) {
- doc = waiting[nextWriteLoc];
- if (doc != null) {
- numWaiting--;
- waiting[nextWriteLoc] = null;
- waitingBytes -= doc.sizeInBytes();
- writeDocument(doc);
- } else {
- break;
+ indexWriter.deleter.deleteFile(IndexFileNames.segmentFileName(newSegment.name, "",
+ IndexFileNames.COMPOUND_FILE_EXTENSION));
- for (String file : flushedFiles) {
++ for (String file : newSegment.files()) {
+ indexWriter.deleter.deleteFile(file);
}
- }
- } else {
-
- // I finished before documents that were added
- // before me. This can easily happen when I am a
- // small doc and the docs before me were large, or,
- // just due to luck in the thread scheduling. Just
- // add myself to the queue and when that large doc
- // finishes, it will flush me:
- int gap = doc.docID - nextWriteDocID;
- if (gap >= waiting.length) {
- // Grow queue
- DocWriter[] newArray = new DocWriter[ArrayUtil.oversize(gap, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
- assert nextWriteLoc >= 0;
- System.arraycopy(waiting, nextWriteLoc, newArray, 0, waiting.length-nextWriteLoc);
- System.arraycopy(waiting, 0, newArray, waiting.length-nextWriteLoc, nextWriteLoc);
- nextWriteLoc = 0;
- waiting = newArray;
- gap = doc.docID - nextWriteDocID;
- }
- int loc = nextWriteLoc + gap;
- if (loc >= waiting.length) {
- loc -= waiting.length;
}
-
- // We should only wrap one time
- assert loc < waiting.length;
-
- // Nobody should be in my spot!
- assert waiting[loc] == null;
- waiting[loc] = doc;
- numWaiting++;
- waitingBytes += doc.sizeInBytes();
}
-
- return doPause();
- }
- }
+
- for (String file : flushedFiles) {
++ for (String file : newSegment.files()) {
+ indexWriter.deleter.deleteFile(file);
+ }
+
+ newSegment.setUseCompoundFile(true);
+
+ }
+
+ indexWriter.addNewSegment(newSegment);
+ }
+
+// /* We have three pools of RAM: Postings, byte blocks
+// * (holds freq/prox posting data) and per-doc buffers
+// * (stored fields/term vectors). Different docs require
+// * varying amount of storage from these classes. For
+// * example, docs with many unique single-occurrence short
+// * terms will use up the Postings RAM and hardly any of
+// * the other two. Whereas docs with very large terms will
+// * use alot of byte blocks RAM. This method just frees
+// * allocations from the pools once we are over-budget,
+// * which balances the pools to match the current docs. */
+// void balanceRAM() {
+//
+// final boolean doBalance;
+// final long deletesRAMUsed;
+//
+// deletesRAMUsed = bufferedDeletes.bytesUsed();
+//
+// synchronized(this) {
+// if (ramBufferSize == IndexWriterConfig.DISABLE_AUTO_FLUSH || bufferIsFull) {
+// return;
+// }
+//
+// doBalance = bytesUsed() + deletesRAMUsed >= ramBufferSize;
+// }
+//
+// if (doBalance) {
+//
+// if (infoStream != null)
+// message(" RAM: balance allocations: usedMB=" + toMB(bytesUsed()) +
+// " vs trigger=" + toMB(ramBufferSize) +
+// " deletesMB=" + toMB(deletesRAMUsed) +
+// " byteBlockFree=" + toMB(byteBlockAllocator.bytesUsed()) +
+// " perDocFree=" + toMB(perDocAllocator.bytesUsed()));
+//
+// final long startBytesUsed = bytesUsed() + deletesRAMUsed;
+//
+// int iter = 0;
+//
+// // We free equally from each pool in 32 KB
+// // chunks until we are below our threshold
+// // (freeLevel)
+//
+// boolean any = true;
+//
+// while(bytesUsed()+deletesRAMUsed > freeLevel) {
+//
+// synchronized(this) {
+// if (0 == perDocAllocator.numBufferedBlocks() &&
+// 0 == byteBlockAllocator.numBufferedBlocks() &&
+// 0 == freeIntBlocks.size() && !any) {
+// // Nothing else to free -- must flush now.
+// bufferIsFull = bytesUsed()+deletesRAMUsed > ramBufferSize;
+// if (infoStream != null) {
+// if (bytesUsed()+deletesRAMUsed > ramBufferSize)
+// message(" nothing to free; set bufferIsFull");
+// else
+// message(" nothing to free");
+// }
+// break;
+// }
+//
+// if ((0 == iter % 4) && byteBlockAllocator.numBufferedBlocks() > 0) {
+// byteBlockAllocator.freeBlocks(1);
+// }
+// if ((1 == iter % 4) && freeIntBlocks.size() > 0) {
+// freeIntBlocks.remove(freeIntBlocks.size()-1);
+// bytesUsed.addAndGet(-INT_BLOCK_SIZE * RamUsageEstimator.NUM_BYTES_INT);
+// }
+// if ((2 == iter % 4) && perDocAllocator.numBufferedBlocks() > 0) {
+// perDocAllocator.freeBlocks(32); // Remove upwards of 32 blocks (each block is 1K)
+// }
+// }
+//
+// if ((3 == iter % 4) && any)
+// // Ask consumer to free any recycled state
+// any = consumer.freeRAM();
+//
+// iter++;
+// }
+//
+// if (infoStream != null)
+// message(" after free: freedMB=" + nf.format((startBytesUsed-bytesUsed()-deletesRAMUsed)/1024./1024.) + " usedMB=" + nf.format((bytesUsed()+deletesRAMUsed)/1024./1024.));
+// }
+// }
}
diff --cc lucene/src/java/org/apache/lucene/index/IndexWriter.java
index 93d840dfc68,43b0281f088..72533a8563c
--- a/lucene/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/src/java/org/apache/lucene/index/IndexWriter.java
@@@ -2250,11 -2256,11 +2250,11 @@@ public class IndexWriter implements Clo
// Now create the compound file if needed
if (useCompoundFile) {
merger.createCompoundFile(mergedName + ".cfs", info);
- info.setUseCompoundFile(true);
-
+
// delete new non cfs files directly: they were never
// registered with IFD
- deleter.deleteNewFiles(merger.getMergedFiles(info));
+ deleter.deleteNewFiles(info.files());
+ info.setUseCompoundFile(true);
}
// Register the new segment
diff --cc lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
index 3a67703798c,34240ea5f2d..551538655e2
--- a/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
+++ b/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
@@@ -53,9 -53,9 +53,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;
+ 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;
@@@ -309,20 -309,20 +309,20 @@@
* In particular, <code>numUniqueTerms/interval</code> terms are read into
* memory by an IndexReader, and, on average, <code>interval/2</code> terms
* must be scanned for each random term access.
- *
+ *
* @see #DEFAULT_TERM_INDEX_INTERVAL
*/
- public IndexWriterConfig setTermIndexInterval(int interval) {
+ public IndexWriterConfig setTermIndexInterval(int interval) { // TODO: this should be private to the codec, not settable here
this.termIndexInterval = interval;
return this;
}
/**
* Returns the interval between indexed terms.
- *
+ *
* @see #setTermIndexInterval(int)
*/
- public int getTermIndexInterval() {
+ public int getTermIndexInterval() { // TODO: this should be private to the codec, not settable here
return termIndexInterval;
}
diff --cc lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
index e1f06ab2c13,357460c1d9d..2173aa34952
--- a/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
+++ b/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
@@@ -338,8 -344,13 +344,13 @@@ public abstract class LogMergePolicy ex
// If the segments are already optimized (e.g. there's only 1 segment), or
// there are <maxNumSegements, all optimized, nothing to do.
- if (isOptimized(infos, maxNumSegments, segmentsToOptimize)) return null;
+ if (isOptimized(infos, maxNumSegments, segmentsToOptimize)) {
+ if (verbose()) {
+ message("already optimized; skip");
+ }
+ return null;
+ }
-
+
// Find the newest (rightmost) segment that needs to
// be optimized (other segments may have been flushed
// since optimize started):
@@@ -352,10 -363,20 +363,20 @@@
}
}
- if (last == 0) return null;
+ if (last == 0) {
+ if (verbose()) {
+ message("last == 0; skip");
+ }
+ return null;
+ }
-
+
// There is only one segment already, and it is optimized
- if (maxNumSegments == 1 && last == 1 && isOptimized(infos.info(0))) return null;
+ if (maxNumSegments == 1 && last == 1 && isOptimized(infos.info(0))) {
+ if (verbose()) {
+ message("already 1 seg; skip");
+ }
+ return null;
+ }
// Check if there are any segments above the threshold
boolean anyTooLarge = false;
diff --cc lucene/src/java/org/apache/lucene/index/NormsWriter.java
index 31ca61b5259,82b4a730e5b..9db47a768a8
--- a/lucene/src/java/org/apache/lucene/index/NormsWriter.java
+++ b/lucene/src/java/org/apache/lucene/index/NormsWriter.java
@@@ -19,9 -19,12 +19,8 @@@ package org.apache.lucene.index
import java.io.IOException;
import java.util.Collection;
-import java.util.Iterator;
-import java.util.HashMap;
import java.util.Map;
-import java.util.List;
-import java.util.ArrayList;
- import org.apache.lucene.search.Similarity;
import org.apache.lucene.store.IndexOutput;
// TODO FI: norms could actually be stored as doc store
@@@ -33,8 -36,11 +32,7 @@@
final class NormsWriter extends InvertedDocEndConsumer {
- private static final byte defaultNorm = Similarity.getDefault().encodeNormValue(1.0f);
private FieldInfos fieldInfos;
- @Override
- public InvertedDocEndConsumerPerThread addThread(DocInverterPerThread docInverterPerThread) {
- return new NormsWriterPerThread(docInverterPerThread, this);
- }
@Override
public void abort() {}
@@@ -50,10 -56,41 +48,12 @@@
/** Produce _X.nrm if any document had a field with norms
* not disabled */
@Override
- public void flush(Map<InvertedDocEndConsumerPerThread,Collection<InvertedDocEndConsumerPerField>> threadsAndFields, SegmentWriteState state) throws IOException {
-
- final Map<FieldInfo,List<NormsWriterPerField>> byField = new HashMap<FieldInfo,List<NormsWriterPerField>>();
-
+ public void flush(Map<FieldInfo,InvertedDocEndConsumerPerField> fieldsToFlush, SegmentWriteState state) throws IOException {
+ if (!fieldInfos.hasNorms()) {
+ return;
+ }
- // Typically, each thread will have encountered the same
- // field. So first we collate by field, ie, all
- // per-thread field instances that correspond to the
- // same FieldInfo
- for (final Map.Entry<InvertedDocEndConsumerPerThread,Collection<InvertedDocEndConsumerPerField>> entry : threadsAndFields.entrySet()) {
- final Collection<InvertedDocEndConsumerPerField> fields = entry.getValue();
- final Iterator<InvertedDocEndConsumerPerField> fieldsIt = fields.iterator();
-
- while (fieldsIt.hasNext()) {
- final NormsWriterPerField perField = (NormsWriterPerField) fieldsIt.next();
-
- if (perField.upto > 0) {
- // It has some norms
- List<NormsWriterPerField> l = byField.get(perField.fieldInfo);
- if (l == null) {
- l = new ArrayList<NormsWriterPerField>();
- byField.put(perField.fieldInfo, l);
- }
- l.add(perField);
- } else
- // Remove this field since we haven't seen it
- // since the previous flush
- fieldsIt.remove();
- }
- }
-
final String normsFileName = IndexFileNames.segmentFileName(state.segmentName, "", IndexFileNames.NORMS_EXTENSION);
- state.flushedFiles.add(normsFileName);
IndexOutput normsOut = state.directory.createOutput(normsFileName);
try {
@@@ -67,26 -104,60 +67,26 @@@
final FieldInfo fieldInfo = fieldInfos.fieldInfo(fieldNumber);
- List<NormsWriterPerField> toMerge = byField.get(fieldInfo);
- int upto = 0;
- if (toMerge != null) {
-
- final int numFields = toMerge.size();
+ NormsWriterPerField toWrite = (NormsWriterPerField) fieldsToFlush.get(fieldInfo);
+ int upto = 0;
+ if (toWrite != null && toWrite.upto > 0) {
normCount++;
- final NormsWriterPerField[] fields = new NormsWriterPerField[numFields];
- int[] uptos = new int[numFields];
-
- for(int j=0;j<numFields;j++)
- fields[j] = toMerge.get(j);
-
- int numLeft = numFields;
-
- while(numLeft > 0) {
-
- assert uptos[0] < fields[0].docIDs.length : " uptos[0]=" + uptos[0] + " len=" + (fields[0].docIDs.length);
-
- int minLoc = 0;
- int minDocID = fields[0].docIDs[uptos[0]];
-
- for(int j=1;j<numLeft;j++) {
- final int docID = fields[j].docIDs[uptos[j]];
- if (docID < minDocID) {
- minDocID = docID;
- minLoc = j;
- }
- }
-
- assert minDocID < state.numDocs;
-
- // Fill hole
- for(;upto<minDocID;upto++)
+ int docID = 0;
+ for (; docID < state.numDocs; docID++) {
+ if (upto < toWrite.upto && toWrite.docIDs[upto] == docID) {
+ normsOut.writeByte(toWrite.norms[upto]);
+ upto++;
+ } else {
- normsOut.writeByte(defaultNorm);
+ normsOut.writeByte((byte) 0);
-
- normsOut.writeByte(fields[minLoc].norms[uptos[minLoc]]);
- (uptos[minLoc])++;
- upto++;
-
- if (uptos[minLoc] == fields[minLoc].upto) {
- fields[minLoc].reset();
- if (minLoc != numLeft-1) {
- fields[minLoc] = fields[numLeft-1];
- uptos[minLoc] = uptos[numLeft-1];
- }
- numLeft--;
}
}
-
- // Fill final hole with defaultNorm
- for(;upto<state.numDocs;upto++)
- normsOut.writeByte((byte) 0);
+
+ // we should have consumed every norm
+ assert upto == toWrite.upto;
+
+ toWrite.reset();
} else if (fieldInfo.isIndexed && !fieldInfo.omitNorms) {
normCount++;
// Fill entire field with default norm:
diff --cc lucene/src/java/org/apache/lucene/index/SegmentInfo.java
index 465b3398237,2c91efc636b..52a01bb9bc0
--- a/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
+++ b/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
@@@ -68,13 -68,14 +68,14 @@@ public final class SegmentInfo
private List<String> files; // cached list of files that this segment uses
// in the Directory
- long sizeInBytes = -1; // total byte size of all of our files (computed on demand)
+ private long sizeInBytesNoStore = -1; // total byte size of all but the store files (computed on demand)
+ private long sizeInBytesWithStore = -1; // total byte size of all of our files (computed on demand)
- private int docStoreOffset; // if this segment shares stored fields & vectors, this
+ @Deprecated private int docStoreOffset; // if this segment shares stored fields & vectors, this
// offset is where in that file this segment's docs begin
- private String docStoreSegment; // name used to derive fields/vectors file we share with
+ @Deprecated private String docStoreSegment; // name used to derive fields/vectors file we share with
// other segments
- private boolean docStoreIsCompoundFile; // whether doc store files are stored in compound file (*.cfx)
+ @Deprecated private boolean docStoreIsCompoundFile; // whether doc store files are stored in compound file (*.cfx)
private int delCount; // How many deleted docs in this segment
diff --cc lucene/src/java/org/apache/lucene/index/SegmentMerger.java
index 6dc93f3722e,f29fff4c20c..b0837ee1819
--- a/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
+++ b/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
@@@ -600,15 -569,8 +569,8 @@@ final class SegmentMerger
int[] getDelCounts() {
return mergeState.delCounts;
}
-
+
private void mergeNorms() throws IOException {
- // get needed buffer size by finding the largest segment
- int bufferSize = 0;
- for (IndexReader reader : readers) {
- bufferSize = Math.max(bufferSize, reader.maxDoc());
- }
-
- byte[] normBuffer = null;
IndexOutput output = null;
try {
for (int i = 0, numFieldInfos = fieldInfos.size(); i < numFieldInfos; i++) {
diff --cc lucene/src/java/org/apache/lucene/index/SegmentWriteState.java
index fa4e43ee656,514f0c4e410..a744debbe72
--- a/lucene/src/java/org/apache/lucene/index/SegmentWriteState.java
+++ b/lucene/src/java/org/apache/lucene/index/SegmentWriteState.java
@@@ -68,10 -65,9 +65,9 @@@ public class SegmentWriteState
this.numDocs = numDocs;
this.termIndexInterval = termIndexInterval;
this.segmentCodecs = segmentCodecs;
- flushedFiles = new HashSet<String>();
codecId = "";
}
-
+
/**
* Create a shallow {@link SegmentWriteState} copy final a codec ID
*/
diff --cc lucene/src/java/org/apache/lucene/index/TermVectorsTermsWriter.java
index f5e978a19c8,a5d631efc53..2d71a31feb9
--- a/lucene/src/java/org/apache/lucene/index/TermVectorsTermsWriter.java
+++ b/lucene/src/java/org/apache/lucene/index/TermVectorsTermsWriter.java
@@@ -52,22 -53,16 +52,15 @@@ final class TermVectorsTermsWriter exte
if (tvx != null) {
// At least one doc in this run had term vectors enabled
fill(state.numDocs);
+ assert state.segmentName != null;
+ String idxName = IndexFileNames.segmentFileName(state.segmentName, "", IndexFileNames.VECTORS_INDEX_EXTENSION);
- String fldName = IndexFileNames.segmentFileName(state.segmentName, "", IndexFileNames.VECTORS_FIELDS_EXTENSION);
- String docName = IndexFileNames.segmentFileName(state.segmentName, "", IndexFileNames.VECTORS_DOCUMENTS_EXTENSION);
-
tvx.close();
tvf.close();
tvd.close();
- tvx = tvd = tvf = null;
- assert state.segmentName != null;
- String idxName = IndexFileNames.segmentFileName(state.segmentName, "", IndexFileNames.VECTORS_INDEX_EXTENSION);
- if (4 + ((long) state.numDocs) * 16 != state.directory.fileLength(idxName)) {
+ tvx = null;
+ if (4+((long) state.numDocs)*16 != state.directory.fileLength(idxName))
throw new RuntimeException("after flush: tvx size mismatch: " + state.numDocs + " docs vs " + state.directory.fileLength(idxName) + " length in bytes of " + idxName + " file exists?=" + state.directory.fileExists(idxName));
- }
- state.flushedFiles.add(idxName);
- state.flushedFiles.add(fldName);
- state.flushedFiles.add(docName);
-
lastDocID = 0;
state.hasVectors = hasVectors;
hasVectors = false;
diff --cc lucene/src/java/org/apache/lucene/index/codecs/TermsIndexReaderBase.java
index 6ed1f07bf90,29dbf23a149..d18aa2b656d
--- a/lucene/src/java/org/apache/lucene/index/codecs/TermsIndexReaderBase.java
+++ b/lucene/src/java/org/apache/lucene/index/codecs/TermsIndexReaderBase.java
@@@ -35,42 -36,40 +36,40 @@@ import java.util.Collection
* indexed terms (many pairs of CharSequence text + long
* fileOffset), and then this reader must be able to
* retrieve the nearest index term to a provided term
-- * text.
++ * text.
* @lucene.experimental */
- public abstract class TermsIndexReaderBase {
+ public abstract class TermsIndexReaderBase implements Closeable {
- static class TermsIndexResult {
- long position;
- final BytesRef term = new BytesRef();
- long offset;
- };
+ public abstract FieldIndexEnum getFieldEnum(FieldInfo fieldInfo);
- public abstract class FieldReader {
- /** Returns position of "largest" index term that's <=
- * text. Returned TermsIndexResult may be reused
- * across calls. This resets internal state, and
- * expects that you'll then scan the file and
- * sequentially call isIndexTerm for each term
- * encountered. */
- public abstract void getIndexOffset(BytesRef term, TermsIndexResult result) throws IOException;
+ public abstract void loadTermsIndex(int indexDivisor) throws IOException;
- public abstract void getIndexOffset(long ord, TermsIndexResult result) throws IOException;
+ public abstract void close() throws IOException;
- /** Call this sequentially for each term encoutered,
- * after calling {@link #getIndexOffset}. */
- public abstract boolean isIndexTerm(long ord, int docFreq, boolean onlyLoaded) throws IOException;
+ public abstract void getExtensions(Collection<String> extensions);
- /** Finds the next index term, after the specified
- * ord. Returns true if one exists. */
- public abstract boolean nextIndexTerm(long ord, TermsIndexResult result) throws IOException;
- }
+ public abstract boolean supportsOrd();
- public abstract FieldReader getField(FieldInfo fieldInfo);
+ public abstract int getDivisor();
- public abstract void loadTermsIndex(int indexDivisor) throws IOException;
+ // Similar to TermsEnum, except, the only "metadata" it
+ // reports for a given indexed term is the long fileOffset
+ // into the main terms dict (_X.tis) file:
+ public static abstract class FieldIndexEnum {
- public abstract void close() throws IOException;
+ /** Seeks to "largest" indexed term that's <=
+ * term; retruns file pointer index (into the main
+ * terms index file) for that term */
+ public abstract long seek(BytesRef term) throws IOException;
- public abstract void getExtensions(Collection<String> extensions);
- }
+ /** Returns -1 at end */
+ public abstract long next() throws IOException;
+
+ public abstract BytesRef term();
+
+ // Only impl'd if supportsOrd() returns true!
+ public abstract long seek(long ord) throws IOException;
+ public abstract long ord();
+ }
+ }
diff --cc lucene/src/test/org/apache/lucene/index/TestDoc.java
index ef9c9ae1caa,774581c8ae1..074166b1dfa
--- a/lucene/src/test/org/apache/lucene/index/TestDoc.java
+++ b/lucene/src/test/org/apache/lucene/index/TestDoc.java
@@@ -199,14 -199,15 +199,15 @@@ public class TestDoc extends LuceneTest
merger.merge();
r1.close();
r2.close();
-
+
final SegmentInfo info = new SegmentInfo(merged, si1.docCount + si2.docCount, si1.dir,
- useCompoundFile, merger.fieldInfos().hasProx(), merger.getSegmentCodecs(),
+ false, merger.fieldInfos().hasProx(), merger.getSegmentCodecs(),
merger.fieldInfos().hasVectors());
-
+
if (useCompoundFile) {
Collection<String> filesToDelete = merger.createCompoundFile(merged + ".cfs", info);
+ info.setUseCompoundFile(true);
- for (final String fileToDelete : filesToDelete)
+ for (final String fileToDelete : filesToDelete)
si1.dir.deleteFile(fileToDelete);
}
diff --cc lucene/src/test/org/apache/lucene/index/TestIndexReader.java
index 1fcebde77d4,70c55701d47..7f41d722329
--- a/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
@@@ -580,12 -582,12 +582,12 @@@ public class TestIndexReader extends Lu
// now open reader & set norm for doc 0 (writes to
// _0_1.s0)
reader = IndexReader.open(dir, false);
- reader.setNorm(0, "content", (float) 2.0);
+ reader.setNorm(0, "content", Similarity.getDefault().encodeNormValue(2.0f));
reader.close();
-
+
// now open reader again & set norm for doc 0 (writes to _0_2.s0)
reader = IndexReader.open(dir, false);
- reader.setNorm(0, "content", (float) 2.0);
+ reader.setNorm(0, "content", Similarity.getDefault().encodeNormValue(2.0f));
reader.close();
assertFalse("failed to remove first generation norms file on writing second generation",
dir.fileExists("_0_1.s0"));
diff --cc lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
index 257718cecdd,469302fdb4e..b0a63610a22
--- a/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
+++ b/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
@@@ -40,9 -39,9 +39,9 @@@ import org.apache.lucene.util.BytesRef
*
*/
public class TestLazyProxSkipping extends LuceneTestCase {
- private Searcher searcher;
+ private IndexSearcher searcher;
private int seeksCounter = 0;
-
+
private String field = "tokens";
private String term1 = "xx";
private String term2 = "yy";
diff --cc lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
index e3d25a56248,d9bd3a4a922..f388e10beb3
--- a/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
+++ b/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
@@@ -338,8 -347,9 +347,9 @@@ public class TestNRTThreads extends Luc
writer.commit();
assertEquals("index=" + writer.segString() + " addCount=" + addCount + " delCount=" + delCount, addCount.get() - delCount.get(), writer.numDocs());
-
+
writer.close(false);
+ _TestUtil.checkIndex(dir);
dir.close();
_TestUtil.rmDir(tempDir);
docs.close();
diff --cc lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
index f9da47b86b9,8989142f80c..565ed6196b2
--- a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
+++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
@@@ -223,10 -197,10 +224,10 @@@ public abstract class LuceneTestCase ex
private static Locale savedLocale;
private static TimeZone timeZone;
private static TimeZone savedTimeZone;
-
+
private static Map<MockDirectoryWrapper,StackTraceElement[]> stores;
-
+
- private static final String[] TEST_CODECS = new String[] {"MockSep", "MockFixedIntBlock", "MockVariableIntBlock"};
+ private static final String[] TEST_CODECS = new String[] {"MockSep", "MockFixedIntBlock", "MockVariableIntBlock", "MockRandom"};
private static void swapCodec(Codec c, CodecProvider cp) {
Codec prior = null;