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

table: format table error code and error message #13233

Merged
merged 9 commits into from
Dec 3, 2019

Conversation

imtbkcat
Copy link

@imtbkcat imtbkcat commented Nov 7, 2019

What problem does this PR solve?

Not all the errors in table package have error code.

What is changed and how it works?

Add error code for these errors and format these error messages.

Check List

Tests

  • Unit test

Code changes

  • Has exported variable/fields change

Side effects

Related changes

  • Need to cherry-pick to the release branch

Release note

@imtbkcat imtbkcat added the type/enhancement The issue or PR belongs to an enhancement. label Nov 7, 2019
@imtbkcat imtbkcat requested review from lysu and jackysp November 7, 2019 03:38
@codecov
Copy link

codecov bot commented Nov 7, 2019

Codecov Report

Merging #13233 into master will decrease coverage by 0.257%.
The diff coverage is 95.8333%.

@@               Coverage Diff                @@
##             master     #13233        +/-   ##
================================================
- Coverage   80.4067%   80.1497%   -0.2571%     
================================================
  Files           475        475                
  Lines        118893     117671      -1222     
================================================
- Hits          95598      94313      -1285     
- Misses        15843      15894        +51     
- Partials       7452       7464        +12

table/table.go Outdated
// ErrTruncateWrongValue returns for truncate wrong value for field.
ErrTruncateWrongValue = terror.ClassTable.New(codeTruncateWrongValue, "incorrect value")
ErrTruncateWrongValue = terror.ClassTable.New(mysql.ErrTruncatedWrongValueForField, mysql.MySQLErrName[mysql.ErrTruncatedWrongValueForField])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicated with ErrTruncatedWrongValueForField~? and maybe need to change the caller too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

errDuplicateColumn = terror.ClassTable.New(codeDuplicateColumn, "duplicate column")
ErrColumnCantNull = terror.ClassTable.New(mysql.ErrBadNull, mysql.MySQLErrName[mysql.ErrBadNull])
errUnknownColumn = terror.ClassTable.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField])
errDuplicateColumn = terror.ClassTable.New(mysql.ErrFieldSpecifiedTwice, mysql.MySQLErrName[mysql.ErrFieldSpecifiedTwice])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe need change the caller of errUnknownColumn, errDuplicateColumn due to "%" changed in message?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But share same error code may be confused.

@imtbkcat imtbkcat force-pushed the tableErrorCode branch 2 times, most recently from ee286f3 to 98f6bdf Compare November 7, 2019 09:58
@imtbkcat imtbkcat changed the title table: format table error code and errir message table: format table error code and error message Nov 18, 2019
@imtbkcat
Copy link
Author

/run-all-tests tidb-test=pr/932

@imtbkcat
Copy link
Author

imtbkcat commented Dec 3, 2019

PTAL @lysu @jackysp

lysu
lysu previously approved these changes Dec 3, 2019
Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@imtbkcat
Copy link
Author

imtbkcat commented Dec 3, 2019

/run-all-tests

@imtbkcat
Copy link
Author

imtbkcat commented Dec 3, 2019

/run-all-tests -tidb-test=pr/962

@imtbkcat
Copy link
Author

imtbkcat commented Dec 3, 2019

/run-unit-test

@jackysp jackysp added the status/can-merge Indicates a PR has been approved by a committer. label Dec 3, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 3, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Dec 3, 2019

@imtbkcat merge failed.

@jackysp
Copy link
Member

jackysp commented Dec 3, 2019

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Dec 3, 2019

Your auto merge job has been accepted, waiting for 13124

@sre-bot
Copy link
Contributor

sre-bot commented Dec 3, 2019

/run-all-tests

@sre-bot sre-bot merged commit dcbb5a1 into pingcap:master Dec 3, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 3, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Dec 3, 2019

cherry pick to release-3.0 failed

XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2020

It seems that, not for sure, we failed to cherry-pick this commit to release-2.1 release-3.0. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @imtbkcat PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants