环境 :Percona Server for MySQL 5.5.18

1. 报错日志:

171212 19:59:58 [ERROR] Slave SQL: Query partially completed on the master (error on master: 1317) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; . Query: 'SAVEPOINT `ZZG`', Error_code: 1317
171212 19:59:58 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000052' position 6786

2. 重现

Terminal A

mysql> begin;
Query OK, 0 rows affected (0.00 sec) mysql> insert into y select * from x limit 1;
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0 mysql> savepoint ZZG;
Query OK, 0 rows affected (0.00 sec) mysql> commit;
Query OK, 0 rows affected (0.00 sec)

Terminal B

在 Terminal A 执行到insert 的时候,执行 kill query,去模拟终止 Terminal A 的insert,此时,Terminal A 继续执行以上操作,直到commit 结束。

解析 Terminal A 的binlog

mysqlbinlog mysql-bin.000052 --base64-output=decode-rows -vv |less

得到以下结果

#171212 20:01:22 server id 1  end_log_pos 7929  Write_rows: table id 62 flags: STMT_END_F
### INSERT INTO test.y
### SET
### @1='def' /* VARSTRING(1536) meta=1536 nullable=0 is_null=0 */
### @2='information_schema' /* VARSTRING(192) meta=192 nullable=0 is_null=0 */
### @3='CHARACTER_SETS' /* VARSTRING(192) meta=192 nullable=0 is_null=0 */
### @4='SYSTEM VIEW' /* VARSTRING(192) meta=192 nullable=0 is_null=0 */
### @5='MEMORY' /* VARSTRING(192) meta=192 nullable=1 is_null=0 */
### @6=10 /* LONGINT meta=0 nullable=1 is_null=0 */
### @7='Fixed' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */
### @8=NULL /* VARSTRING(30) meta=0 nullable=1 is_null=1 */
### @9=384 /* LONGINT meta=0 nullable=1 is_null=0 */
### @10=0 /* LONGINT meta=0 nullable=1 is_null=0 */
### @11=8388480 /* LONGINT meta=0 nullable=1 is_null=0 */
### @12=0 /* LONGINT meta=0 nullable=1 is_null=0 */
### @13=0 /* LONGINT meta=0 nullable=1 is_null=0 */
### @14=NULL /* LONGINT meta=0 nullable=1 is_null=1 */
### @15=2017-12-12 18:54:45 /* DATETIME meta=0 nullable=1 is_null=0 */
### @16=NULL /* DATETIME meta=0 nullable=1 is_null=1 */
### @17=NULL /* DATETIME meta=0 nullable=1 is_null=1 */
### @18='utf8_general_ci' /* VARSTRING(96) meta=96 nullable=1 is_null=0 */
### @19=NULL /* VARSTRING(96) meta=0 nullable=1 is_null=1 */
### @20='max_rows=21845' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */
### @21='' /* VARSTRING(6144) meta=6144 nullable=0 is_null=0 */
# at 7929
#171212 20:01:38 server id 1 end_log_pos 8007 Query thread_id=3575 exec_time=0 error_code=1317
SET TIMESTAMP=1513080098/*!*/;
SAVEPOINT `ZZG`
/*!*/;
# at 8007
#171212 20:01:45 server id 1 end_log_pos 8034 Xid = 10115
COMMIT/*!*/;
DELIMITER ;
# End of log file

此 error_code=1317 在mysql Master的日志中是不体现的,但是直接导致了从库的复制断开,报错如下

171212 19:59:58 [ERROR] Slave SQL: Query partially completed on the master (error on master: 1317) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; . Query: 'SAVEPOINT `ZZG`', Error_code: 1317
171212 19:59:58 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000052' position 6786

此时主库是不影响的,主库的insert 正常提交,从库却没有接收到这个insert,如果此时,在从库上执行报错中提示的 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; 此时将会跳过此事务,继续复制主库。但是主库一旦有对此条或者多条数据的修改,从库的复制将会再次断开

