Does TiDB lack undo?

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

Original topic: tidb 是否不存在undo

| username: Raymond

May I ask, TiDB should not have undo, right? After all, MVCC is implemented by retaining multiple versions, rather than relying on the current version combined with undo log to revert to the previous version like MySQL?

| username: xfworld | Original post link

Undo also exists, but the handling method is different. It uses WAL (Write-Ahead Logging) to record (MySQL redo and undo are not separated either). In the event of an extreme situation like a power outage, TiDB will prioritize loading records from the WAL and continue processing to ensure the consistency and integrity of committed transactions.

| username: ShawnYan | Original post link

Logs are written sequentially first, and the in-memory undo may lose data in the event of a power failure. Finding the previous version relies on TSO.

| username: xiaohetao | Original post link

:+1::+1::+1:

| username: ddhe9527 | Original post link

MySQL’s MVCC is implemented using UNDO and Read View. The historical versions of data are stored in UNDO, and the visibility of data versions is determined by constructing a Read View. TiDB does not have UNDO (WAL is only for disaster recovery and is unrelated to MVCC, similar to redo). It stores all historical versions of data and determines data visibility by comparing the commit_ts of the data’s historical versions with the start_ts of the current transaction.

| username: xiaohetao | Original post link

| username: Raymond | Original post link

WAL actually functions similarly to redo logs. TiDB should not have undo logs.

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.