版本为6.1.2,是通过DM同步到下游TiDB,在对比时候报错,手动核对上下游的表结构,两者是一致的,都是DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
。
错误日志如下所示,有几点比较奇怪:
- 提示Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation ‘>’
- 主键都是标准的字母和数字,但是程序找到的边界值都是乱码字符
[2022/11/23 14:27:58.480 +08:00] [WARN] [utils.go:764] ["execute checksum query fail"] [query="SELECT COUNT(*) as CNT, BIT_XOR(CAST(CRC32(CONCAT_WS(',', `broker`, `account3_id`, `payment_method_id`, `create_time`, `update_time`, CONCAT(ISNULL(`broker`), ISNULL(`account3_id`), ISNULL(`payment_method_id`), ISNULL(`create_time`), ISNULL(`update_time`))))AS UNSIGNED)) as CHECKSUM FROM `db`.`trade_bank_card` WHERE (((`broker` < ?) OR (`broker` = ? AND `account3_id` < ?) OR (`broker` = ? AND `account3_id` = ? AND `payment_method_id` <= ?)) AND (TRUE));"] [args="[\"\\u000e)\\u000e)\\u000e)\\u000e1\",\"\\u000e)\\u000e)\\u000e)\\u000e1\",\"\\u000e*\\u000e,\\u000e,\\u000e1\\u000e,\\u000e.\\u000e1\",\"\\u000e)\\u000e)\\u000e)\\u000e1\",\"\\u000e*\\u000e,\\u000e,\\u000e1\\u000e,\\u000e.\\u000e1\",\"\\u000e3\\u000f.\\u000f\\u0010\\u000e+\\u000f.\\u000em\\u000em\\u000e)\\u000e\\ufffd\\u000e\\ufffd\\u000e0\\u0010^\"]"] [error="Error 1267: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '<='"]
[2022/11/23 14:27:58.480 +08:00] [WARN] [utils.go:764] ["execute checksum query fail"] [query="SELECT COUNT(*) as CNT, BIT_XOR(CAST(CRC32(CONCAT_WS(',', `broker`, `account3_id`, `payment_method_id`, `create_time`, `update_time`, CONCAT(ISNULL(`broker`), ISNULL(`account3_id`), ISNULL(`payment_method_id`), ISNULL(`create_time`), ISNULL(`update_time`))))AS UNSIGNED)) as CHECKSUM FROM `db`.`trade_bank_card` WHERE (((`broker` = ?) AND ((`account3_id` > ?) OR (`account3_id` = ? AND `payment_method_id` > ?)) AND ((`account3_id` < ?) OR (`account3_id` = ? AND `payment_method_id` <= ?))) AND (TRUE));"] [args="[\"\\u000e)\\u000e)\\u000e)\\u000e1\",\"\\u000e+\\u000e+\\u000e,\\u000e1\\u000e1\\u000e+\\u000e0\",\"\\u000e+\\u000e+\\u000e,\\u000e1\\u000e1\\u000e+\\u000e0\",\"\\u000e`\\u000e0\\u000e,\\u000f\\ufffd\\u0010Q\\u0010Z\\u000e,\\u0010\\u0002\\u000e2\\u000e/\\u0010j\\u000f\\ufffd\",\"\\u000e+\\u000e-\\u000e1\\u000e)\\u000e-\\u000e*\\u000e-\",\"\\u000e+\\u000e-\\u000e1\\u000e)\\u000e-\\u000e*\\u000e-\",\"\\u000e`\\u0010\\u001f\\u000e/\\u000f\\ufffd\\u000e\\ufffd\\u000em\\u0010D\\u000e,\\u0010D\\u000f[\\u0010\\u0002\\u000e\\ufffd\"]"] [error="Error 1267: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '>'"]
[2022/11/23 14:27:58.480 +08:00] [WARN] [utils.go:764] ["execute checksum query fail"] [query="SELECT COUNT(*) as CNT, BIT_XOR(CAST(CRC32(CONCAT_WS(',', `broker`, `account3_id`, `payment_method_id`, `create_time`, `update_time`, CONCAT(ISNULL(`broker`), ISNULL(`account3_id`), ISNULL(`payment_method_id`), ISNULL(`create_time`), ISNULL(`update_time`))))AS UNSIGNED)) as CHECKSUM FROM `db`.`trade_bank_card` WHERE (((`broker` = ?) AND ((`account3_id` > ?) OR (`account3_id` = ? AND `payment_method_id` > ?)) AND ((`account3_id` < ?) OR (`account3_id` = ? AND `payment_method_id` <= ?))) AND (TRUE));"] [args="[\"\\u000e)\\u000e)\\u000e)\\u000e1\",\"\\u000e*\\u000e,\\u000e,\\u000e1\\u000e,\\u000e.\\u000e1\",\"\\u000e*\\u000e,\\u000e,\\u000e1\\u000e,\\u000e.\\u000e1\",\"\\u000e3\\u000f.\\u000f\\u0010\\u000e+\\u000f.\\u000em\\u000em\\u000e)\\u000e\\ufffd\\u000e\\ufffd\\u000e0\\u0010^\",\"\\u000e*\\u000e.\\u000e1\\u000e0\\u000e+\\u000e0\\u000e1\",\"\\u000e*\\u000e.\\u000e1\\u000e0\\u000e+\\u000e0\\u000e1\",\"\\u000eJ\\u000e-\\u000e.\\u000e\\ufffd\\u000f.\\u000e3\\u000e\\ufffd\\u000e1\\u000e3\\u000e-\\u0010\\u0002\\u000e-\"]"] [error="Error 1267: Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '>'"]
[2022/11/23 14:27:58.488 +08:00] [WARN] [utils.go:764] ["execute checksum query fail"] [query="SELECT COUNT(*) as CNT, BIT_XOR(CAST(CRC32(CONCAT_WS(',', `broker`, `account3_id`, `payment_method_id`, `create_time`, `update_time`, CONCAT(ISNULL(`broker`), ISNULL(`account3_id`), ISNULL(`payment_method_id`), ISNULL(`create_time`), ISNULL(`update_time`))))AS UNSIGNED)) as CHECKSUM FROM `db`.`trade_bank_card` WHERE (((`broker` = ?) AND ((`account3_id` > ?) OR (`account3_id` = ? AND `payment_method_id` > ?)) AND ((`account3_id` < ?) OR (`account3_id` = ? AND `payment_method_id` <= ?))) AND (TRUE));"] [args="[\"\\u000e)\\u000e)\\u000e)\\u000e1\",\"\\u000e+\\u000e+\\u000e,\\u000e1\\u000e1\\u000e+\\u000e0\",\"\\u000e+\\u000e+\\u000e,\\u000e1\\u000e1\\u000e+\\u000e0\",\"\\u000e`\\u000e0\\u000e,\\u000f\\ufffd\\u0010Q\\u0010Z\\u000e,\\u0010\\u0002\\u000e2\\u000e/\\u0010j\\u000f\\ufffd\",\"\\u000e+\\u000e-\\u000e1\\u000e)\\u000e-\\u000e*\\u000e-\",\"\\u000e+\\u000e-\\u000e1\\u000e)\\u000e-\\u000e*\\u000e-\",\"\\u000e`\\u0010\\u001f\\u000e/\\u000f\\ufffd\\u000e\\ufffd\\u000em\\u0010D\\u000e,\\u0010D\\u000f[\\u0010\\u0002\\u000e\\ufffd\"]"] [error="Error 1105: runtime error: index out of range [24] with length 24"]