Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: rocksdb列簇主要用来做什么
【TiDB Usage Environment】Production Environment or Test Environment or POC
【TiDB Version】
【Encountered Problem】
【Reproduction Path】What operations were performed that led to the problem
【Problem Phenomenon and Impact】
【Attachments】 Relevant logs and monitoring (https://metricstool.pingcap.com/)
If the question is related to performance optimization or troubleshooting, please download the script and run it. Please select all and copy-paste the terminal output results for upload.
A column family is equivalent to a combination of certain columns, isolating the storage of different columns in a table. Different columns have different storage directories. You can look into HBase; this structure is quite similar to RocksDB and has more available resources.
Column families are equivalent to logical partitions in RocksDB; they share the WAL but can be used to store different data. In TiDB, the RocksDB that stores data includes four column families: Default CF, Write CF, Lock CF, and Raft CF. The first three CFs correspond to the data column, write column, and lock column in the Percolator transaction model, respectively, meaning they are used to store different columns of data in the Percolator transaction model. Raft CF is used to store the metadata of each Region in the current TiKV instance.
Does it not support manually creating CF?
In theory, you can manually create CF through RocksDB’s CreateColumnFamily method, but the TiDB transaction model will only use the above four CFs created in kvdb.
Hi,
TiKV only uses four ColumnFamilies in RocksDB: write, default, lock, and raft. The first three correspond to the three columns in the Percolator algorithm. For more details, you can refer to TiKV | Percolator
During the write and read processes, the write, default, and lock Column Families are all actually involved.
RocksDB is a single-node key-value database where column families can be created freely like in HBase. Each column family independently occupies memtable/immutable memtable, and flush and compact operations are also separate. Different column families share the WAL (Write-Ahead Log) to achieve atomic writes across multiple column families in RocksDB.
TiKV uses the single-node version of RocksDB to create a distributed key-value store and has fixed the creation of four column families.
That is to say, in addition to the four fixed column families created, can you create specified column families when creating a table yourself?
If it is TiDB, then RocksDB is just a storage component of TiDB. The column families are predefined and cannot be defined by yourself. If you are using RocksDB directly, you can define them as needed.
Got it, column families are only relevant to RocksDB.
Column families are just for grouping key-values with the same format together, making storage and management more convenient.
This topic was automatically closed 1 minute after the last reply. No new replies are allowed.