Mysql error 1317导致从库复制断开
环境 :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导致从库复制断开的更多相关文章
- MySQL锁(二)表锁:为什么给小表加字段会导致整个库挂掉?
概述 表级锁是MySQL中锁定粒度最大的一种锁,表示对当前操作的整张表加锁,它实现简单,资源消耗较少,被大部分MySQL引擎支持.最常使用的MYISAM与INNODB都支持表级锁定.表级锁定分为表共享 ...
- mysql 5.7主从库复制设置
先要修改配置文件,重启mysql服务 log-bin= mysql-binlog # 打开二进制日志 ,最好放在不同的硬盘上,减小 IO 消耗 expire_logs_day= # 设置二进制日志保存 ...
- 基于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. ...
- 我的MYSQL学习心得(十七) 复制
我的MYSQL学习心得(十七) 复制 我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据 ...
- MYSQL ERROR CODE 错误编号的意义
mysql error code(备忘) 转1005:创建表失败 1006:创建数据库失败 1007:数据库已存在,创建数据库失败 1008:数据库不存在,删除数据库失败 1009:不能删除数据库文件 ...
- MySQL/MariaDB数据库的主从级联复制
MySQL/MariaDB数据库的主从级联复制 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.主从复制类型概述 1>.主从复制 博主推荐阅读: https://ww ...
- mysql传统主从、双主复制+keepalived配置步骤
mysql主从.主主复制(双主复制)配置步骤 一:MySQL复制: MySQL复制简介: 将master服务器中主数据库的ddl和dml操作通过二进制日志传到slaves服务器上,然后在master服 ...
- mysql下批量清空某个库下的所有表(库不要删除,保留空库)
总所周知,mysql下要想删除某个库下的某张表,只需要切换到该库下,执行语句"drop table tablename"即可删除!但若是该库下有成百上千张表,要是再这样一次次执行d ...
- 详解MySQL主从复制实战 - 基于GTID的复制
基于GTID的复制 简介 基于GTID的复制是MySQL 5.6后新增的复制方式. GTID (global transaction identifier) 即全局事务ID, 保证了在每个在主库上提交 ...
随机推荐
- 【MySQL】随机获取数据的方法,支持大数据量
在mysql中带了随机取数据的函数,在mysql中我们会有rand()函数,很多朋友都会直接使用,如果几百条数据肯定没事,如果几万或百万时你会发现,直接使用是错误的.下面我来介绍随机取数据一些优化方法 ...
- Android学习:代码控制UI界面示例
package allegro.test2; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; im ...
- E - Closest Common Ancestors
Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u, ...
- ubuntu 忽略文件的50unattended升级问题
ubuntu出现这样问题 既然说那个文件扩展名无效,那干脆直接把那个文件删掉 sudo rm /etc/apt/apt.conf.d/20auto-upgrades.ucf-old 删掉之后应该就不会 ...
- Java8 中的 default
之前的版本里 interface 中的方法必须是抽象方法,不能有方法体.现在可以添加 interface 内方法,只需要在方法的前面加一个 default 关键字,表示属于接口内部默认存在的方法. 如 ...
- PHP7.1安装xdebug
一.前言1. Xdebug 简介Xdebug 是一个开放源代码的 PHP 程序调试器(即一个Debug工具),可以用来跟踪,调试和分析PHP程序的运行状况.当前最新版本为 Xdebug 2.5.0. ...
- U盘出现很多.exe的文件处理方案
1.原来优盘显示隐藏系统文件后,会有MyDocument文件夹和MyDocument.exe文件两个. 2.在MyDocument文件夹下新建文件夹名为“安全区”的空文件夹. 3.在U盘的根目录下新建 ...
- Jedis连接 HelloWorld实现
建一个Maven项目, pom里加下jedis依赖, <dependency> <groupId>redis.clients</groupId> <artif ...
- PyQt5信号、定时器及多线程
信号 信号是用于界面自动变化的一个工具,原理是信号绑定了一个函数,当信号被触发时函数即被调用 举个例子 from PyQt5 import QtWidgets,QtCore from untitled ...
- python类型错误:'NoneType' object is not subscriptable
TypeError: 'NoneType' object is not subscriptable --> 原因:变量使用了系统内置的关键字list 解决:重新定义下这个变量