Class FrozenBufferedUpdates


  • final class FrozenBufferedUpdates
    extends java.lang.Object
    Holds buffered deletes and updates by term or query, once pushed. Pushed deletes/updates are write-once, so we shift to more memory efficient data structure to hold them. We don't hold docIDs because these are applied on flush.
    • Field Detail

      • BYTES_PER_DEL_QUERY

        static final int BYTES_PER_DEL_QUERY
      • deleteQueries

        final Query[] deleteQueries
      • deleteQueryLimits

        final int[] deleteQueryLimits
      • applied

        public final java.util.concurrent.CountDownLatch applied
        Counts down once all deletes/updates have been applied
      • applyLock

        private final java.util.concurrent.locks.ReentrantLock applyLock
      • fieldUpdates

        private final java.util.Map<java.lang.String,​FieldUpdatesBuffer> fieldUpdates
      • totalDelCount

        public long totalDelCount
        How many total documents were deleted/updated.
      • fieldUpdatesCount

        private final int fieldUpdatesCount
      • bytesUsed

        final int bytesUsed
      • numTermDeletes

        final int numTermDeletes
      • delGen

        private long delGen
    • Method Detail

      • getInfosToApply

        private java.util.List<SegmentCommitInfo> getInfosToApply​(IndexWriter writer)
        Returns the SegmentCommitInfo that this packet is supposed to apply its deletes to, or null if the private segment was already merged away.
      • tryApply

        boolean tryApply​(IndexWriter writer)
                  throws java.io.IOException
        Translates a frozen packet of delete term/query, or doc values updates, into their actual docIDs in the index, and applies the change. This is a heavy operation and is done concurrently by incoming indexing threads. This method will return immediately without blocking if another thread is currently applying the package. In order to ensure the packet has been applied, forceApply(IndexWriter) must be called.
        Throws:
        java.io.IOException
      • forceApply

        void forceApply​(IndexWriter writer)
                 throws java.io.IOException
        Translates a frozen packet of delete term/query, or doc values updates, into their actual docIDs in the index, and applies the change. This is a heavy operation and is done concurrently by incoming indexing threads.
        Throws:
        java.io.IOException
      • finishApply

        private void finishApply​(IndexWriter writer,
                                 BufferedUpdatesStream.SegmentState[] segStates,
                                 boolean success,
                                 java.util.Set<java.lang.String> delFiles)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • apply

        private long apply​(BufferedUpdatesStream.SegmentState[] segStates)
                    throws java.io.IOException
        Applies pending delete-by-term, delete-by-query and doc values updates to all segments in the index, returning the number of new deleted or updated documents.
        Throws:
        java.io.IOException
      • applyDocValuesUpdates

        private static long applyDocValuesUpdates​(BufferedUpdatesStream.SegmentState segState,
                                                  java.util.Map<java.lang.String,​FieldUpdatesBuffer> updates,
                                                  long delGen,
                                                  boolean segmentPrivateDeletes)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • setDelGen

        public void setDelGen​(long delGen)
      • delGen

        public long delGen()
      • toString

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

        boolean any()