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

admin: fix admin check table err when add column not null, then add index on the column #9108

Merged
merged 7 commits into from
Jan 20, 2019

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Jan 17, 2019

What problem does this PR solve?

admin check table return error by mistake.

drop table if exists t1;
create table t1 (a int);
insert into t1 set a=2;
alter table t1 add column b timestamp not null;
alter table t1 add index(b);
admin check table t1;

What is changed and how it works?

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

  • Need to cherry-pick to the release branch

@crazycs520 crazycs520 changed the title admin: fix admin check table err when add column not null, then add i… admin: fix admin check table err when add column not null, then add index on the column Jan 17, 2019
@crazycs520 crazycs520 added the type/bugfix This PR fixes a bug. label Jan 17, 2019
@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

@winkyao @zimulala @ciscoxll PTAL

@crazycs520
Copy link
Contributor Author

/run-all-tests

@codecov-io
Copy link

codecov-io commented Jan 18, 2019

Codecov Report

Merging #9108 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9108      +/-   ##
==========================================
+ Coverage   67.16%   67.16%   +<.01%     
==========================================
  Files         372      372              
  Lines       77016    77016              
==========================================
+ Hits        51724    51728       +4     
+ Misses      20664    20661       -3     
+ Partials     4628     4627       -1
Impacted Files Coverage Δ
util/admin/admin.go 67.32% <0%> (ø) ⬆️
executor/join.go 77.86% <0%> (-1.05%) ⬇️
store/tikv/lock_resolver.go 41.7% <0%> (-0.95%) ⬇️
expression/schema.go 94.11% <0%> (-0.85%) ⬇️
ddl/delete_range.go 77.77% <0%> (+4.23%) ⬆️
ddl/session_pool.go 93.1% <0%> (+10.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9b6adb...070960e. Read the comment docs.

@xiekeyi98
Copy link
Contributor

LGTM

@xiekeyi98 xiekeyi98 added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 18, 2019
@@ -440,7 +440,7 @@ func CheckRecordAndIndex(sessCtx sessionctx.Context, txn kv.Transaction, t table
for i, val := range vals1 {
col := cols[i]
if val.IsNull() {
if mysql.HasNotNullFlag(col.Flag) {
if mysql.HasNotNullFlag(col.Flag) && col.ToInfo().OriginDefaultValue == nil {
return false, errors.New("Miss")
Copy link
Contributor

@lonng lonng Jan 18, 2019

Choose a reason for hiding this comment

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

It is better to add more detail error information and make diagnose easier. errors.New("Miss") maybe not a good idea.

Copy link
Member

Choose a reason for hiding this comment

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

Right, we should create a better error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. PTAL

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ciscoxll ciscoxll left a comment

Choose a reason for hiding this comment

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

LGTM

ciscoxll
ciscoxll previously approved these changes Jan 18, 2019
@ngaut ngaut dismissed ciscoxll’s stale review January 20, 2019 01:52

Please fix error message.

@crazycs520
Copy link
Contributor Author

/run-all-tests

Copy link
Member

@ngaut ngaut left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants