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?
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.
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.