Class SegmentCommitInfo


  • public class SegmentCommitInfo
    extends java.lang.Object
    Embeds a [read-only] SegmentInfo and adds per-commit fields.
    • Constructor Summary

      Constructors 
      Constructor Description
      SegmentCommitInfo​(SegmentInfo info, int delCount, int softDelCount, long delGen, long fieldInfosGen, long docValuesGen)
      Sole constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void advanceDelGen()
      Called when we succeed in writing deletes
      (package private) void advanceDocValuesGen()
      Called when we succeed in writing a new DocValues generation.
      (package private) void advanceFieldInfosGen()
      Called when we succeed in writing a new FieldInfos generation.
      (package private) void advanceNextWriteDelGen()
      Called if there was an exception while writing deletes, so that we don't try to write to the same file more than once.
      (package private) void advanceNextWriteDocValuesGen()
      Called if there was an exception while writing a new generation of DocValues, so that we don't try to write to the same file more than once.
      (package private) void advanceNextWriteFieldInfosGen()
      Called if there was an exception while writing a new generation of FieldInfos, so that we don't try to write to the same file more than once.
      SegmentCommitInfo clone()  
      java.util.Collection<java.lang.String> files()
      Returns all files in use by this segment.
      (package private) long getBufferedDeletesGen()  
      int getDelCount()
      Returns the number of deleted docs in the segment.
      (package private) int getDelCount​(boolean includeSoftDeletes)  
      long getDelGen()
      Returns generation number of the live docs file or -1 if there are no deletes yet.
      long getDocValuesGen()
      Returns the generation number of the DocValues file or -1 if there are no doc-values updates yet.
      java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> getDocValuesUpdatesFiles()
      Returns the per-field DocValues updates files.
      java.util.Set<java.lang.String> getFieldInfosFiles()
      Returns the FieldInfos file names.
      long getFieldInfosGen()
      Returns the generation number of the field infos file or -1 if there are no field updates yet.
      long getNextDelGen()
      Returns the next available generation number of the live docs file.
      long getNextDocValuesGen()
      Returns the next available generation number of the DocValues files.
      long getNextFieldInfosGen()
      Returns the next available generation number of the FieldInfos files.
      (package private) long getNextWriteDelGen()
      Gets the nextWriteDelGen.
      (package private) long getNextWriteDocValuesGen()
      Gets the nextWriteDocValuesGen.
      (package private) long getNextWriteFieldInfosGen()
      Gets the nextWriteFieldInfosGen.
      int getSoftDelCount()
      Returns the number of only soft-deleted docs.
      boolean hasDeletions()
      Returns true if there are any deletions for the segment at this commit.
      boolean hasFieldUpdates()
      Returns true if there are any field updates for the segment in this commit.
      (package private) void setBufferedDeletesGen​(long v)  
      (package private) void setDelCount​(int delCount)  
      void setDocValuesUpdatesFiles​(java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> dvUpdatesFiles)
      Sets the DocValues updates file names, per field number.
      void setFieldInfosFiles​(java.util.Set<java.lang.String> fieldInfosFiles)
      Sets the FieldInfos file names.
      (package private) void setNextWriteDelGen​(long v)
      Sets the nextWriteDelGen.
      (package private) void setNextWriteDocValuesGen​(long v)
      Sets the nextWriteDocValuesGen.
      (package private) void setNextWriteFieldInfosGen​(long v)
      Sets the nextWriteFieldInfosGen.
      (package private) void setSoftDelCount​(int softDelCount)  
      long sizeInBytes()
      Returns total size in bytes of all files for this segment.
      java.lang.String toString()  
      java.lang.String toString​(int pendingDelCount)
      Returns a description of this segment.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • delCount

        private int delCount
      • softDelCount

        private int softDelCount
      • delGen

        private long delGen
      • nextWriteDelGen

        private long nextWriteDelGen
      • fieldInfosGen

        private long fieldInfosGen
      • nextWriteFieldInfosGen

        private long nextWriteFieldInfosGen
      • docValuesGen

        private long docValuesGen
      • nextWriteDocValuesGen

        private long nextWriteDocValuesGen
      • dvUpdatesFiles

        private final java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> dvUpdatesFiles
      • fieldInfosFiles

        private final java.util.Set<java.lang.String> fieldInfosFiles
      • sizeInBytes

        private volatile long sizeInBytes
      • bufferedDeletesGen

        private long bufferedDeletesGen
    • Constructor Detail

      • SegmentCommitInfo

        public SegmentCommitInfo​(SegmentInfo info,
                                 int delCount,
                                 int softDelCount,
                                 long delGen,
                                 long fieldInfosGen,
                                 long docValuesGen)
        Sole constructor.
        Parameters:
        info - SegmentInfo that we wrap
        delCount - number of deleted documents in this segment
        delGen - deletion generation number (used to name deletion files)
        fieldInfosGen - FieldInfos generation number (used to name field-infos files)
        docValuesGen - DocValues generation number (used to name doc-values updates files)
    • Method Detail

      • getDocValuesUpdatesFiles

        public java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> getDocValuesUpdatesFiles()
        Returns the per-field DocValues updates files.
      • setDocValuesUpdatesFiles

        public void setDocValuesUpdatesFiles​(java.util.Map<java.lang.Integer,​java.util.Set<java.lang.String>> dvUpdatesFiles)
        Sets the DocValues updates file names, per field number. Does not deep clone the map.
      • getFieldInfosFiles

        public java.util.Set<java.lang.String> getFieldInfosFiles()
        Returns the FieldInfos file names.
      • setFieldInfosFiles

        public void setFieldInfosFiles​(java.util.Set<java.lang.String> fieldInfosFiles)
        Sets the FieldInfos file names.
      • advanceDelGen

        void advanceDelGen()
        Called when we succeed in writing deletes
      • advanceNextWriteDelGen

        void advanceNextWriteDelGen()
        Called if there was an exception while writing deletes, so that we don't try to write to the same file more than once.
      • getNextWriteDelGen

        long getNextWriteDelGen()
        Gets the nextWriteDelGen.
      • setNextWriteDelGen

        void setNextWriteDelGen​(long v)
        Sets the nextWriteDelGen.
      • advanceFieldInfosGen

        void advanceFieldInfosGen()
        Called when we succeed in writing a new FieldInfos generation.
      • advanceNextWriteFieldInfosGen

        void advanceNextWriteFieldInfosGen()
        Called if there was an exception while writing a new generation of FieldInfos, so that we don't try to write to the same file more than once.
      • getNextWriteFieldInfosGen

        long getNextWriteFieldInfosGen()
        Gets the nextWriteFieldInfosGen.
      • setNextWriteFieldInfosGen

        void setNextWriteFieldInfosGen​(long v)
        Sets the nextWriteFieldInfosGen.
      • advanceDocValuesGen

        void advanceDocValuesGen()
        Called when we succeed in writing a new DocValues generation.
      • advanceNextWriteDocValuesGen

        void advanceNextWriteDocValuesGen()
        Called if there was an exception while writing a new generation of DocValues, so that we don't try to write to the same file more than once.
      • getNextWriteDocValuesGen

        long getNextWriteDocValuesGen()
        Gets the nextWriteDocValuesGen.
      • setNextWriteDocValuesGen

        void setNextWriteDocValuesGen​(long v)
        Sets the nextWriteDocValuesGen.
      • sizeInBytes

        public long sizeInBytes()
                         throws java.io.IOException
        Returns total size in bytes of all files for this segment.
        Throws:
        java.io.IOException
      • files

        public java.util.Collection<java.lang.String> files()
                                                     throws java.io.IOException
        Returns all files in use by this segment.
        Throws:
        java.io.IOException
      • getBufferedDeletesGen

        long getBufferedDeletesGen()
      • setBufferedDeletesGen

        void setBufferedDeletesGen​(long v)
      • hasDeletions

        public boolean hasDeletions()
        Returns true if there are any deletions for the segment at this commit.
      • hasFieldUpdates

        public boolean hasFieldUpdates()
        Returns true if there are any field updates for the segment in this commit.
      • getNextFieldInfosGen

        public long getNextFieldInfosGen()
        Returns the next available generation number of the FieldInfos files.
      • getFieldInfosGen

        public long getFieldInfosGen()
        Returns the generation number of the field infos file or -1 if there are no field updates yet.
      • getNextDocValuesGen

        public long getNextDocValuesGen()
        Returns the next available generation number of the DocValues files.
      • getDocValuesGen

        public long getDocValuesGen()
        Returns the generation number of the DocValues file or -1 if there are no doc-values updates yet.
      • getNextDelGen

        public long getNextDelGen()
        Returns the next available generation number of the live docs file.
      • getDelGen

        public long getDelGen()
        Returns generation number of the live docs file or -1 if there are no deletes yet.
      • getDelCount

        public int getDelCount()
        Returns the number of deleted docs in the segment.
      • getSoftDelCount

        public int getSoftDelCount()
        Returns the number of only soft-deleted docs.
      • setDelCount

        void setDelCount​(int delCount)
      • setSoftDelCount

        void setSoftDelCount​(int softDelCount)
      • toString

        public java.lang.String toString​(int pendingDelCount)
        Returns a description of this segment.
      • toString

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

        public SegmentCommitInfo clone()
        Overrides:
        clone in class java.lang.Object
      • getDelCount

        final int getDelCount​(boolean includeSoftDeletes)