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

De-duplicate error code definitions #29026

Open
dveeden opened this issue Oct 21, 2021 · 4 comments · May be fixed by #58790
Open

De-duplicate error code definitions #29026

dveeden opened this issue Oct 21, 2021 · 4 comments · May be fixed by #58790
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@dveeden
Copy link
Contributor

dveeden commented Oct 21, 2021

Problem description

Error codes are now defined in both errno and parser/mysql. Sometimes with conflicting definitions.

$ git grep ErrAccessDeniedNoPassword | head -4
errno/errcode.go:	ErrAccessDeniedNoPassword                                = 1698
errno/errname.go:	ErrAccessDeniedNoPassword:                                mysql.Message("Access denied for user '%-.48s'@'%-.255s'", nil),
parser/mysql/errcode.go:	ErrAccessDeniedNoPassword                                = 1698
parser/mysql/errname.go:	ErrAccessDeniedNoPassword:                                Message("Access denied for user '%-.48s'@'%-.64s'", nil),

From parser/mysql/errcode.go ( b01eede ):

b01eedeba1 (tiancaiamao 2020-03-11 16:04:04 +0800 970)  // Stop adding error code here!
b01eedeba1 (tiancaiamao 2020-03-11 16:04:04 +0800 971)  // They are moved to github.com/pingcap/tidb/errno
@dveeden dveeden added the type/enhancement The issue or PR belongs to an enhancement. label Oct 21, 2021
@tisonkun
Copy link
Contributor

tisonkun commented Oct 21, 2021

I don't take a look at the PR but prefer to keep the one under parser/mysql.

TiDB only delivers its executable but parser can be relied on as a library (there are already some I think).

@dveeden
Copy link
Contributor Author

dveeden commented Oct 21, 2021

@tiancaiamao which one do you think needs to go?

@morgo
Copy link
Contributor

morgo commented Oct 21, 2021

This is something I noticed too :( There are also a lot of errors in the output of make errdoc. Maybe after convertying to the testsuite to testify, we can ask the community to help us standardize it?

@tiancaiamao
Copy link
Contributor

tiancaiamao commented Oct 25, 2021

@dveeden @tisonkun Many of the error code are TiDB-specific, I move the parser/mysql/errcode.go to tidb/errno because of so.

You can see the old code in parser as frozen, in case someone still referencing it.
Now that the parser is moved back to TiDB, I think it's safe to remove that duplicated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
4 participants