Friends, I have a question: TiDB defaults to pessimistic locking, so why do optimistic lock conflicts still occur?

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

Original topic: 群友们问个问题 tidb默认是悲观锁 为啥还会出现乐观锁冲突

| username: tidb狂热爱好者

【TiDB Usage Environment】Production Environment / Testing / Poc
【TiDB Version】
【Encountered Issues】
【Reproduction Path】What operations were performed that caused the issue
【Issue Phenomenon and Impact】
(36 messages) TiDB write conflict issue investigation_Blog of a Programmer in Singapore-CSDN Blog
Group members, I have a question. TiDB defaults to pessimistic locking, so why do optimistic lock conflicts still occur?


【Attachment】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: WalterWj | Original post link

In pessimistic transactions, auto-commit is handled as optimistic transactions.