ReadIndex Question: Is it Serialized Writing and Application?

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

Original topic: readindex疑问:难道是序列化的写和应用吗?

| username: 考试没答案

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact] Readindex question: Is it serialized writing and application?
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

How are long-uncommitted transaction raft logs handled???

| username: TiDBer_jYQINSnf | Original post link

There is no inherent connection between transactions and raft logs.

Raft logs are the persistent storage of keys.

Transactions achieve their purpose by adding, deleting, and modifying keys using three column families (CFs).

Each addition or deletion of a key is persisted through the raft log.

Long-running uncommitted transactions actually prewrite a batch of keys but do not commit them. Raft logs are persisted rhythmically. However, when reading, due to the timestamp restrictions, uncommitted keys cannot be read. These keys remain unreadable until they are either committed or rolled back.

| username: 考试没答案 | Original post link

When performing DML modifications, a transaction will definitely be committed, even if it only modifies one piece of data. Before the transaction is committed, will the raft log be written back?

| username: 考试没答案 | Original post link

What are the different states recorded in the Raft log? Commit, rollback, or what else?

| username: TiDBer_jYQINSnf | Original post link

When writing a transaction, just tell the underlying layer:
default needs to write a key, writecf needs to write a key, lockcf needs to write a key. This is the meaning.

Because TiKV is not confident in writing these keys to just one machine, it will write to multiple machines to be assured. This coordination process is Raft.
That’s roughly the relationship.

| username: 考试没答案 | Original post link

When writing data, the lock in the lock cf not disappearing means that I haven’t committed, but have already updated N entries. Finally, this transaction was rolled back. Will the raf log record this transaction rollback?

| username: TiDBer_jYQINSnf | Original post link

Raft will record, and rollback will write a bunch of delete keys.
The Raft log will synchronize this key to other nodes.

It’s similar to a eunuch passing a message:
The emperor says: Today, everyone gets a raise.
The eunuch shouts: The emperor says there’s a raise, shouting all the way from the main hall to the gate.
The emperor then says: No raise.
The eunuch shouts: No raise.

What the eunuch shouts is the Raft log.

| username: zhaokede | Original post link

Very easy to understand.

| username: 考试没答案 | Original post link


| username: redgame | Original post link

The examples given are good…

| username: TiDBer_aaO4sU46 | Original post link

I actually understood it.

| username: dba远航 | Original post link

That is equivalent to a completed notepad.