Class MergePolicy.OneMerge

  • Enclosing class:
    MergePolicy

    public static class MergePolicy.OneMerge
    extends java.lang.Object
    OneMerge provides the information necessary to perform an individual primitive merge operation, resulting in a single new segment. The merge spec includes the subset of segments to be merged as well as whether the new segment should use the compound file format.
    • Field Detail

      • registerDone

        boolean registerDone
      • mergeGen

        long mergeGen
      • isExternal

        boolean isExternal
      • maxNumSegments

        int maxNumSegments
      • estimatedMergeBytes

        public volatile long estimatedMergeBytes
        Estimated size in bytes of the merged segment.
      • totalMergeBytes

        volatile long totalMergeBytes
      • hardLiveDocs

        java.util.List<Bits> hardLiveDocs
      • segments

        public final java.util.List<SegmentCommitInfo> segments
        Segments to be merged.
      • mergeStartNS

        volatile long mergeStartNS
      • totalMaxDoc

        public final int totalMaxDoc
        Total number of documents in segments to be merged, not accounting for deletions.
      • error

        java.lang.Throwable error
    • Method Detail

      • mergeInit

        public void mergeInit()
                       throws java.io.IOException
        Called by IndexWriter after the merge started and from the thread that will be executing the merge.
        Throws:
        java.io.IOException
      • mergeFinished

        public void mergeFinished()
                           throws java.io.IOException
        Called by IndexWriter after the merge is done and all readers have been closed.
        Throws:
        java.io.IOException
      • wrapForMerge

        public CodecReader wrapForMerge​(CodecReader reader)
                                 throws java.io.IOException
        Wrap the reader in order to add/remove information to the merged segment.
        Throws:
        java.io.IOException
      • setMergeInfo

        public void setMergeInfo​(SegmentCommitInfo info)
        Expert: Sets the SegmentCommitInfo of the merged segment. Allows sub-classes to e.g. set diagnostics properties.
      • setException

        void setException​(java.lang.Throwable error)
        Record that an exception occurred while executing this merge
      • segString

        public java.lang.String segString()
        Returns a readable description of the current merge state.
      • totalBytesSize

        public long totalBytesSize()
        Returns the total size in bytes of this merge. Note that this does not indicate the size of the merged segment, but the input total size. This is only set once the merge is initialized by IndexWriter.
      • totalNumDocs

        public int totalNumDocs()
        Returns the total number of documents that are included with this merge. Note that this does not indicate the number of documents after the merge.
      • getStoreMergeInfo

        public MergeInfo getStoreMergeInfo()
        Return MergeInfo describing this merge.
      • isAborted

        public boolean isAborted()
        Returns true if this merge was or should be aborted.
      • setAborted

        public void setAborted()
        Marks this merge as aborted. The merge thread should terminate at the soonest possible moment.