使用 pt-online-schema-change 忽略警告

Ignore warnings with pt-online-schema-change

我正在尝试更新一个 table,它在一分钟前运行良好,但现在我遇到了一个我过去遇到过的错误,这非常不方便。

09:32:57 Copying rows caused a MySQL error 1300:
    Level: Warning
     Code: 1300
  Message: Invalid utf8mb4 character string: '94C494'

有什么选项可以让我忽略这些警告吗?毕竟这只是一个警告,所以 MySQL 仍然有能力继续前进并复制行。

其他解决方案也可以,比如在 table 中找到有问题的值,或者删除无效的部分,或者只是一些我可以改变我的 table 的方法是惊人的。

我在谷歌上搜索如何 ​​find/replace 在 MySQL 中破坏 utf8 序列给我带来这些链接(不是很有帮助)

我什至尝试搜索十六进制包含无效序列的所有列,但仍然没有成功

select * from `notifications` 
where hex(`Description`) like '%94C494%' 
or hex(`Title`) like '%94C494%' 
or hex(`NotificationID`) like '%94C494%' 
or hex(`ToUserID`) like '%94C494%' 
or hex(`FromUserID`) like '%94C494%'
or hex(`Link`) like '%94C494%' 
or hex(`Icon`) like '%94C494%';

MySQL 是版本 5.7.18-15-57-log 和 pt-online-schema-change 3.0.8


更奇怪的是,我决定幽默一下并搜索所有列(不仅仅是 utf8mb4 列)并且我得到了行!但是我得到的唯一行来自我的二进制列?为什么无效的 utf8 序列在二进制列中很重要?现在我认为这可能是工具的错误

select * ,hex(`notificationid`), hex(`notificationbid`), hex(`fromuserid`), hex(`touserid`), hex(`title`), hex(`description`), hex(`read`), hex(`datetimeadded`), hex(`link`), hex(`icon`), hex(`shown`), hex(`_linkdescriptionsha256`), hex(`_touseridlinkdescription+sha3-224`)
from `notifications` 
where hex(`notificationid`) like '%94C494%'
or hex(`notificationbid`) like '%94C494%'
or hex(`fromuserid`) like '%94C494%'
or hex(`touserid`) like '%94C494%'
or hex(`title`) like '%94C494%'
or hex(`description`) like '%94C494%'
or hex(`read`) like '%94C494%'
or hex(`datetimeadded`) like '%94C494%'
or hex(`link`) like '%94C494%'
or hex(`icon`) like '%94C494%'
or hex(`shown`) like '%94C494%'
or hex(`_linkdescriptionsha256`) like '%94C494%'
or hex(`_touseridlinkdescription+sha3-224`) like '%94C494%';

在与 Percona 支持人员合作解决此问题后,我们最终创建了此工单:https://jira.percona.com/browse/PT-1528

忽略排序规则问题(或解决此错误)的技巧是将 --charset binary 标志添加到 pt-online-schema-change 命令。

当主键是二进制列并且字符集设置为 utf8(mb4) 或从 MySQL 设置中推断为其中之一时,似乎会发生这种情况。