环境 :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. k8s(6)-滚动更新

    用户希望应用程序始终可用,开发人员应该每天多次部署新版本的应用程序.在Kubernetes中,这是通过滚动更新完成的.滚动更新允许通过使用新的实例逐步更新Pods实例来实现部署的更新,从而实现零停机. ...

  2. mysql存储过程异常处理

    DELIMITER $$ USE `mtnoh_aaa_platform`$$ DROP PROCEDURE IF EXISTS `proc_eoms_electric_power_generatio ...

  3. C++对windows控制面板的操作

    经常碰到程序无法卸载, 就老是骂微软搞的什么安装方式,安装好了不能卸载. 后来就打算研究一下windows是如何卸载程序的,一个程序安装完后留下了什么信息用于后面的卸载. 研究对象win7 64位, ...

  4. A - Black Box 优先队列

    来源poj1442 Our Black Box represents a primitive database. It can save an integer array and has a spec ...

  5. Educational Codeforces Round 2

    600A - Extract Numbers    20171106 字符串处理题,稍微注意点细节就能水过 #include<stdlib.h> #include<stdio.h&g ...

  6. js获取当前日期方法(YYYY-MM-DD格式)

      var myDate = new Date(); var time = myDate.toLocaleDateString().split('/').join('-');将1970/08/08转化 ...

  7. 26、jQuery

    一. jQuery简介 (一) jQuery是什么: 是一个javascript代码仓库 是一个快速的简洁的javascript框架,可以简化查询DOM对象.处理事件.制作动画.处理Ajax交互过程. ...

  8. 通过ALT+F9关键CALL追踪注册码

    1)弹出关键字对话框,记录关键字注册失败,请检查···· 2)使用PEID查壳 3)peid提示无壳 4)发送到OD 5)F9使od运行 5.1)继续输入用户 5.2)使其暂停 5.3)点击调试中的执 ...

  9. linux命令: 两个查找工具 locate,find

    linux 中有很多查找工具,今天主要讲解locate,find两个工具. 1.locate (1)查询系统上预建的文件索引数据库 /var/lib/mlocate/mlocate.db 注意:如果这 ...

  10. python扫描端口脚本

    # -*- coding:utf8 -*- # # Python: 2.7.8 # Platform: Windows # Authro: wucl # Program: 端口扫描 # History ...