
今天有个网友问我一个MySQL的恢复问题。供给的截图如下。
当然大年夜我的角度来说,怎么去快速复现这个问题呢。我用本身写的快速搭建测试主大年夜情况的脚本(https://github.com/jeanron100/mysql_slaves,后期有一位大年夜牛建议用Python来做,比来在推敲),分分钟即可搞定。
我们创建一个表test,指定id,name两个字段。然后开启显式事务。
- create table test(id int primary key,name varchar(30) not null);
显式开启一个事务:
- begin;
- insert into test values(1,'a');
- insert into test values(2,'b');
- insert into test values(3,'c');

不提交,我们直接查看mysql的办事过程,直接Kill掉落。默认情况下双1指标是开启的,我们直接模仿断电重启,看看后台的处理情况:
- 2017-09-13 15:05:11 35556 [Note] InnoDB: Highest supported file format is Barracuda.
- 2017-09-13 15:05:11 35556 [Note] InnoDB: The log sequence numbers 1625987 and 1625987 in ibdata files do not match the log sequence number 1640654 in the ib_logfiles!
- 2017-09-13 15:05:11 35556 [Note] InnoDB: Database was not shutdown normally!
- 2017-09-13 15:05:11 35556 [Note] InnoDB: Starting crash recovery.
- 2017-09-13 15:05:11 35556 [Note] InnoDB: Reading tablespace information from the .ibd files...
- 2017-09-13 15:05:11 35556 [Note] InnoDB: Restoring possible half-written data pages
- 2017-09-13 15:05:11 35556 [Note] InnoDB: from the doublewrite buffer...
- InnoDB: 1 transaction(s) which must be rolled back or cleaned up
- InnoDB: in total 3 row operations to undo
- InnoDB: Trx id counter is
推荐阅读
在Ignite大年夜会上,微软列出了将改变科技家当的3项关键技巧,分别是混淆实际、人工智能和量子计算。微软在移动时代错掉了影响力,这是毋庸置疑的,然则它正在尽力弥补。如不雅大年夜家日常平凡比较存>>>详细阅读
本文标题:MySQL断电恢复的一点简单分析
地址:http://www.17bianji.com/lsqh/37624.html
1/2 1

网友点评
精彩导读
科技快报
品牌展示