当前位置: 首页 > news >正文

[译]MySQL 5.7 Reference Manual::The InnoDB Recovery Process

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

15.18.1 The InnoDB Recovery Process(InnoDB宕机恢复执行)

InnoDB crash recovery consists of several steps:(宕机恢复的几个步骤)

  • Applying the redo log: Redo log application is the first step and is performed during initialization, before accepting any connections. If all changes were flushed from the buffer pool to the tablespaces (ibdata* and *.ibd files) at the time of the shutdown or crash, the redo log application can be skipped. If the redo log files are missing at startup, InnoDB skips the redo log application.

  • 翻译:应用redo log:应用Redo Log是恢复过程的第一步,并且整个过程在mysql初始化中,接口连接请求之前。如果在shutdown或者崩溃之前所有缓存数据都已经从BufferPool中刷到了表空间(磁盘)则这一步骤直接被跳过。并且如果redo log的文件在启动的时候找不到,那么应用redo log 这一步也会被跳过。

  • Removing redo logs to speed up the recovery process is not recommended, even if some data loss is acceptable. Removing redo logs should only be considered an option after a clean shutdown is performed, with innodb_fast_shutdown set to 0 or1.

  • 翻译:即便在某丢失某些数据是可以被接收的情况下,删除redo logs 得以加快mysql恢复速度都是不推荐的操作。删除redo logs的操作应该仅仅在mysql执行过完整的shutdown情况下,完成的shutdown可以通过设置innodb_fast_shutdown为0或者1(设置这两个的情况下,mysql在shutdown的时候会把所有的脏page刷到磁盘,而设置成2就不会刷到磁盘,但是mysql会在启动的时候根据redo log 进行修复)

  • Rolling back incomplete transactions: Any transactions that were active at the time of crash or fast shutdown. The time it takes to roll back an incomplete transaction can be three or four times the amount of time a transaction is active before it is interrupted, depending on server load.

  • 翻译:回滚一个不完整的事务:在崩溃或者fastshutdown时候的活跃事务。回滚一个不完整的事务所花时间大概在活跃事务存在的3倍或4倍,这取决于服务的负载

  • You cannot cancel transactions that are in the process of being rolled back. In extreme cases, when rolling back transactions is expected to take an exceptionally long time, it may be faster to start InnoDB with an innodb_force_recovery setting of 3or greater. See Section 15.21.2, “Forcing InnoDB Recovery” for more information.

  • 翻译:你不能取消一个正在回滚的事务。一个极端的例子,当一个事务的回滚预期知道需要很长的时间,如果想快点启动Innodb的话,你可以设置innodb_force_recovery 为3或者更大(一般用在你其实知道怎么恢复数据的情况下,比如你只是修改了一个大表的字段,那么你可以先在启动的时候忽略Mysql的自动恢复,然后启动后人为恢复),详细请看Section 15.21.2, “Forcing InnoDB Recovery”

  • Change buffer merge: Applying changes from the change buffer (part of the system tablespace) to leaf pages of secondary indexes, as the index pages are read to the buffer pool.

  • 翻译:改变缓存合并:辅助索引改变的缓存(这里指的是Insert Buffer)应用合并到辅助缓存索引上,并读到缓冲池

  • Purge: Deleting delete-marked records that are no longer visible for any active transaction.

  • 翻译:删除被打上"删除标记"的记录,这些记录将不再被任何活跃的事务访问

The steps that follow redo log application do not depend on the redo log (other than for logging the writes) and are performed in parallel with normal processing. Of these, only rollback of incomplete transactions is special to crash recovery. The insert buffer merge and the purge are performed during normal processing.

翻译:这些应用Redo log的步骤不依赖Redo log与其他步骤可以同时并行操作(除了redo log的写入,而且仅仅在恢复过程中是串行的)。像Insert Buffer Merge 和 purge 都是可以并行的。

After redo log application, InnoDB attempts to accept connections as early as possible, to reduce downtime. As part of crash recovery, InnoDB rolls back any transactions that were not committed or in XA PREPARE state when the server crashed. The rollback is performed by a background thread, executed in parallel with transactions from new connections. Until the rollback operation is completed, new connections may encounter locking conflicts with recovered transactions.

