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

*: fix unexpected error when setting collate for database (#16283) #16540

Merged
merged 6 commits into from
Apr 22, 2020

Conversation

sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Apr 17, 2020

cherry-pick #16283 to release-4.0


What problem does this PR solve?

Problem Summary:
This PR tries to fix the two problems related to the charset and collate when creating a schema:

tidb> create database db5 collate ascii_bin;
ERROR 1115 (42000): Unknown character set: ''

and

tidb> create database test1 charset utf8mb4 collate utf8_general_ci;
ERROR 1115 (42000): Unknown character set: 'utf8mb4'

What is changed and how it works?

What's Changed:
Resolve charset and collation in CreateSchema() function in ddl_api.go

Some charset/collation functions are also refactored to make the logic clear enough.

How it Works:

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Integration test

Side effects

  • NA

Release note

  • Fix some unexpected errors for specifying charset/collate for CREATE SCHEMA syntax, fix missing COLLATE part for SHOW CREATE SCHEMA syntax.

Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot sre-bot requested a review from a team as a code owner April 17, 2020 10:28
@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 17, 2020

/run-all-tests

@bb7133
Copy link
Member

bb7133 commented Apr 20, 2020

/run-all-tests

@bb7133
Copy link
Member

bb7133 commented Apr 20, 2020

PTAL @Deardrops @zimulala @crazycs520

Copy link
Contributor

@Deardrops Deardrops left a comment

Choose a reason for hiding this comment

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

LGTM

@bb7133
Copy link
Member

bb7133 commented Apr 20, 2020

Failed test case:

[2020-04-20T11:10:43.301Z] Statement: #1381 -  SELECT `col_int_unsigned_key` NOT BETWEEN ( 'n' NOT IN ( ( ( COALESCE( 'sphsdfahvhbjmqjiguqqdhpryejduyzihebhanfrwvfojpiedbejnzhguahltffhxasommudcjjelrjyweufrpefinevxukyflrjvgdnopqfrwstmvnhmhcvgjfnnkbfxqcuhekgleangqjc', `col_char_255_key`, 5762637198197260288, ( 0 NOT BETWEEN 'f' AND -7138205409382236160 ), ( '2021-10-02 23:33:21.029368' <=> -10324 ) ) ) IS TRUE ), ( `col_binary_8_key` = ( `col_float_key` <= `col_bigint_key` ) ), ( `col_double_unsigned_key` <= 0 ), 'w', `col_bigint` ) ) AND ( `col_double` BETWEEN `col_varbinary_32_key` AND ( ( `col_date_key` <=> ( ISNULL( ( `col_tinyint_unsigned` NOT LIKE 7542403475938738176 ) ) ) ) <> 6315735527433699328 ) ) AS field1 FROM `table1000_int_autoinc` WHERE LEAST( '2017-09-08', ( COALESCE( ( STRCMP( 0, `col_decimal` ) ), ( STRCMP( ( `col_decimal_unsigned` <=> 2833045640592752640 ), `col_int_key` ) ) ) ) ) ORDER BY field1 LIMIT 3 /* QNO 1383 CON_ID 196 */ ;
[2020-04-20T11:10:43.301Z] NoPushDown Output: 
[2020-04-20T11:10:43.301Z] field1
[2020-04-20T11:10:43.301Z] NULL
[2020-04-20T11:10:43.301Z] NULL
[2020-04-20T11:10:43.301Z] NULL
[2020-04-20T11:10:43.301Z] 
[2020-04-20T11:10:43.301Z] 
[2020-04-20T11:10:43.301Z] WithPushDown Output: 
[2020-04-20T11:10:43.301Z] Error 1105: runtime error: index out of range [0] with length 0
[2020-04-20T11:10:43.301Z] 

https://internal.pingcap.net/idc-jenkins/blue/organizations/jenkins/tidb_ghpr_integration_copr_test/detail/tidb_ghpr_integration_copr_test/3870/pipeline

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added the status/can-merge Indicates a PR has been approved by a committer. label Apr 22, 2020
@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 22, 2020

Your auto merge job has been accepted, waiting for:

  • 16710

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 22, 2020

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 22, 2020

@sre-bot merge failed.

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added the status/LGT2 Indicates that a PR has LGTM 2. label Apr 22, 2020
@zz-jason
Copy link
Member

/merge

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 22, 2020

Your auto merge job has been accepted, waiting for:

  • 16651
  • 16699

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 22, 2020

/run-all-tests

@sre-bot
Copy link
Contributor Author

sre-bot commented Apr 22, 2020

@sre-bot merge failed.

@zz-jason zz-jason merged commit a12de62 into pingcap:release-4.0 Apr 22, 2020
@crazycs520 crazycs520 modified the milestones: v4.0.0-rc.2, v4.0.0-rc.1 Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants