Class SegmentBuilder
java.lang.Object
org.apache.cassandra.index.sai.disk.v1.segment.SegmentBuilder
- Direct Known Subclasses:
SegmentBuilder.TrieSegmentBuilder,SegmentBuilder.VectorSegmentBuilder
Creates an on-heap index data structure to be flushed to an SSTable index.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongadd(ByteBuffer term, PrimaryKey key, long sstableRowId) protected abstract longaddInternal(ByteBuffer term, int segmentRowId) static intcastToSegmentRowId(long sstableRowId, long segmentRowIdOffset) booleanexceedsSegmentLimit(long ssTableRowId) flush(IndexDescriptor indexDescriptor) protected abstract SegmentMetadata.ComponentMetadataMapflushInternal(IndexDescriptor indexDescriptor) static intlongintbooleanabstract booleanisEmpty()longrelease()This method does three things:longstatic voidupdateLastValidSegmentRowId(long lastValidSegmentRowID)
-
Field Details
-
LAST_VALID_SEGMENT_ROW_ID
public static final long LAST_VALID_SEGMENT_ROW_ID- See Also:
-
-
Method Details
-
getActiveBuilderCount
public static int getActiveBuilderCount() -
flush
- Throws:
IOException
-
add
-
castToSegmentRowId
public static int castToSegmentRowId(long sstableRowId, long segmentRowIdOffset) -
totalBytesAllocated
public long totalBytesAllocated() -
hasReachedMinimumFlushSize
public boolean hasReachedMinimumFlushSize() -
getMinimumFlushBytes
public long getMinimumFlushBytes() -
release
public long release()This method does three things:1. It decrements active builder count and updates the global minimum flush size to reflect that. 2. It releases the builder's memory against its limiter. 3. It defensively marks the builder inactive to make sure nothing bad happens if we try to close it twice.
- Returns:
- the number of bytes used by the memory limiter after releasing this builder
-
isEmpty
public abstract boolean isEmpty() -
addInternal
-
flushInternal
protected abstract SegmentMetadata.ComponentMetadataMap flushInternal(IndexDescriptor indexDescriptor) throws IOException - Throws:
IOException
-
getRowCount
public int getRowCount() -
exceedsSegmentLimit
public boolean exceedsSegmentLimit(long ssTableRowId) - Returns:
- true if next SSTable row ID exceeds max segment row ID
-
updateLastValidSegmentRowId
public static void updateLastValidSegmentRowId(long lastValidSegmentRowID)
-