Package org.apache.lucene.index
Class SegmentCommitInfo
- java.lang.Object
-
- org.apache.lucene.index.SegmentCommitInfo
-
public class SegmentCommitInfo extends java.lang.ObjectEmbeds a [read-only] SegmentInfo and adds per-commit fields.
-
-
Field Summary
Fields Modifier and Type Field Description private longbufferedDeletesGenprivate intdelCountprivate longdelGenprivate longdocValuesGenprivate java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>>dvUpdatesFilesprivate java.util.Set<java.lang.String>fieldInfosFilesprivate longfieldInfosGenprivate byte[]idId that uniquely identifies this segment commit.SegmentInfoinfoTheSegmentInfothat we wrap.private longnextWriteDelGenprivate longnextWriteDocValuesGenprivate longnextWriteFieldInfosGenprivate longsizeInBytesprivate intsoftDelCount
-
Constructor Summary
Constructors Constructor Description SegmentCommitInfo(SegmentInfo info, int delCount, int softDelCount, long delGen, long fieldInfosGen, long docValuesGen, byte[] id)Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadvanceDelGen()Called when we succeed in writing deletes(package private) voidadvanceDocValuesGen()Called when we succeed in writing a new DocValues generation.(package private) voidadvanceFieldInfosGen()Called when we succeed in writing a new FieldInfos generation.(package private) voidadvanceNextWriteDelGen()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) voidadvanceNextWriteDocValuesGen()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) voidadvanceNextWriteFieldInfosGen()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.SegmentCommitInfoclone()java.util.Collection<java.lang.String>files()Returns all files in use by this segment.private voidgenerationAdvanced()(package private) longgetBufferedDeletesGen()intgetDelCount()Returns the number of deleted docs in the segment.(package private) intgetDelCount(boolean includeSoftDeletes)longgetDelGen()Returns generation number of the live docs file or -1 if there are no deletes yet.longgetDocValuesGen()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.longgetFieldInfosGen()Returns the generation number of the field infos file or -1 if there are no field updates yet.byte[]getId()Returns and Id that uniquely identifies this segment commit ornullif there is no ID assigned.longgetNextDelGen()Returns the next available generation number of the live docs file.longgetNextDocValuesGen()Returns the next available generation number of the DocValues files.longgetNextFieldInfosGen()Returns the next available generation number of the FieldInfos files.(package private) longgetNextWriteDelGen()Gets the nextWriteDelGen.(package private) longgetNextWriteDocValuesGen()Gets the nextWriteDocValuesGen.(package private) longgetNextWriteFieldInfosGen()Gets the nextWriteFieldInfosGen.intgetSoftDelCount()Returns the number of only soft-deleted docs.booleanhasDeletions()Returns true if there are any deletions for the segment at this commit.booleanhasFieldUpdates()Returns true if there are any field updates for the segment in this commit.(package private) voidsetBufferedDeletesGen(long v)(package private) voidsetDelCount(int delCount)voidsetDocValuesUpdatesFiles(java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> dvUpdatesFiles)Sets the DocValues updates file names, per field number.voidsetFieldInfosFiles(java.util.Set<java.lang.String> fieldInfosFiles)Sets the FieldInfos file names.(package private) voidsetNextWriteDelGen(long v)Sets the nextWriteDelGen.(package private) voidsetNextWriteDocValuesGen(long v)Sets the nextWriteDocValuesGen.(package private) voidsetNextWriteFieldInfosGen(long v)Sets the nextWriteFieldInfosGen.(package private) voidsetSoftDelCount(int softDelCount)longsizeInBytes()Returns total size in bytes of all files for this segment.java.lang.StringtoString()java.lang.StringtoString(int pendingDelCount)Returns a description of this segment.
-
-
-
Field Detail
-
info
public final SegmentInfo info
TheSegmentInfothat we wrap.
-
id
private byte[] id
Id that uniquely identifies this segment commit.
-
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, byte[] id)
Sole constructor.- Parameters:
info-SegmentInfothat we wrapdelCount- number of deleted documents in this segmentdelGen- 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)id- Id that uniquely identifies this segment commit. This id must be 16 bytes long. SeeStringHelper.randomId()
-
-
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.IOExceptionReturns 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.IOExceptionReturns 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:
toStringin classjava.lang.Object
-
clone
public SegmentCommitInfo clone()
- Overrides:
clonein classjava.lang.Object
-
getDelCount
final int getDelCount(boolean includeSoftDeletes)
-
generationAdvanced
private void generationAdvanced()
-
getId
public byte[] getId()
Returns and Id that uniquely identifies this segment commit ornullif there is no ID assigned. This ID changes each time the the segment changes due to a delete, doc-value or field update.
-
-