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

Projects
None yet
8 participants
@crazycs520
Copy link
Contributor

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 added some commits Jan 17, 2019

@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

This comment has been minimized.

Copy link
Contributor Author

commented Jan 17, 2019

/run-all-tests

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

commented Jan 17, 2019

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

commented Jan 18, 2019

/run-all-tests

@codecov-io

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Contributor

commented Jan 18, 2019

LGTM

@@ -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")

This comment has been minimized.

Copy link
@lonng

lonng Jan 18, 2019

Member

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

This comment has been minimized.

Copy link
@ngaut

ngaut Jan 20, 2019

Member

Right, we should create a better error message.

This comment has been minimized.

Copy link
@crazycs520

crazycs520 Jan 20, 2019

Author Contributor

done. PTAL

@winkyao
Copy link
Member

left a comment

LGTM

@ciscoxll
Copy link
Contributor

left a comment

LGTM

Please fix error message.

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

commented Jan 20, 2019

/run-all-tests

@ngaut

ngaut approved these changes Jan 20, 2019

Copy link
Member

left a comment

LGTM

@ngaut ngaut merged commit 818ec91 into pingcap:master Jan 20, 2019

13 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/common-test job succeeded
Details
idc-jenkins-ci-tidb/integration-common-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-compatibility-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/mybatis-test job succeeded
Details
idc-jenkins-ci-tidb/sqllogic-test-1 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/sqllogic-test-2 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

crazycs520 added a commit to crazycs520/tidb that referenced this pull request Feb 21, 2019

winkyao added a commit that referenced this pull request Feb 21, 2019

crazycs520 added a commit to crazycs520/tidb that referenced this pull request Feb 26, 2019

zimulala added a commit that referenced this pull request Feb 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.