the sequence number does give a versioning information, but why do we need that? The SST structure itself already tells you which one is newer and which one is older: when we do compaction, record from L level always overwrite the one in L 1 level, if they have the same user key.
CodePudding user response:
For RocksDB, the sequence number is used for a few features, including Snapshot, Transactions, etc.
- Snapshot: https://github.com/facebook/rocksdb/wiki/Snapshot
- Transactions: https://github.com/facebook/rocksdb/wiki/Transactions
CodePudding user response:
The sequence number is a database internal concept. It is meant to signify the transaction ID to implement MVCC. It also allows for semantics around read and write visibility when there are concurrent transactions going through the system. Sequence number then also allow for reading a consistent snapshot of the data. Compaction is just one application of the concept