After Using BR's PITR for Recovery, Table Insert Reports 1062 - Duplicate Entry Error

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

Original topic: 使用BR的PITR恢复后表插入数据报1062- Duplicate entry错误

| username: MagicJie

[Reproduction Path]
Using Rancher to deploy an RKE2 cluster on Huawei Cloud, with Longhorn 1.4.1 storage class. After performing PITR recovery from S3 (using BR for periodic and log backups), data queries are normal, but inserting data results in errors like:
1062 - Duplicate entry ‘540119’ for key ‘mytable.PRIMARY’.
The table ‘mytable’ has only two composite primary keys: ID (varchar22) and TENANT (int). Using the query:
SELECT id, tenant, count(0) as count
FROM mytable
GROUP BY id, tenant
HAVING count(*) > 1;
returns no results. The ‘mytable.PRIMARY’ mentioned in the error is unclear.
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

| username: tidb菜鸟一只 | Original post link

Check the data corresponding to this primary key, there should already be data.

| username: MagicJie | Original post link

It is estimated to be a bug. Restarting the cluster resolves the issue. Alternatively, using select on this table works fine. Not sure about the underlying principle.

| username: huhaifeng | Original post link

What is the version of your cluster?
Additionally, can you check if the inserted record exists by querying the primary key?
Finally, could you provide the output of the “show create table xxx” statement to see the table structure?

| username: zhanggame1 | Original post link

There are many bugs in the br, try upgrading to the latest version.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.