Package org.apache.lucene.index
Class DocumentsWriterPerThread
- java.lang.Object
-
- org.apache.lucene.index.DocumentsWriterPerThread
-
final class DocumentsWriterPerThread extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
DocumentsWriterPerThread.DocState
(package private) static class
DocumentsWriterPerThread.FlushedSegment
(package private) static class
DocumentsWriterPerThread.IndexingChain
The IndexingChain must define theDocumentsWriterPerThread.IndexingChain.getChain(DocumentsWriterPerThread)
method which returns the DocConsumer that the DocumentsWriter calls to process the documents.private static class
DocumentsWriterPerThread.IntBlockAllocator
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DocumentsWriterPerThread(int indexVersionCreated, java.lang.String segmentName, Directory directoryOrig, Directory directory, LiveIndexWriterConfig indexWriterConfig, InfoStream infoStream, DocumentsWriterDeleteQueue deleteQueue, FieldInfos.Builder fieldInfos, java.util.concurrent.atomic.AtomicLong pendingNumDocs, boolean enableTestPoints)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
abort()
Called if we hit an exception at a bad time (when updating the index files) and must discard all currently buffered docs.(package private) long
bytesUsed()
(package private) void
deleteDocID(int docIDUpto)
private long
finishDocument(DocumentsWriterDeleteQueue.Node<?> deleteNode)
(package private) DocumentsWriterPerThread.FlushedSegment
flush(DocumentsWriter.FlushNotifications flushNotifications)
Flush all pending docs to a new segmentFieldInfos.Builder
getFieldInfosBuilder()
int
getIndexCreatedVersionMajor()
int
getNumDocsInRAM()
Returns the number of RAM resident documents in thisDocumentsWriterPerThread
(package private) SegmentInfo
getSegmentInfo()
Get current segment info we are writing.(package private) boolean
hasHitAbortingException()
(package private) boolean
isAborted()
private void
maybeAbort(java.lang.String location, DocumentsWriter.FlushNotifications flushNotifications)
(package private) void
onAbortingException(java.lang.Throwable throwable)
java.util.Set<java.lang.String>
pendingFilesToDelete()
(package private) FrozenBufferedUpdates
prepareFlush()
Prepares this DWPT for flushing.private void
reserveOneDoc()
Anything that will add N docs to the index should reserve first to make sure it's allowed.(package private) void
sealFlushedSegment(DocumentsWriterPerThread.FlushedSegment flushedSegment, Sorter.DocMap sortMap, DocumentsWriter.FlushNotifications flushNotifications)
Seals theSegmentInfo
for the new flushed segment and persists the deleted documentsFixedBitSet
.private FixedBitSet
sortLiveDocs(Bits liveDocs, Sorter.DocMap sortMap)
(package private) void
testPoint(java.lang.String message)
java.lang.String
toString()
long
updateDocument(java.lang.Iterable<? extends IndexableField> doc, Analyzer analyzer, DocumentsWriterDeleteQueue.Node<?> deleteNode, DocumentsWriter.FlushNotifications flushNotifications)
long
updateDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer analyzer, DocumentsWriterDeleteQueue.Node<?> deleteNode, DocumentsWriter.FlushNotifications flushNotifications)
-
-
-
Field Detail
-
abortingException
private java.lang.Throwable abortingException
-
defaultIndexingChain
static final DocumentsWriterPerThread.IndexingChain defaultIndexingChain
-
INFO_VERBOSE
private static final boolean INFO_VERBOSE
- See Also:
- Constant Field Values
-
codec
final Codec codec
-
directory
final TrackingDirectoryWrapper directory
-
directoryOrig
final Directory directoryOrig
-
docState
final DocumentsWriterPerThread.DocState docState
-
consumer
final DocConsumer consumer
-
bytesUsed
final Counter bytesUsed
-
pendingUpdates
final BufferedUpdates pendingUpdates
-
segmentInfo
final SegmentInfo segmentInfo
-
aborted
private boolean aborted
-
fieldInfos
private final FieldInfos.Builder fieldInfos
-
infoStream
private final InfoStream infoStream
-
numDocsInRAM
private int numDocsInRAM
-
deleteQueue
final DocumentsWriterDeleteQueue deleteQueue
-
deleteSlice
private final DocumentsWriterDeleteQueue.DeleteSlice deleteSlice
-
nf
private final java.text.NumberFormat nf
-
byteBlockAllocator
final ByteBlockPool.Allocator byteBlockAllocator
-
intBlockAllocator
final IntBlockPool.Allocator intBlockAllocator
-
pendingNumDocs
private final java.util.concurrent.atomic.AtomicLong pendingNumDocs
-
indexWriterConfig
private final LiveIndexWriterConfig indexWriterConfig
-
enableTestPoints
private final boolean enableTestPoints
-
indexVersionCreated
private final int indexVersionCreated
-
filesToDelete
private final java.util.Set<java.lang.String> filesToDelete
-
BYTE_BLOCK_NOT_MASK
static final int BYTE_BLOCK_NOT_MASK
- See Also:
- Constant Field Values
-
MAX_TERM_LENGTH_UTF8
static final int MAX_TERM_LENGTH_UTF8
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DocumentsWriterPerThread
public DocumentsWriterPerThread(int indexVersionCreated, java.lang.String segmentName, Directory directoryOrig, Directory directory, LiveIndexWriterConfig indexWriterConfig, InfoStream infoStream, DocumentsWriterDeleteQueue deleteQueue, FieldInfos.Builder fieldInfos, java.util.concurrent.atomic.AtomicLong pendingNumDocs, boolean enableTestPoints) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
onAbortingException
final void onAbortingException(java.lang.Throwable throwable)
-
hasHitAbortingException
final boolean hasHitAbortingException()
-
isAborted
final boolean isAborted()
-
abort
void abort() throws java.io.IOException
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.- Throws:
java.io.IOException
-
getFieldInfosBuilder
public FieldInfos.Builder getFieldInfosBuilder()
-
getIndexCreatedVersionMajor
public int getIndexCreatedVersionMajor()
-
testPoint
final void testPoint(java.lang.String message)
-
reserveOneDoc
private void reserveOneDoc()
Anything that will add N docs to the index should reserve first to make sure it's allowed.
-
updateDocument
public long updateDocument(java.lang.Iterable<? extends IndexableField> doc, Analyzer analyzer, DocumentsWriterDeleteQueue.Node<?> deleteNode, DocumentsWriter.FlushNotifications flushNotifications) throws java.io.IOException
- Throws:
java.io.IOException
-
updateDocuments
public long updateDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer analyzer, DocumentsWriterDeleteQueue.Node<?> deleteNode, DocumentsWriter.FlushNotifications flushNotifications) throws java.io.IOException
- Throws:
java.io.IOException
-
finishDocument
private long finishDocument(DocumentsWriterDeleteQueue.Node<?> deleteNode)
-
deleteDocID
void deleteDocID(int docIDUpto)
-
getNumDocsInRAM
public int getNumDocsInRAM()
Returns the number of RAM resident documents in thisDocumentsWriterPerThread
-
prepareFlush
FrozenBufferedUpdates prepareFlush() throws java.io.IOException
Prepares this DWPT for flushing. This method will freeze and return theDocumentsWriterDeleteQueue
s global buffer and apply all pending deletes to this DWPT.- Throws:
java.io.IOException
-
flush
DocumentsWriterPerThread.FlushedSegment flush(DocumentsWriter.FlushNotifications flushNotifications) throws java.io.IOException
Flush all pending docs to a new segment- Throws:
java.io.IOException
-
maybeAbort
private void maybeAbort(java.lang.String location, DocumentsWriter.FlushNotifications flushNotifications) throws java.io.IOException
- Throws:
java.io.IOException
-
pendingFilesToDelete
public java.util.Set<java.lang.String> pendingFilesToDelete()
-
sortLiveDocs
private FixedBitSet sortLiveDocs(Bits liveDocs, Sorter.DocMap sortMap) throws java.io.IOException
- Throws:
java.io.IOException
-
sealFlushedSegment
void sealFlushedSegment(DocumentsWriterPerThread.FlushedSegment flushedSegment, Sorter.DocMap sortMap, DocumentsWriter.FlushNotifications flushNotifications) throws java.io.IOException
Seals theSegmentInfo
for the new flushed segment and persists the deleted documentsFixedBitSet
.- Throws:
java.io.IOException
-
getSegmentInfo
SegmentInfo getSegmentInfo()
Get current segment info we are writing.
-
bytesUsed
long bytesUsed()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-