Class DocumentsWriterPerThread


  • final class DocumentsWriterPerThread
    extends java.lang.Object
    • Field Detail

      • abortingException

        private java.lang.Throwable abortingException
      • codec

        final Codec codec
      • bytesUsed

        final Counter bytesUsed
      • aborted

        private boolean aborted
      • flushPending

        private SetOnce<java.lang.Boolean> flushPending
      • lastCommittedBytesUsed

        private volatile long lastCommittedBytesUsed
      • hasFlushed

        private SetOnce<java.lang.Boolean> hasFlushed
      • numDocsInRAM

        private int numDocsInRAM
      • nf

        private final java.text.NumberFormat nf
      • pendingNumDocs

        private final java.util.concurrent.atomic.AtomicLong pendingNumDocs
      • enableTestPoints

        private final boolean enableTestPoints
      • indexVersionCreated

        private final int indexVersionCreated
      • lock

        private final java.util.concurrent.locks.ReentrantLock lock
      • deleteDocIDs

        private int[] deleteDocIDs
      • numDeletedDocIds

        private int numDeletedDocIds
      • filesToDelete

        private final java.util.Set<java.lang.String> filesToDelete
    • Constructor Detail

    • 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
      • getIndexCreatedVersionMajor

        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.
      • deleteLastDocs

        private void deleteLastDocs​(int docCount)
      • getNumDocsInRAM

        public int getNumDocsInRAM()
        Returns the number of RAM resident documents in this DocumentsWriterPerThread
      • maybeAbort

        private void maybeAbort​(java.lang.String location,
                                DocumentsWriter.FlushNotifications flushNotifications)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • pendingFilesToDelete

        java.util.Set<java.lang.String> pendingFilesToDelete()
      • getSegmentInfo

        SegmentInfo getSegmentInfo()
        Get current segment info we are writing.
      • bytesUsed

        long bytesUsed()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isFlushPending

        boolean isFlushPending()
        Returns true iff this DWPT is marked as flush pending
      • setFlushPending

        void setFlushPending()
        Sets this DWPT as flush pending. This can only be set once.
      • getLastCommittedBytesUsed

        long getLastCommittedBytesUsed()
        Returns the last committed bytes for this DWPT. This method can be called without acquiring the DWPTs lock.
      • lock

        void lock()
        Locks this DWPT for exclusive access.
        See Also:
        ReentrantLock.lock()
      • tryLock

        boolean tryLock()
        Acquires the DWPT's lock only if it is not held by another thread at the time of invocation.
        Returns:
        true if the lock was acquired.
        See Also:
        ReentrantLock.tryLock()
      • isHeldByCurrentThread

        boolean isHeldByCurrentThread()
        Returns true if the DWPT's lock is held by the current thread
        See Also:
        ReentrantLock.isHeldByCurrentThread()
      • unlock

        void unlock()
        Unlocks the DWPT's lock
        See Also:
        ReentrantLock.unlock()
      • hasFlushed

        boolean hasFlushed()
        Returns true iff this DWPT has been flushed