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

时间:2018-04-05 13:56:46

标签: mysql pt-online-schema-change

我正在尝试更新一分钟前工作正常的表格,但现在我遇到了一个我过去遇到的非常不方便的错误。

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

是否有选项或其他内容以便我可以忽略这些警告?毕竟它只是一个警告,所以MySQL仍然能够前进并复制行。

其他解决方案也可以,就像在表格中找到有问题的价值,或者删除无效的部分,或者只是为了让我可以改变我的表格,这将是惊人的。

关于如何在MySQL中查找/替换损坏的utf8序列的我的Google搜索带给我这些链接(不太有帮助)

我甚至尝试搜索十六进制包含无效序列的所有列,但仍然以某种方式没有运气

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%';

1 个答案:

答案 0 :(得分:0)

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

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

当主键是二进制列且charset设置为utf8(mb4)或推断为MySQL设置中的一个时,似乎会发生这种情况。