Package org.apache.cassandra.io.sstable
Class SSTable
java.lang.Object
org.apache.cassandra.io.sstable.SSTable
- Direct Known Subclasses:
SSTableReader,SSTableWriter,SSTableZeroCopyWriter
This class represents an abstract sstable on disk whose keys and corresponding partitions are stored in
a
SSTableFormat.Components.DATA file in order as imposed by DecoratedKey.comparator.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSSTable.Builder<S extends SSTable,B extends SSTable.Builder<S, B>> A builder of this sstable representation.static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ChunkCachefinal booleanfinal Descriptorfinal IOOptionsprotected final TableMetadataRefstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponents(Collection<Component> newComponents) Registers new custom components.static voidcopy(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components) decorateKey(ByteBuffer key) abstract AbstractBounds<Token>abstract DecoratedKeygetFirst()getId()abstract DecoratedKeygetLast()Returns all SSTable components that should be streamed.static voidhardlink(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components) metadata()final Optional<SSTable.Owner>owner()voidregisterComponents(Collection<Component> newComponents, Tracker tracker) Registers new custom components into sstable and update size trackingstatic voidrename(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components) toString()static Pair<Descriptor,Component> tryComponentFromFilename(File file) Parse a sstable filename into both aDescriptorandComponentobject.static Pair<Descriptor,Component> tryComponentFromFilename(File file, String keyspace, String table) Parse a sstable filename into both aDescriptorandComponentobject.static DescriptortryDescriptorFromFile(File file) Parse a sstable filename into aDescriptorobject.protected final <B extends SSTable.Builder<?,B>>
BunbuildTo(B builder, boolean sharedCopy) The method sets fields for this sstable representation on the providedSSTable.Builder.voidunregisterComponents(Collection<Component> removeComponents, Tracker tracker) Unregisters custom components from sstable and update size trackingstatic voidvalidateRepairedMetadata(long repairedAt, TimeUUID pendingRepair, boolean isTransient)
-
Field Details
-
TOMBSTONE_HISTOGRAM_BIN_SIZE
public static final int TOMBSTONE_HISTOGRAM_BIN_SIZE- See Also:
-
TOMBSTONE_HISTOGRAM_SPOOL_SIZE
public static final int TOMBSTONE_HISTOGRAM_SPOOL_SIZE- See Also:
-
TOMBSTONE_HISTOGRAM_TTL_ROUND_SECONDS
public static final int TOMBSTONE_HISTOGRAM_TTL_ROUND_SECONDS -
descriptor
-
components
-
compression
public final boolean compression -
metadata
-
chunkCache
-
ioOptions
-
-
Constructor Details
-
SSTable
-
-
Method Details
-
owner
-
rename
-
copy
-
hardlink
-
getFirst
-
getLast
-
getBounds
-
getComponents
-
getStreamingComponents
Returns all SSTable components that should be streamed. -
metadata
-
getPartitioner
-
decorateKey
-
getFilename
-
getColumnFamilyName
-
getKeyspaceName
-
getId
-
getAllFilePaths
-
unbuildTo
The method sets fields for this sstable representation on the providedSSTable.Builder. The method is intended to be called from the overloadedunbuildTomethod in subclasses.- Parameters:
builder- the builder on which the fields should be setsharedCopy- whether theSharedCloseableresources should be passed as shared copies or directly; note that the method will overwrite the fields representingSharedCloseableonly if they are not set in the builder yet (the relevant fields in the builder arenull). AlthoughSSTabledoes not keep any references to resources, the parameters is added for the possible future fields and for consistency with the overloaded implementations in subclasses- Returns:
- the same instance of builder as provided
-
tryComponentFromFilename
Parse a sstable filename into both aDescriptorandComponentobject.- Parameters:
file- the filename to parse.- Returns:
- a pair of the
DescriptorandComponentcorresponding tofileif it corresponds to a valid and supported sstable filename,nullotherwise. Note that components of an unknown type will be returned as CUSTOM ones.
-
tryComponentFromFilename
public static Pair<Descriptor,Component> tryComponentFromFilename(File file, String keyspace, String table) Parse a sstable filename into both aDescriptorandComponentobject.- Parameters:
file- the filename to parse.keyspace- The keyspace name of the file.table- The table name of the file.- Returns:
- a pair of the
DescriptorandComponentcorresponding tofileif it corresponds to a valid and supported sstable filename,nullotherwise. Note that components of an unknown type will be returned as CUSTOM ones.
-
tryDescriptorFromFile
Parse a sstable filename into aDescriptorobject.Note that this method ignores the component part of the filename; if this is not what you want, use
tryComponentFromFilename(org.apache.cassandra.io.util.File)instead.- Parameters:
file- the filename to parse.- Returns:
- the
Descriptorcorresponding tofileif it corresponds to a valid and supported sstable filename,nullotherwise.
-
toString
-
validateRepairedMetadata
public static void validateRepairedMetadata(long repairedAt, TimeUUID pendingRepair, boolean isTransient) -
addComponents
Registers new custom components. Used by custom compaction strategies. Adding a component for the second time is a no-op. Don't remove this - this method is a part of the public API, intended for use by custom compaction strategies.- Parameters:
newComponents- collection of components to be added
-
registerComponents
Registers new custom components into sstable and update size tracking- Parameters:
newComponents- collection of components to be addedtracker- used to update on-disk size metrics
-
unregisterComponents
Unregisters custom components from sstable and update size tracking- Parameters:
removeComponents- collection of components to be removedtracker- used to update on-disk size metrics
-