Mysql error 1317导致从库复制断开的更多相关文章

  1. MySQL锁(二)表锁:为什么给小表加字段会导致整个库挂掉?

    概述 表级锁是MySQL中锁定粒度最大的一种锁,表示对当前操作的整张表加锁,它实现简单,资源消耗较少,被大部分MySQL引擎支持.最常使用的MYISAM与INNODB都支持表级锁定.表级锁定分为表共享 ...

  2. mysql 5.7主从库复制设置

    先要修改配置文件,重启mysql服务 log-bin= mysql-binlog # 打开二进制日志 ,最好放在不同的硬盘上,减小 IO 消耗 expire_logs_day= # 设置二进制日志保存 ...

  3. 基于mysql创建库的报错解决小记mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database

    mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database异常处理 1.找到find / -name my. ...

  4. 我的MYSQL学习心得(十七) 复制

    我的MYSQL学习心得(十七) 复制 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据 ...

  5. MYSQL ERROR CODE 错误编号的意义

    mysql error code(备忘) 转1005:创建表失败 1006:创建数据库失败 1007:数据库已存在,创建数据库失败 1008:数据库不存在,删除数据库失败 1009:不能删除数据库文件 ...

  6. MySQL/MariaDB数据库的主从级联复制

      MySQL/MariaDB数据库的主从级联复制 作者:尹正杰  版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.主从复制类型概述 1>.主从复制 博主推荐阅读: https://ww ...

  7. mysql传统主从、双主复制+keepalived配置步骤

    mysql主从.主主复制(双主复制)配置步骤 一:MySQL复制: MySQL复制简介: 将master服务器中主数据库的ddl和dml操作通过二进制日志传到slaves服务器上,然后在master服 ...

  8. mysql下批量清空某个库下的所有表(库不要删除,保留空库)

    总所周知,mysql下要想删除某个库下的某张表,只需要切换到该库下,执行语句"drop table tablename"即可删除!但若是该库下有成百上千张表,要是再这样一次次执行d ...

  9. 详解MySQL主从复制实战 - 基于GTID的复制

    基于GTID的复制 简介 基于GTID的复制是MySQL 5.6后新增的复制方式. GTID (global transaction identifier) 即全局事务ID, 保证了在每个在主库上提交 ...

随机推荐

  1. LeetCode - 766. Toeplitz Matrix

    A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given ...

  2. HTML使用CSS样式的方法

      在html网页中引入css样式表主要有一下四种方法 1.行内引入 <p ></p> 2.嵌入式 <style type="text/css"> ...

  3. [工具] Altova UModel® 2017 is a UML tool for software modeling & application development.

    https://cdn.sw.altova.com/v2017sp2a/en/MissionKitEnt2017sp2.exe https://cdn.sw.altova.com/v2017sp2a/ ...

  4. Solve Docker for Windows error: docker detected, A firewall is blocking file Sharing between Windows and the containers

    被这个“分享硬盘”问题烦了我好几个小时,终于在一个叫Marco Mansi外国人博客上找到解决方法了,真的很无奈 https://blog.olandese.nl/2017/05/03/solve-d ...

  5. mybits根据表自动生成 java类和mapper 文件

    mybits根据表自动生成 java类和mapper 文件 我这个脑子啊,每次创建新的工程都会忘记是怎么集成mybits怎么生成mapper文件的,so today , I can't write t ...

  6. react纯手写全选与取消全选

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. ie9 remove出错 jquery SCRIPT5007: 缺少对象

    针对IE11 remove不起作用的问题. 其中IE11.0.37也不支持 IE11.0.42支持可能是由于客户机器设置了兼容模式的原因. 因为里面包含了object元素,移除数据的时候发生的bug. ...

  8. openlayers研究

    openlayers研究 待定........ 在 url encode 中 + 和 %20 都表示空格, encode(+)会变成空格 如果要传 + 这个字符需要转义 1. +  URL 中+号表示 ...

  9. PAT1111 Online Map【最短路】【dfs】

    题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805358663417856 题意: 给定一个图,每天边上有时间和路 ...

  10. mysql学习【第6篇】:权限和数据库设计

    狂神声明 : 文章均为自己的学习笔记 , 转载一定注明出处 ; 编辑不易 , 防君子不防小人~共勉 ! mysql学习[第6篇]:权限和数据库设计 用户和权限管理 /* 用户和权限管理 */ ---- ...