MySQL Replication--Row event for unknown table错误
Posted gaogao67
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL Replication--Row event for unknown table错误相关的知识,希望对你有一定的参考价值。
错误环境:
OS: CentOS release 6.5 (Final)
mysql: MySQL 5.7.19
错误描述:
从库SQL进程异常停止(从库在此前刚因内存异常重启),报错内容为:
Last_Errno: 1782 Last_Error: Error executing row event: ‘@@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON.‘
出库执行位点:
Relay_Master_Log_File: mysql-bin.001204 Exec_Master_Log_Pos: 52454628 Executed_Gtid_Set: 6b5be2cf-b1ad-11e7-aeb2-246e965aa709:1432389-825991260
按照位点信息去主库上解析binlog
/export/servers/mysql/bin/mysqlbinlog -vvv /export/data/mysql/data/mysql-bin.001204 --start_position=52454628 |more
输出内容为:
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/; /*!50003 SET @[email protected]@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 #190518 1:05:08 server id 60863 end_log_pos 123 CRC32 0x0545d99b Start: binlog v 4, server v 5.7.19-log created 190518 1:05:08 BINLOG ‘ xOneXA+/7QAAdwAAAHsAAAAAAAQANS43LjE5LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXwAEGggAAAAICAgCAAAACgoKKioAEjQA AZvZRQU= ‘/*!*/; # at 52454628 #190518 2:56:10 server id 60863 end_log_pos 52455702 CRC32 0x24c5219e Update_rows: table id 27578 flags: STMT_END_F BINLOG ‘ ygPfXB+/7QAAMgQAABZpIAMAALprAAAAAAEAAgBX/////////////////////////////6ABAyBw D8B8ALyAPfUdAAAAAAABMQwxMDAwMDAwMTc1NTmMAOWuieWwlOmbhSBBTkVSWUEg5pel5byP5ZWG 6LaF5ZCM5qy+IOaHkuS6uuaymeWPkeixhuiii+aXoOWNsO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AB MAEwAAEwPgBqZnMvdDMwMzgyLzIzOC8yMjAzMzczNTUvMjgzMDMyLzM2MmM4NmI3LzViZWJiMjk3 TmUxYTkyNmZjLmpwZwEAMSOx2cNqAQAAA+eusQAAgAAAAAAAAIAAAAAAAACeIcUk ‘/*!*/; ### Row event for unknown table #27578# at 52455702 #190518 2:56:10 server id 60863 end_log_pos 52455733 CRC32 0xb829837d Xid = 8647697161 COMMIT/*!*/; # at 52455733 #190518 2:56:10 server id 60863 end_log_pos 52455798 CRC32 0x02c73826 GTID last_committed=21489 sequence_number=21490 -rbr_only=yes /*!50718 SET TRANSACTION ISOLATION LEVEL READ COMMITTED*//*!*/; SET @@SESSION.GTID_NEXT= ‘6b5be2cf-b1ad-11e7-aeb2-246e965aa709:825990109‘/*!*/; # at 52455798 #190518 2:56:10 server id 60863 end_log_pos 52455871 CRC32 0x1863b7ae Query thread_id=7254910 exec_time=0 error_c ode=0 SET TIMESTAMP=1558119370/*!*/; SET @@session.pseudo_thread_id=7254910/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/; SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN /*!*/; # at 52455871
通过位点解析binlog发现binlog里包含一个没有GTID的COMMIT操作,导致复制异常,原因未知。
另外一个需要注意的问题,位于该错误位点的GTID为“6b5be2cf-b1ad-11e7-aeb2-246e965aa709:825990109”,而从库执行过的GTID为“6b5be2cf-b1ad-11e7-aeb2-246e965aa709:1432389-825991260”,表明该错误位点后的很多事务825990109-825991260都已在从库上被应用,通过解析从库最后binlog也可以验证。
网上关于错误“Row event for unknown table”的资料较少,查到资料解释大意是在建立table map信息丢失导致。
参考链接:
https://bugs.mysql.com/bug.php?id=60964
https://www.jianshu.com/p/4e28f09b3ce5
解决方案:
由于未能准确定位错误原因,且无法确保数据是否存在差异(当然可以使用pt-checksum对比数据),保险起见,决定使用热备重做复制快速恢复。
以上是关于MySQL Replication--Row event for unknown table错误的主要内容,如果未能解决你的问题,请参考以下文章