Bug Report
Please answer these questions before submitting your issue. Thanks!
- What did you do?
If possible, provide a recipe for reproducing the error.
When upstream runs the ADD PRIMARY KEY DDL, and if for some reason it needs to be retried, this currently will cause Drainer to quit due to the unhandled error "Error 1068: Multiple primary key defined".
- What did you expect to see?
The error should not crash Drainer, similar to retrying other ADD KEY DDL which its "Error 1061: Duplicate key name `%s`" (ErrDupKeyName) is considered expected and simply ignored.
The error code 1068 (ErrMultiplePriKey) should be added to the IgnoreDDLError function.
|
case infoschema.ErrDatabaseExists.Code(), infoschema.ErrDatabaseNotExists.Code(), infoschema.ErrDatabaseDropExists.Code(), |
|
infoschema.ErrTableExists.Code(), infoschema.ErrTableNotExists.Code(), infoschema.ErrTableDropExists.Code(), |
|
infoschema.ErrColumnExists.Code(), infoschema.ErrColumnNotExists.Code(), infoschema.ErrIndexExists.Code(), |
|
infoschema.ErrKeyNotExists.Code(), dbterror.ErrCantDropFieldOrKey.Code(), tmysql.ErrDupKeyName: |
- What did you see instead?
N/A
- Please provide the relate downstream type and version of drainer.
(run drainer -V in terminal to get drainer's version)
Originally v5.1.4, but also reproducible up to the latest master.
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
When upstream runs the
ADD PRIMARY KEYDDL, and if for some reason it needs to be retried, this currently will cause Drainer to quit due to the unhandled error "Error 1068: Multiple primary key defined".The error should not crash Drainer, similar to retrying other
ADD KEYDDL which its "Error 1061: Duplicate key name `%s`" (ErrDupKeyName) is considered expected and simply ignored.The error code 1068 (
ErrMultiplePriKey) should be added to theIgnoreDDLErrorfunction.tidb-binlog/pkg/sql/sql.go
Lines 156 to 159 in 981fc1d
N/A
(run
drainer -Vin terminal to get drainer's version)Originally v5.1.4, but also reproducible up to the latest master.