Write about conflict-related issues

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

Original topic: 写写冲突相关问题

| username: Raymond

In pessimistic transaction mode, when the system variable autocommit is set to ON, the transaction will initially be committed in optimistic transaction mode. If a write-write conflict is encountered during the prewrite phase of the commit process, the transaction will switch to pessimistic mode. In pessimistic mode, will backoff retry be performed?

Can transaction retries be divided into the following steps:
Transaction retries can be summarized into the following three steps:

  1. Reacquire start_ts.
  2. Re-execute the SQL statements that include write operations.
  3. Perform the two-phase commit again.
| username: xfworld | Original post link

By default, if it is a pessimistic transaction, it will not be handled in the optimistic transaction manner.
By default, if it is an optimistic transaction, it will not be handled in the pessimistic transaction manner.

If you are interested in the differences between pessimistic and optimistic transactions, you can refer to the following document:


The transaction mode can be set globally or at the session level.

| username: forever | Original post link

The pessimistic transaction model involves attempting to lock the resources that need to be modified before actually committing the transaction. Only after ensuring that the transaction can definitely be executed successfully does the commit begin. It has nothing to do with optimistic transactions.

| username: system | Original post link

This topic will be automatically closed 60 days after the last reply. No new replies are allowed.