Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;?
我的主从配置一样,主的binlog是mixed,从的binlog也是mixed。在网上看了许多同类的问题,都是先stop slave,然后从新change  master到报错位置。然后start slave,下面是我的经历过程。-- ===============================================
Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869528465stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869528465;
start slave;
show slave status;-- ================================
Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869528770stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869528770;
start slave;
show slave status;-- ======================
Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869529075
stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869529075;
start slave;
show slave status\G;-- =======================
Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869529380
stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869529380;
start slave;
show slave status\G;-- ==================
Last_SQL_Error: Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869529685stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869529685;
start slave;
show slave status\G;-- =============================
Last_SQL_Error: Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869529990
stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869529990;
start slave;
show slave status\G;-- =============================
Last_SQL_Error: Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869530295stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869530295;
start slave;
show slave status\G;-- ============================
Last_SQL_Error: Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.000521, end_log_pos 869530600stop slave ;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000521', MASTER_LOG_POS=869530600;
start slave;
show slave status\G;然后每次重新change master之后,继续报错10032,我郁闷了,不能人工这么每次change,也不知道需要change多少次,才能双yes,不报100032错误呢。
我不想暴力手段解决啊:在my.cnf里面,设置slave-skip-errors=1032  然后从新启动mysql数据库

大家对复制熟悉的,多提供一点意见吧!在今天下班之前,如果还没有搞定,只有最后用暴力手段了。

解决方案 »

  1.   


    版本都是一样的,都是5.1.53-log
      

  2.   


    一个业务表,在执行存储过程之前,会被truncate的,我们的存储过程的都是串行执行的。
      

  3.   

    Can't find record in 'tmp_excel_data'
    应该是主从上这个表的数据不一致所致
      

  4.   

    应该是主从上这个表的数据不一致所致---------必须使主从数据一致,方法有2:
    1 锁住主上的表,重新导入到从。
    2 你需要表对比同步工具软件。myisam表么?多大?
      

  5.   


    myisam表,也就9W条记录而已!主是生产库,业务上不允许锁表。
      

  6.   

    Could not execute Update_rows event on table csf.tmp_excel_data; Can't find record in 'tmp_excel_data'这个提示来看,你用了临时表?
      

  7.   


    csf.tmp_excel_data 这个表是实体表,起这个名字的缘故只是因为第一笔业务处理完了,就清空这个表,然后继续导入新的第二笔业务数据,继续处理,是串行进行的。没有并发。
      

  8.   

    Can't find record in 'tmp_excel_data'估计在复制环境下,主库的这个表有数据,从库没有数据。然后某个SQL语句必须从这个表取记录才能继续往下走。
      

  9.   


    这个情况我知道,可是为什么发生这种情况呢,我的主库上面都是串行执行的,没有并发的情况的。主库上面的binlog也是串行记载dml的sql。为什么还会出现这种情况呢?
      

  10.   


    没有,从库没有跑任何应用,没有给别的ip开过账号,只有本机的root账号。账号密码只有我一个人知道。
      

  11.   

    找找你的业务逻辑,在tmp_excel_data表取数据的代码和清除tmp_excel_data表数据的代码之间,可能不是串行的了。