Package org.apache.cassandra.io.sstable
Class IndexSummaryBuilder
- java.lang.Object
-
- org.apache.cassandra.io.sstable.IndexSummaryBuilder
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class IndexSummaryBuilder extends java.lang.Object implements java.lang.AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndexSummaryBuilder.ReadableBoundaryRepresents a boundary that is guaranteed fully readable in the summary, index file and data file.
-
Constructor Summary
Constructors Constructor Description IndexSummaryBuilder(long expectedKeys, int minIndexInterval, int samplingLevel)Build an index summary builder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexSummarybuild(IPartitioner partitioner)IndexSummarybuild(IPartitioner partitioner, IndexSummaryBuilder.ReadableBoundary boundary)voidclose()java.lang.Throwableclose(java.lang.Throwable accumulate)static IndexSummarydownsample(IndexSummary existing, int newSamplingLevel, int minIndexInterval, IPartitioner partitioner)Downsamples an existing index summary to a new sampling level.IndexSummaryBuilder.ReadableBoundarygetLastReadableBoundary()voidmarkDataSynced(long upToPosition)voidmarkIndexSynced(long upToPosition)IndexSummaryBuildermaybeAddEntry(DecoratedKey decoratedKey, long indexStart)IndexSummaryBuildermaybeAddEntry(DecoratedKey decoratedKey, long indexStart, long indexEnd, long dataEnd)voidprepareToCommit()
-
-
-
Constructor Detail
-
IndexSummaryBuilder
public IndexSummaryBuilder(long expectedKeys, int minIndexInterval, int samplingLevel)Build an index summary builder.- Parameters:
expectedKeys- - the number of keys we expect in the sstableminIndexInterval- - the minimum interval between entries selected for samplingsamplingLevel- - the level at which entries are sampled
-
-
Method Detail
-
markIndexSynced
public void markIndexSynced(long upToPosition)
-
markDataSynced
public void markDataSynced(long upToPosition)
-
getLastReadableBoundary
public IndexSummaryBuilder.ReadableBoundary getLastReadableBoundary()
-
maybeAddEntry
public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart) throws java.io.IOException
- Throws:
java.io.IOException
-
maybeAddEntry
public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart, long indexEnd, long dataEnd) throws java.io.IOException
- Parameters:
decoratedKey- the key for this recordindexStart- the position in the index file this record beginsindexEnd- the position in the index file we need to be able to read to (exclusive) to read this recorddataEnd- the position in the data file we need to be able to read to (exclusive) to read this record a value of 0 indicates we are not tracking readable boundaries- Throws:
java.io.IOException
-
prepareToCommit
public void prepareToCommit()
-
build
public IndexSummary build(IPartitioner partitioner)
-
build
public IndexSummary build(IPartitioner partitioner, IndexSummaryBuilder.ReadableBoundary boundary)
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
close
public java.lang.Throwable close(java.lang.Throwable accumulate)
-
downsample
public static IndexSummary downsample(IndexSummary existing, int newSamplingLevel, int minIndexInterval, IPartitioner partitioner)
Downsamples an existing index summary to a new sampling level.- Parameters:
existing- an existing IndexSummarynewSamplingLevel- the target level for the new IndexSummary. This must be less than the current sampling level for `existing`.partitioner- the partitioner used for the index summary- Returns:
- a new IndexSummary
-
-