final class DocumentsWriter extends java.lang.Object implements java.io.Closeable, Accountable
Modifier and Type | Class and Description |
---|---|
(package private) static class |
DocumentsWriter.ApplyDeletesEvent |
(package private) static class |
DocumentsWriter.DeleteNewFilesEvent |
(package private) static class |
DocumentsWriter.FlushFailedEvent |
(package private) static class |
DocumentsWriter.ForcedPurgeEvent |
(package private) static class |
DocumentsWriter.ResolveUpdatesEvent |
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 java.util.Queue<IndexWriter.Event> |
events |
(package private) DocumentsWriterFlushControl |
flushControl |
(package private) FlushPolicy |
flushPolicy |
private InfoStream |
infoStream |
private long |
lastSeqNo |
private java.util.concurrent.atomic.AtomicInteger |
numDocsInRAM |
private boolean |
pendingChangesInCurrentFullFlush |
(package private) DocumentsWriterPerThreadPool |
perThreadPool |
private DocumentsWriterFlushQueue |
ticketQueue |
private IndexWriter |
writer |
Constructor and Description |
---|
DocumentsWriter(IndexWriter writer,
LiveIndexWriterConfig config,
Directory directoryOrig,
Directory directory) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
abort(IndexWriter writer)
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.
|
void |
close() |
(package private) DocumentsWriterDeleteQueue |
currentDeleteSession() |
(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() |
java.util.Queue<IndexWriter.Event> |
eventQueue() |
(package private) void |
finishFullFlush(IndexWriter indexWriter,
boolean success) |
(package private) long |
flushAllThreads() |
int |
getBufferedDeleteTermsSize() |
LiveIndexWriterConfig |
getIndexWriterConfig() |
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) long |
lockAndAbortAll(IndexWriter indexWriter)
Returns how many documents were aborted.
|
private boolean |
postUpdate(DocumentsWriterPerThread flushingDWPT,
boolean hasEvents) |
private boolean |
preUpdate() |
(package private) int |
purgeBuffer(IndexWriter writer,
boolean forced) |
(package private) void |
putEvent(IndexWriter.Event event) |
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) void |
unlockAllAfterAbortAll(IndexWriter indexWriter) |
(package private) long |
updateDocument(java.lang.Iterable<? extends IndexableField> doc,
Analyzer analyzer,
Term delTerm) |
(package private) long |
updateDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs,
Analyzer analyzer,
Term delTerm) |
(package private) long |
updateDocValues(DocValuesUpdate... updates) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildResources
private final Directory directoryOrig
private final Directory directory
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 final IndexWriter writer
private final java.util.Queue<IndexWriter.Event> events
private long lastSeqNo
private volatile DocumentsWriterDeleteQueue currentFullFlushDelQueue
DocumentsWriter(IndexWriter writer, LiveIndexWriterConfig config, Directory directoryOrig, Directory directory)
long deleteQueries(Query... queries) throws java.io.IOException
java.io.IOException
void setLastSeqNo(long seqNo)
long deleteTerms(Term... terms) throws java.io.IOException
java.io.IOException
long updateDocValues(DocValuesUpdate... updates) throws java.io.IOException
java.io.IOException
DocumentsWriterDeleteQueue currentDeleteSession()
private boolean applyAllDeletes(DocumentsWriterDeleteQueue deleteQueue) throws java.io.IOException
java.io.IOException
int purgeBuffer(IndexWriter writer, boolean forced) throws java.io.IOException
java.io.IOException
int getNumDocs()
private void ensureOpen() throws AlreadyClosedException
AlreadyClosedException
void abort(IndexWriter writer)
long lockAndAbortAll(IndexWriter indexWriter) throws java.io.IOException
java.io.IOException
private int abortThreadState(DocumentsWriterPerThreadPool.ThreadState perThread)
void unlockAllAfterAbortAll(IndexWriter indexWriter)
public long getMaxCompletedSequenceNumber()
boolean anyChanges()
public int getBufferedDeleteTermsSize()
public int getNumBufferedDeleteTerms()
public boolean anyDeletions()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
private boolean preUpdate() throws java.io.IOException, AbortingException
java.io.IOException
AbortingException
private boolean postUpdate(DocumentsWriterPerThread flushingDWPT, boolean hasEvents) throws java.io.IOException, AbortingException
java.io.IOException
AbortingException
private void ensureInitialized(DocumentsWriterPerThreadPool.ThreadState state) throws java.io.IOException
java.io.IOException
long updateDocuments(java.lang.Iterable<? extends java.lang.Iterable<? extends IndexableField>> docs, Analyzer analyzer, Term delTerm) throws java.io.IOException, AbortingException
java.io.IOException
AbortingException
long updateDocument(java.lang.Iterable<? extends IndexableField> doc, Analyzer analyzer, Term delTerm) throws java.io.IOException, AbortingException
java.io.IOException
AbortingException
private boolean doFlush(DocumentsWriterPerThread flushingDWPT) throws java.io.IOException, AbortingException
java.io.IOException
AbortingException
void subtractFlushedNumDocs(int numFlushed)
private boolean setFlushingDeleteQueue(DocumentsWriterDeleteQueue session)
long flushAllThreads() throws java.io.IOException, AbortingException
java.io.IOException
AbortingException
void finishFullFlush(IndexWriter indexWriter, boolean success)
public LiveIndexWriterConfig getIndexWriterConfig()
void putEvent(IndexWriter.Event event)
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
public java.util.Queue<IndexWriter.Event> eventQueue()