pt-online-schema-change 失败

问题描述

我有一台全新安装(测试)数据库机器,运行 Centos8percona-serverMysqL8。

这是我第一次对 MysqL8 使用 percona-toolkit。没有任何工作。 旧的 pt-online-schema-change 调用 5.7 不再起作用。即使是简单的事情也会失败:

pt-online-schema-change --alter-foreign-keys-method=auto --dry-run --print --alter "ADD column marketplace22 varchar(25)"  D=app_production,t=sales_ranks

结果:

(in cleanup) Error altering new table `app_production`.`_sales_ranks_new`: DBD::MysqL::db do Failed: You have an error in your sql Syntax; check the manual that corresponds to your MysqL server version for the right Syntax to use near ' ' at line 1 [for Statement "ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) "] at /usr/bin/pt-online-schema-change line 9512.

如果我在 MysqL 提示中执行代码,它会起作用……所以这与配置有关,但实际上它应该是自动的。

全员通话

[root@centos-db-test ~]# pt-online-schema-change  --user=root --ask-pass --alter-foreign-keys-method=auto --execute --print --alter "add column marketplace22 varchar(25)"  D=app_production,t=sales_ranks
perl: warning: Setting locale Failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),LC_ALL = (unset),LC_CTYPE = "UTF-8",LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Enter MysqL password: 
No slaves found.  See --recursion-method if host centos-db-test has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation,tries,wait:
  analyze_table,10,1
  copy_rows,0.25
  create_triggers,1
  drop_triggers,1
  swap_tables,1
  update_foreign_keys,1
Child tables:
  `app_production`.`sales_rank_data_points` (approx. 1 rows)
Will automatically choose the method to update foreign keys.
Altering `app_production`.`sales_ranks`...
Creating new table...
CREATE TABLE `app_production`.`_sales_ranks_new` (
  `id` int NOT NULL AUTO_INCREMENT,`product_category` varchar(255) CHaraCTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,`rank` int DEFAULT NULL,`item_id` int DEFAULT NULL,`tenant_id` int DEFAULT NULL,`created_at` datetime DEFAULT NULL,`updated_at` datetime DEFAULT NULL,`marketplace` varchar(255) CHaraCTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,`marketplace22` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,PRIMARY KEY (`id`),KEY `index_sales_ranks_on_item_id` (`item_id`) USING BTREE,KEY `index_sales_ranks_on_tenant_id` (`tenant_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8203494 DEFAULT CHARSET=utf8mb3 COLLATE=utf8_unicode_ci ROW_FORMAT=COMpressed
Created new table app_production._sales_ranks_new OK.
Altering new table...
ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) 
2021-07-29T07:20:00 Dropping new table...
DROP TABLE IF EXISTS `app_production`.`_sales_ranks_new`;
2021-07-29T07:20:00 Dropped new table OK.
`app_production`.`sales_ranks` was not altered.
    (in cleanup) Error altering new table `app_production`.`_sales_ranks_new`: DBD::MysqL::db do Failed: You have an error in your sql Syntax; check the manual that corresponds to your MysqL server version for the right Syntax to use near ' ' at line 1 [for Statement "ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) "] at /usr/bin/pt-online-schema-change line 9512.

Error altering new table `app_production`.`_sales_ranks_new`: DBD::MysqL::db do Failed: You have an error in your sql Syntax; check the manual that corresponds to your MysqL server version for the right Syntax to use near ' ' at line 1 [for Statement "ALTER TABLE `app_production`.`_sales_ranks_new` add column marketplace22 varchar(25) "] at /usr/bin/pt-online-schema-change line 9512.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)