Issues with ColumnFamily in RocksDB

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 关于rocksdb的ColumnFamily问题

| username: zhanggame1

【TiDB Usage Environment】Production Environment / Testing / Poc
【TiDB Version】7.50
【Reproduction Path】What operations were performed that caused the issue
【Encountered Issue: Issue Phenomenon and Impact】
In TiDB’s kvdb, there are four ColumnFamilies: raft, lock, default, write. Data is stored in the following two CFs:

  • write column: Used to store the user’s actual write data and MVCC information (the start time and commit time of the transaction to which the data belongs). When a user writes a row of data, if the length of that row is less than 255 bytes, it will be stored in the write column; otherwise, the row will be stored in the default column. Since TiDB’s non-unique index stores an empty value and the unique index stores the primary key index value, secondary indexes will only occupy space in the write CF.

  • default column: Used to store data longer than 255 bytes.

Some questions:
For variable-length types like varchar, is the actual data length used to determine which CF it is stored in? If so, does this mean that data from the same table can appear in both CFs?

| username: tidb菜鸟一只 | Original post link

The kvdb itself stores key-value data, not the value of a specific field. As for the length of the value, it is inherently indeterminate. Whether it is stored in the write or default depends on the actual length, and it has nothing to do with whether there is a variable length type.

| username: TiDBer_jYQINSnf | Original post link

Check out this course. It’s about transactions.

| username: TIDB-Learner | Original post link

Calculate based on the actual occupied space?

| username: dba远航 | Original post link

It is calculated based on the actual length.

| username: lemonade010 | Original post link

Calculate based on actual occupied space.

| username: 双开门变频冰箱 | Original post link

According to the actual length

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.