[Spring6 Source Code・Transaction] Transaction Core Source Code Analysis

business related

Before that, a brief review:

Four characteristics of transactions:

  • Atomicity: Transactions are indivisible, either all are executed or none are executed.
  • Consistency: Before and after the execution of the transaction, the integrity of the data remains consistent, that is, the total amount of data before and after modification is roughly the same.
  • Isolation: During the execution of a transaction, it will not be disturbed by other transactions.
  • Durability: Once a transaction ends, the impact on the database is permanent. The data is persisted to the database.

Common problems of transactions in concurrent scenarios:

  • Dirty read: When transaction A reads the uncommitted data of transaction B, transaction B rolls back, causing the data read by transaction A to be dirty data.
  • Non-repeatable read: after transaction A reads the data for the first time, transaction B modifies and submits the data

Guess you like

Origin blog.csdn.net/CSDN_SAVIOR/article/details/128902001