当前位置:网站首页>stop slave卡住--事务的事件没有复制完整
stop slave卡住--事务的事件没有复制完整
2022-07-02 22:07:00 【翔云123456】
在文章stop slave卡住,初步介绍了stop slave的问题现象以及一些原因。
以及文章stop slave 卡住模拟–大事务场景中,介绍了大事务场景中,stop slave的模拟。
本文介绍另外一种情况:一个事务的事件没有完整复制到从库。
主从架构中,在主库上更新数据后,会写入binlog,并复制到从库。
在事务型存储引擎中,如innoDB,数据更新以事务为单位。
一个事务通常有很多event组成,例如begin, commit,query, write_rows等等。
在主库上提交一个事务,事件写入binlog,再复制到从库,从库接着开始回放binlog。从库回放binlog,并不是一个事务的所有event都复制过来以后,才开始回放的,而是一边I/O线程接收binlog日志,一边SQL 线程应用binlog日志。
这样,就可能存在一个问题,如果一个事务的event比较多,只将一部分event复制到从库,此时主库故障 或 网络断开,从库上一直无法接收剩余的event,导致SQL线程一直在等待剩余event。
在这个时候,在从库上执行stop slave,SQL 线程会等待,直到超过等待时间(默认60s),然后回滚事务。
基本的排查思路:
- 查看大事务正在执行的event(预先有大事务监控,可以采集正在执行的event)。
- 查看从库的错误日志,确定当时从库正在复制的主库的日志位点。使用这个日志位点,在老主库的binlog中查找对应的事件。
- 分析原因:
- 如果正在执行的是begin事件,且从库复制位点对应的事件不是commit,则可以得出,导致stop slave 超时的原因是事务的事件没有接收完整。
- 正在执行的SQL是 正常更新SQL,则导致stop slave超时原因可能是事务比较大,实际执行很耗时,也可能是事件没有接收完整(因为无法确定正在执行的事务与正在复制的事务是否同一个)。
边栏推荐
- Build your own website (22)
- Market Research - current situation and future development trend of herringbone gear Market
- Oracle PL / SQL programming
- 《乔布斯传》英文原著重点词汇笔记(十一)【 chapter nine】
- Oracle-PL/SQL编程
- Commodity information management system (C language document version)
- Radis:Linux上安装Redis(步骤)
- [QT] QT multithreading development - reentrancy and thread safety
- NC24325 [USACO 2012 Mar S]Flowerpot
- 杰理之充电拔出,无法触摸开机【篇】
猜你喜欢

位的高阶运算

Mathematical modeling -- graph and network models and methods (I)
![[LeetCode] 反转字符串中的单词 III【557】](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[LeetCode] 反转字符串中的单词 III【557】

地方经销商玩转社区团购模式,百万运营分享

#include errors detected. Please update your includePath.
![NC24325 [USACO 2012 Mar S]Flowerpot](/img/cf/86acbcb524b3af0999ce887c877781.png)
NC24325 [USACO 2012 Mar S]Flowerpot

Simpleitk use - 4 Strange question

Dahua cloud native load balancing article - the passenger flow of small restaurants has increased

Utilisation de simpletk - 4. Question étrange

Dynamic memory allocation (malloc calloc realloc free)
随机推荐
NC24325 [USACO 2012 Mar S]Flowerpot
Source code analysis - lightweight asynchronous crawler framework Ruia
Market Research - current market situation and future development trend of handheld wound imaging equipment
分享 10 个 JS 闭包面试题(图解),进来看看你能答对多少
Market Research - current situation and future development trend of anterior cruciate ligament (ACL) reconstruction Market
Market Research - current situation and future development trend of environmental friendly fireworks Market
Market Research - current situation and future development trend of marine clutch Market
Struct, bit segment, enumeration, union
牛客网:龙与地下城游戏
PHP微信抢红包的算法
开发者分享 | HLS, 巧用AXI_master总线接口指令的定制并提升数据带宽-面积换速度...
Notes on key vocabulary in the English original of the biography of jobs (11) [chapter nine]
Phpcms realizes the direct Alipay payment function of orders
E-commerce system microservice architecture
UE4 UI adaptive screen
Pointer - function pointer
Baidu AI Cloud - create a face recognition application
PMP项目整合管理
附加:【登录信息存储】与【登录状态校验】;(包括:总结了到目前为止,有关【登录信息存储】与【登录状态校验】的所有内容;)
全面解析分享购商业模式逻辑?分享购是如何赋能企业