Project: Scylla (App Definition and Development / Database)
File: sstable-scylla-format.md

The `Scylla.db` component (present in a file named like `mc-223-big-Scylla.db` contains assorted Scylla-only metadata. Its presence indicates the sstable was created by Scylla (or some Scylla-aware creator). Non-Scylla consumers will ignore it. The file is small and intended to be processed in-memory. The main structure is that of an unordered set of subcomponents. Each component is prefixed with a be32 tag that indicates its type, and its serialized size (so unknown subcomponents can be skipped). scylladb = subcomponentcount (tag serialized_size subcomponent)* subcomponent_count = be32 serialized_size = be32 tag = be32 The following subcomponents are recognized. They are described in more detail in individual sections subcomponent = sharding_metadata | features | extension_attributes | run_identifier | largedatastats | sstable_origin | scyllabuildid | scylla_version `sharding_metadata` (tag 1): describes what token sub-ranges are included in this sstable. This is used, when loading the sstable, to determine which shard(s) it occupies. `features` (tag 2): a set of boolean flags that describe the sstable `extension_attributes` (tag 3): a `map<string, string>` with additional attributes `run_identifier` (tag 4): a uuid that is the same for all sstables in the same run (and different for sstables in different runs). `largedatastats` (tag 5): a `map<largedatatype, largedatastats_entry>` with statistics about large data entities in the sstable. `sstable_origin` (tag 6): a string describing the origin of the sstable ("memtable" for memtable flush, "garbage collection" for compaction, etc.). `scyllabuildid` (tag 7): a string containing the build id of the Scylla executable that created the sstable. `scylla_version` (tag 8): a string containing the version of the Scylla executable that created the sstable. shardingmetadata = tokenrangecount tokenrange* tokenrangecount = be32 tokenrange = lefttokenbound righttoken_bound lefttokenbound = token_bound righttokenbound = token_bound tokenbound = exclusiveflag token exclusive_flag = byte // 0=inclusive, 1=exclusive token = token_size byte* token_size = be16 Sharding metadata is a sorted list of disjoint token ranges. Each token range consists of a left bound and a right bound; either bound may be inclusive or

The tokens are interpreted according to the partitioner. The sstable contains no partitions whose token is outside the ranges described by sharding_metadata. features = be64 // interpreted as a set of bits bit 0: NonCompoundPIEntries (if set, indicates the sstable was generated by Scylla with issue #2993 fixed) bit 1: NonCompoundRangeTombstones (if set, indicates the sstable was generated by Scylla with issue #2986 fixed) bit 2: ShadowableTombstones (if set, indicates the sstable was generated by Scylla with issue #3885 fixed) bit 3: CorrectStaticCompact (if set, indicates the sstable was generated by Scylla with issue #4139 fixed) bit 4: CorrectEmptyCounters (if set, indicates the sstable was generated by Scylla with issue #4363 fixed) bit 5: CorrectUDTsInCollections (if set, indicates that the sstable was generated by Scylla with issue #6130 fixed) extensionattributes = extensionattributecount extensionattribute* extensionattributecount = be32 extensionattribute = extensionattributekey extensionattribute_value extensionattributekey = string32 extensionattributevalue = string32 string32 = string32_size byte* string32_size = be32 There are currently no defined attributes. run_identifier = uuid uuid = uuidhighbits uuidlowbits uuidhighbits = be64 uuidlowbits = be64 If the run_identifier subcomponent is present, the sstable is part of a run. All sstables with the same run_identifier belong to the same run. They are guaranteed to be disjoint (non-overlapping) in their partition keys. largedatastats = largedatacount largedatapair* largedatacount = be32 largedatapair = largedatatype largedatastats_entry largedatatype = partitionsize | rowsize | cellsize | rowsinpartition | elementsin_collection partition_size = be32(1) // partition size, in bytes row_size = be32(2) // row size, in bytes cell_size = be32(3) // cell size, in bytes rowsinpartition = be32(4) // number of rows in a partition elementsincollection = be32(5) // number of elements in a collection largedatastatsentry = maxvalue threshold above_threshold max_value = be64 threshold = be64 above_threshold = be32 The largedatastats component holds statistics about partition, row, and cell sizes and about number of rows in partition. For each entry, it keeps the largest value for the entry type, the respective large_data threshold and the number of entities that are above the threshold.