Get the App
SLTechnology News&Howtos  ›  Database  › 

A brief introduction to the principle of MySQL two-stage submission process

Shulou Source: shulou.com Published: 2022-06-01 06:43:42 10月04日 Update

MySQL uses two-phase commit to solve the problem of data consistency between binlog and InnoDB redo log.

Two-phase submission diagram:

Description of the principle of two-phase submission:

Stage 1:InnoDB redo log write disk, InnoDB transaction enters prepare state

Phase 2: if the previous prepare succeeds and binlog writes, then continue to persist the transaction log to binlog, and if the persistence is successful, then InnoDB

The transaction enters the commit state (actually writing a commit record in the redo log)

Note: a XID event is recorded at the end of each transaction binlog, indicating whether the transaction was committed successfully, that is, during the recovery process, binlog

Everything after the last XID event should be purge.

Tags: Phase transaction success state principle process consistency consistency that is content comments actual data log is at the end flag diagram problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Redmi Shulou Tech Info Linux macOS