【问题标题】:Ignore warnings with pt-online-schema-change使用 pt-online-schema-change 忽略警告
【发布时间】:2018-09-15 09:14:54
【问题描述】:

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

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

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

其他解决方案也可以,例如在表格中找到违规值或删除无效部分的方法,或者只是让我可以更改表格的方法会很棒。

我在谷歌上搜索如何在 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%';

【问题讨论】:

    标签: mysql pt-online-schema-change


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2014-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-13
      • 2015-04-04
      • 1970-01-01
      • 2015-08-28
      • 2012-01-15
      相关资源
      最近更新 更多