翻译:在应用redo log恢复后,InnoDB试图尽可能快的接受请求链接,减少宕机时间。作为恢复操作中的一部分,InnoDB回滚宕机前任何没提交或者在XA 状态的事务。这种回滚的操作被后台的线程执行,并且与新请求链接的操作同时处理。那么在回滚操作完成之前,新连接请求可能会遇到恢复事务中的锁。

In most situations, even if the MySQL server was killed unexpectedly in the middle of heavy activity, the recovery process happens automatically and no action is needed from the DBA. If a hardware failure or severe system error corrupted InnoDB data, MySQL might refuse to start. In that case, see Section 15.21.2, “Forcing InnoDB Recovery” for the steps to troubleshoot such an issue.

翻译:在大多数情况下,甚至是在mysql服务在超负荷的活动下被意外的killed,mysql的恢复过程是自动的并且不需要DBA做任何操作。但如果是硬件错误或者InnoDB data发生严重的系统错误,那么Mysql可能会拒绝Start,这种情况请查看Section 15.21.2, “Forcing InnoDB Recovery

For information about the binary log and InnoDB crash recovery, see Section 6.4.4, “The Binary Log”.

翻译:更多关于二进制Binlog 和InnoDB 宕机恢复的信息请看Section 6.4.4, “The Binary Log”.

转载于:https://my.oschina.net/ij5IYLKW/blog/818030

相关文章:

  • 重拾smslib
  • 【linux命令】之MV
  • 华硕zenfone2 ze551ml刷机
  • 动态规划——买股票的问题
  • Zepto.js源码学习之二
  • JPA 深度刘宝宝剖析版
  • 利用strstr与atoi的结合实现一个C语言获取文件中数据的工具
  • 文字绘制-图片绘制-水印绘制思路
  • C语言 · Anagrams问题
  • C# - 值类型、引用类型走出误区,容易错误的说法
  • 常用网址
  • python 04
  • Python程序-离散和线性图形
  • MongoDB安全事件的一些思考
  • java之多线程的理解
  • [nginx文档翻译系列] 控制nginx
  • flask接收请求并推入栈
  • JS 面试题总结
  • js面向对象
  • vue总结
  • 理解 C# 泛型接口中的协变与逆变(抗变)
  • 码农张的Bug人生 - 初来乍到
  • 前端_面试
  • 区块链分支循环
  • 源码之下无秘密 ── 做最好的 Netty 源码分析教程
  • 自动记录MySQL慢查询快照脚本
  • 2017年360最后一道编程题
  • MyCAT水平分库
  • ​io --- 处理流的核心工具​
  • ​草莓熊python turtle绘图代码(玫瑰花版)附源代码
  • ​如何防止网络攻击?
  • !!java web学习笔记(一到五)
  • #NOIP 2014# day.1 T2 联合权值
  • (SpringBoot)第二章:Spring创建和使用
  • (笔试题)合法字符串
  • (动手学习深度学习)第13章 计算机视觉---微调
  • (附源码)springboot 基于HTML5的个人网页的网站设计与实现 毕业设计 031623
  • (附源码)springboot工单管理系统 毕业设计 964158
  • (附源码)springboot建达集团公司平台 毕业设计 141538
  • (免费领源码)python#django#mysql校园校园宿舍管理系统84831-计算机毕业设计项目选题推荐
  • (四)【Jmeter】 JMeter的界面布局与组件概述
  • (一)使用IDEA创建Maven项目和Maven使用入门(配图详解)
  • (转)EXC_BREAKPOINT僵尸错误
  • *2 echo、printf、mkdir命令的应用
  • *p=a是把a的值赋给p,p=a是把a的地址赋给p。
  • .Net CoreRabbitMQ消息存储可靠机制
  • .net 使用$.ajax实现从前台调用后台方法(包含静态方法和非静态方法调用)
  • .NET/C# 利用 Walterlv.WeakEvents 高性能地中转一个自定义的弱事件(可让任意 CLR 事件成为弱事件)
  • .NET/C# 使窗口永不激活(No Activate 永不获得焦点)
  • .NET开源的一个小而快并且功能强大的 Windows 动态桌面软件 - DreamScene2
  • .Net转Java自学之路—SpringMVC框架篇六(异常处理)
  • [C++]Leetcode17电话号码的字母组合
  • [CISCN2021 Quals]upload(PNG-IDAT块嵌入马)
  • [mysql] mysqldump 导出数据库表
  • [NAND Flash 6.1] 怎么看时序图 | 从时序理解嵌入式 NAND Read 源码实现