Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support retrying ADD PRIMARY KEY #1312

Open
kennytm opened this issue Aug 9, 2024 · 0 comments
Open

Support retrying ADD PRIMARY KEY #1312

kennytm opened this issue Aug 9, 2024 · 0 comments

Comments

@kennytm
Copy link
Contributor

kennytm commented Aug 9, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. 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".

  1. 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.

tidb-binlog/pkg/sql/sql.go

Lines 156 to 159 in 981fc1d

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:

  1. What did you see instead?

N/A

  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants