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 the issue where the CHARSET cannot be retrieved in OceanBase. #881

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

davidzhangbj
Copy link

@davidzhangbj davidzhangbj commented Nov 5, 2024

  • The contributed code is licensed under GPL v2.0
  • Contributor Licence Agreement (CLA) is signed
  • util/update-modules has been ran
  • Documentation updated
  • Test suite update

An error occurred while I was using pt-archiver to migrate data from MySQL to OceanBase: "Character set mismatch: --dest DSN uses utf8mb4, table uses . ". It seems that pt-archiver did not correctly detect the character set of the destination database.
I noticed that the format of DDL statements in OceanBase differs slightly from that in MySQL. In MySQL, the output of the SHOW CREATE TABLE command shows the character set without spaces around the equals sign (e.g., CHARSET=utf8mb4). In contrast, OceanBase shows the character set with spaces around the equals sign (e.g., CHARSET = utf8mb4).
To resolve this issue, I modified the regular expression used for matching the character set, and the migration was successful.

mysql DDL statement

mysql> show create table t3;
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t3 | CREATE TABLE t3 (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(20) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

OceanBase DDL statement

obclient [sun_test]> show create table t3;
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t3 | CREATE TABLE t3 (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(20) DEFAULT NULL,
PRIMARY KEY (id)
) AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.005 sec)

@it-percona-cla
Copy link

it-percona-cla commented Nov 5, 2024

CLA assistant check
All committers have signed the CLA.

@davidzhangbj davidzhangbj changed the title Fix the issue of not being able to retrieve the CHARSET in the OceanB… Fix the issue where the CHARSET cannot be retrieved in OceanBase. Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants