MySQL8.0.16使用pt-online-schema-change在线添加索引报错处理
在线MySQL8.0结构变更问题排查
| 软件 | 版本 |
|---|---|
| mysql-server | 8.0.16 |
| pt-tools | 3.2.0 |
报错明细
[root@node2 install]# pt-online-schema-change --port=3306 --host=localhost --user=root --password=xxx --alter="add index TMS_LEG_IDS (ID,CHANGE_ORG_ID,FROM_RECEIVER_ID,TO_RECEIVER_ID,TO_REGIONZONE_ID)" D=wlyotwb,t=tms_leg_test --no-version-check --execute --charset=utf8 |
https://jira.percona.com/browse/PT-1782
解决方法
- pt-tools软件版本使用
3.0.13
或者
mysql-server版本升级到8.0.20
测试环境
MySQL测试数据
alter user root@'localhost' identified WITH mysql_native_password by 'Zyadmin123'; |
pt-online-ddl
yum localinstall -y percona-toolkit-3.2.0-1.el7.x86_64.rpm |
执行结果
[root@node2 install]# pt-online-schema-change --port=3306 --host=localhost --user=root --password=Zyadmin123 --alter="add column name varchar(22)" D=booboo,t=t1 --no-version-check --execute --charset=utf8 |
总结
不同的数据库版本对应的pt工具版本会有区别,具体可以访问percona-toolkit
v3.2.0 released 2019-04-20
Improvements:
- PT-1773: Don’t make the foreign key check in
pt-online-schema-changeif not needed. - PT-1757:
pt-table-checksumcan now handle small tables as a single chunk. - PT-1813: MariaDB 10.4 is now supported.
Bug fixes:
- PT-1782:
pt-online-schema-changedeclined to handle tables because of foreign keys even when there were no foreign keys with some MariaDB 10.2 and MySQL 8 versions. - PT-1759:
pt-stalkwith--mysql-onlyoption didn’t collect MySQL Status variables. - PT-1802:
pt-online-schema-changedidn’t handle self-referencing foreign keys properly which caused an unnecessarily high resource consumption. - PT-1766:
pt-table-checksumDIFF_ROWSwas not computed correctly. - PT-1760:
pt-online-schema-changeregression caused it to hang for a stopped replica when using replication channels on the slave. - PT-1707: A number of the Percona Toolkit tools failed to operate in the IPv6 environment if the host address specified as a parameter was not enclosed in square brackets.
- PT-1502:
pt-online-schema-changewas not recognizing the slave with multi-source replication active. - PT-1824:
pt-online-schema-changeallowed the name of a constraint to exceed 64 characters when--alter-foreign-keys-method=rebuild_constraintswas used. (Thank you, Iwo Panowicz.) - PT-1765: Documentation for
DIFF_ROWSdoesn’t exist. - PT-297:
pt-online-schema-changecould break replication. - PT-1768: Source code for
src/go/pt-mongodb-query-digest/pt-mongodb-query-digestwas missing in the official source tar ball. - PT-1576:
pt-stalkwith ``–mysql-onlyoption was not adding MySQLprocesslist` information to the output file. - PT-1793:
pt-query-digestwas unable to handle the year 2020 because of wrongtcpdumpparsing. (Thank you, Kei Tsuchiya.)
v3.0.13 released 2019-01-03
Improvements
- PT-1340:
pt-stalknow doesn’t callmysqladmin debugcommand by default to avoid flooding in the error log when not needed.CMD_MYSQLADMIN="mysqladmin debug"environment variable revertspt-stalkto the previous way of operation. - PT-1637: A new
--fail-on-stopped-replicationoption allowspt-table-checksumto detect failing slave nodes.
Fixed bugs
- PT-1673:
pt-show-grantswas incompatible with MariaDB 10+ (thanks Tim Birkett) - PT-1638:
pt-online-schema-changewas erroneously taking MariaDB 10.x for MySQL 8.0 and rejecting to work with it to avoid the upstream bug #89441 scope. - PT-1616:
pt-table-checksumfailed to resume on large tables with binary strings containing invalid UTF-8 characters. - PT-1573:
pt-query-digestdidn’t work in case oflog_timestamps = SYSTEMmy.cnf option. - PT-1114:
pt-table-checksumfailed when the table was empty. - PT-157: Specifying a non-primary key index with the
ipart of the--sourceargument madept-archiverto ignore the--primary-key-onlyoption presence.