Class IndexSummaryBuilder
java.lang.Object
org.apache.cassandra.io.sstable.indexsummary.IndexSummaryBuilder
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a boundary that is guaranteed fully readable in the summary, index file and data file. -
Constructor Summary
ConstructorsConstructorDescriptionIndexSummaryBuilder(long expectedKeys, int minIndexInterval, int samplingLevel) Build an index summary builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild(IPartitioner partitioner) build(IPartitioner partitioner, IndexSummaryBuilder.ReadableBoundary boundary) voidclose()static IndexSummarydownsample(IndexSummary existing, int newSamplingLevel, int minIndexInterval, IPartitioner partitioner) Downsamples an existing index summary to a new sampling level.voidmarkDataSynced(long upToPosition) voidmarkIndexSynced(long upToPosition) maybeAddEntry(DecoratedKey decoratedKey, long indexStart) maybeAddEntry(DecoratedKey decoratedKey, long indexStart, long indexEnd, long dataEnd) void
-
Constructor Details
-
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 Details
-
markIndexSynced
public void markIndexSynced(long upToPosition) -
markDataSynced
public void markDataSynced(long upToPosition) -
getLastReadableBoundary
-
maybeAddEntry
public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart) throws IOException - Throws:
IOException
-
maybeAddEntry
public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart, long indexEnd, long dataEnd) throws 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:
IOException
-
prepareToCommit
public void prepareToCommit() -
build
-
build
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
close
-
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
-