tencent cloud

TencentDB for MySQL

문서TencentDB for MySQL

Replication Interruption Caused by the unique_checks Parameter

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-09-15 14:43:08
AI 번역

Scenario Description

When TencentDB for MySQL is used, replication interruption may occur on standby or read-only instances, with the following error message displayed:
[ERROR] [MY-010584] [Repl] Slave SQL for channel '': Worker 1 failed executing transaction 'XXX' at master log mysql-bin.XXX, end_log_pos XXX; Could not execute Write_rows_v1 event on table XXX.XXX; Duplicate entry 'XXX' for key 'xxx.xxx', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.XXX, end_log_pos XXX, Error_code: MY-001062

Cause Analysis

Setting unique_checks to 0 may cause the above error.
The following describes the values of the unique_checks parameter:
Value 1: TencentDB for MySQL checks the uniqueness of unique keys in InnoDB tables.
Value 0: If the data operated by a DML statement is not in the buffer pool, TencentDB for MySQL does not check the uniqueness of secondary indexes in InnoDB tables by reading primary keys and unique keys from the disk. In this case, duplicate unique keys can be inserted.
On the primary instance, when unique_checks is set to 0, if the data operated by a DML statement is not in the buffer pool, TencentDB for MySQL does not check the uniqueness of secondary indexes in InnoDB tables by reading primary keys and unique keys from the disk. In this case, the primary instance successfully inserts duplicate unique keys. On the standby instance, when unique_checks is set to 0, if the data operated by a DML statement is in the buffer pool, TencentDB for MySQL checks the uniqueness of the secondary indexes operated by the DML statement. In this case, duplicate unique keys are not allowed to be inserted, resulting in replication interruption. For details, see MySQL official Bug#106121.

Problem-solving Ideas

First check the unique_checks parameter value of the instance, and then modify the parameter value based on the actual situation.
If you are certain that the inserted data will not cause unique key conflicts, you can set unique_checks to 0 to speed up data import.
If you are not sure whether the inserted data will cause unique key conflicts, set unique_checks to 1.

Operation Steps

1. Log in to the TencentDB for MySQL console. On the instance list page, click the Instance ID to go to the management page.
2. Choose Database Management > Parameter Settings and click Bulk Parameter Modification.
3. Find the unique_checks parameter and modify its runtime value.
4. If you cannot find this parameter in the instance, submit a ticket to contact the technical team for assistance.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백