final class DocumentsWriter extends java.lang.Object implements java.io.Closeable, Accountable
| Modifier and Type | Class and Description |
|---|---|
(package private) static interface |
DocumentsWriter.FlushNotifications |
| Modifier and Type | Field and Description |
|---|---|
private boolean |
closed |
private LiveIndexWriterConfig |
config |
private DocumentsWriterDeleteQueue |
currentFullFlushDelQueue |
(package private) DocumentsWriterDeleteQueue |
deleteQueue |
private Directory |
directory |
private Directory |
directoryOrig |
private boolean |
enableTestPoints |
(package private) DocumentsWriterFlushControl |
flushControl |
private DocumentsWriter.FlushNotifications |
flushNotifications |
(package private) FlushPolicy |
flushPolicy |
private FieldInfos.FieldNumbers |
globalFieldNumberMap |
private int |
indexCreatedVersionMajor |
private InfoStream |
infoStream |
private long |
lastSeqNo |
private java.util.concurrent.atomic.AtomicInteger |
numDocsInRAM |
private boolean |
pendingChangesInCurrentFullFlush |
private java.util.concurrent.atomic.AtomicLong |
pendingNumDocs |
(package private) DocumentsWriterPerThreadPool |
perThreadPool |
private java.util.function.Supplier<java.lang.String> |
segmentNameSupplier |
private DocumentsWriterFlushQueue |
ticketQueue |
| Constructor and Description |
|---|
DocumentsWriter(DocumentsWriter.FlushNotifications flushNotifications,
int indexCreatedVersionMajor,
java.util.concurrent.atomic.AtomicLong pendingNumDocs,
boolean enableTestPoints,
java.util.function.Supplier<java.lang.String> segmentNameSupplier,
LiveIndexWriterConfig config,
Directory directoryOrig,
Directory directory,
FieldInfos.FieldNumbers globalFieldNumberMap) |
| Modifier and Type | Method and 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.
|
private int |
abortThreadState(DocumentsWriterPerThreadPool.ThreadState perThread)
Returns how many documents were aborted.
|
(package private) boolean |
anyChanges() |
boolean |
anyDeletions() |
private boolean |
applyAllDeletes(DocumentsWriterDeleteQueue deleteQueue)
If buffered deletes are using too much heap, resolve them and write disk and return true.
|
private long |
applyDeleteOrUpdate(java.util.function.ToLongFunction<DocumentsWriterDeleteQueue> function) |
private boolean |
assertTicketQueueModification(DocumentsWriterDeleteQueue deleteQueue) |
void |
close() |
(package private) long |
deleteQueries(Query... queries) |
(package private) long |
deleteTerms(Term... terms) |
private boolean |
doFlush(DocumentsWriterPerThread flushingDWPT) |
private void |
ensureInitialized(DocumentsWriterPerThreadPool.ThreadState state) |
private void |
ensureOpen() |
(package private) void |
finishFullFlush(boolean success) |
(package private) long |
flushAllThreads() |
(package private) boolean |
flushOneDWPT() |
int |
getBufferedDeleteTermsSize() |
long |
getFlushingBytes()
Returns the number of bytes currently being flushed
This is a subset of the value returned by
ramBytesUsed() |
long |
getMaxCompletedSequenceNumber()
returns the maximum sequence number for all previously completed operations
|
int |
getNumBufferedDeleteTerms() |
(package private) int |
getNumDocs()
Returns how many docs are currently buffered in RAM.
|
(package private) java.io.Closeable |
lockAndAbortAll()
Locks all currently active DWPT and aborts them.
|
private boolean |
postUpdate(DocumentsWriterPerThread flushingDWPT,
boolean hasEvents) |
private boolean |
preUpdate() |
(package private) void |
purgeFlushTickets(boolean forced,
IOUtils.IOConsumer<DocumentsWriterFlushQueue.FlushTicket> consumer) |
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
private boolean |
setFlushingDeleteQueue(DocumentsWriterDeleteQueue session) |
(package private) void |
setLastSeqNo(long seqNo) |
(package private) void |
subtractFlushedNumDocs(int numFlushed) |
(package private) long |
updateDocument(java.lang.Iterable<? extends IndexableField> doc,
Analyzer analyzer,
DocumentsWriterDeleteQueue.Node<?> delNode) |
(package private) long |
updateDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs,
Analyzer analyzer,
DocumentsWriterDeleteQueue.Node<?> delNode) |
(package private) long |
updateDocValues(DocValuesUpdate... updates) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetChildResourcesprivate final Directory directoryOrig
private final Directory directory
private final FieldInfos.FieldNumbers globalFieldNumberMap
private final int indexCreatedVersionMajor
private final java.util.concurrent.atomic.AtomicLong pendingNumDocs
private final boolean enableTestPoints
private final java.util.function.Supplier<java.lang.String> segmentNameSupplier
private final DocumentsWriter.FlushNotifications flushNotifications
private volatile boolean closed
private final InfoStream infoStream
private final LiveIndexWriterConfig config
private final java.util.concurrent.atomic.AtomicInteger numDocsInRAM
volatile DocumentsWriterDeleteQueue deleteQueue
private final DocumentsWriterFlushQueue ticketQueue
private volatile boolean pendingChangesInCurrentFullFlush
final DocumentsWriterPerThreadPool perThreadPool
final FlushPolicy flushPolicy
final DocumentsWriterFlushControl flushControl
private long lastSeqNo
private volatile DocumentsWriterDeleteQueue currentFullFlushDelQueue
DocumentsWriter(DocumentsWriter.FlushNotifications flushNotifications, int indexCreatedVersionMajor, java.util.concurrent.atomic.AtomicLong pendingNumDocs, boolean enableTestPoints, java.util.function.Supplier<java.lang.String> segmentNameSupplier, LiveIndexWriterConfig config, Directory directoryOrig, Directory directory, FieldInfos.FieldNumbers globalFieldNumberMap)
long deleteQueries(Query... queries) throws java.io.IOException
java.io.IOExceptionvoid setLastSeqNo(long seqNo)
long deleteTerms(Term... terms) throws java.io.IOException
java.io.IOExceptionlong updateDocValues(DocValuesUpdate... updates) throws java.io.IOException
java.io.IOExceptionprivate long applyDeleteOrUpdate(java.util.function.ToLongFunction<DocumentsWriterDeleteQueue> function) throws java.io.IOException
java.io.IOExceptionprivate boolean applyAllDeletes(DocumentsWriterDeleteQueue deleteQueue) throws java.io.IOException
java.io.IOExceptionvoid purgeFlushTickets(boolean forced,
IOUtils.IOConsumer<DocumentsWriterFlushQueue.FlushTicket> consumer)
throws java.io.IOException
java.io.IOExceptionint getNumDocs()
private void ensureOpen()
throws AlreadyClosedException
AlreadyClosedExceptionvoid abort()
throws java.io.IOException
java.io.IOExceptionfinal boolean flushOneDWPT()
throws java.io.IOException
java.io.IOExceptionjava.io.Closeable lockAndAbortAll()
throws java.io.IOException
java.io.IOExceptionprivate int abortThreadState(DocumentsWriterPerThreadPool.ThreadState perThread) throws java.io.IOException
java.io.IOExceptionpublic long getMaxCompletedSequenceNumber()
boolean anyChanges()
public int getBufferedDeleteTermsSize()
public int getNumBufferedDeleteTerms()
public boolean anyDeletions()
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableprivate boolean preUpdate()
throws java.io.IOException
java.io.IOExceptionprivate boolean postUpdate(DocumentsWriterPerThread flushingDWPT, boolean hasEvents) throws java.io.IOException
java.io.IOExceptionprivate void ensureInitialized(DocumentsWriterPerThreadPool.ThreadState state) throws java.io.IOException
java.io.IOExceptionlong updateDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer analyzer, DocumentsWriterDeleteQueue.Node<?> delNode) throws java.io.IOException
java.io.IOExceptionlong updateDocument(java.lang.Iterable<? extends IndexableField> doc, Analyzer analyzer, DocumentsWriterDeleteQueue.Node<?> delNode) throws java.io.IOException
java.io.IOExceptionprivate boolean doFlush(DocumentsWriterPerThread flushingDWPT) throws java.io.IOException
java.io.IOExceptionvoid subtractFlushedNumDocs(int numFlushed)
private boolean setFlushingDeleteQueue(DocumentsWriterDeleteQueue session)
private boolean assertTicketQueueModification(DocumentsWriterDeleteQueue deleteQueue)
long flushAllThreads()
throws java.io.IOException
java.io.IOExceptionvoid finishFullFlush(boolean success)
throws java.io.IOException
java.io.IOExceptionpublic long ramBytesUsed()
AccountableramBytesUsed in interface Accountablepublic long getFlushingBytes()
ramBytesUsed()