当前位置:网站首页>MySQL series transaction log redo log learning notes
MySQL series transaction log redo log learning notes
2022-07-01 21:48:00 【51CTO】
MySQL Series of transaction logs Redo log Learning notes
Before learning this blog, you need to reserve knowledge :
- MySQL Architecture
- InnoDB Storage engine
- MySQL Business knowledge
In the last blog , We know undo log, Continue with the last blog , Learn another important InnoDB Transaction log redo log
1、Redo Log
1.1、 What is? Redo log?
Redo : Do it again ,undo Undo rollback means
Redo log: It is called redo log , When an accident occurs in the database , Data recovery ,redo log The backup is the modified data in the process of transaction execution ,redo log The latest data location during the transaction is backed up
1.2、Redo log working principle
Previous learning , We know undo log Is a log record for rollback , It belongs to logical log , And this blog introduces redo log It's a physical log , As long as it is used to prevent system redundancy and other special situations , When this happens , restart mysql Will read redo log, Thus, some data that is not written to the disk is written to the disk for persistent storage
Based on the diagram of blog in the previous chapter , Expand , Compare the undo log and redo log
- undo log and redo logo All are InnoDB The function of , All transaction logs
- undo log It's a logical log , Record is the operation record log ,redo log It's a physical log , New data is recorded
- undo log It is designed to ensure the atomicity of transactions ,redo log It is set to ensure transaction persistence .undo log stay InnoDB Is used to realize multi version control , perform rollback In operation ,undo log It can be used as a snapshot read reference for transaction rollback , and redo log Is the latest data location for backup , System redundancy , Just restart mysql service , You can persist unsaved data to disk
Insert picture description here
1.3、Redo log Write mechanism
Insert picture description here
- write point: This pointer records the current position , While writing , Move along , Write to the end of the last file and go back to 0 No. file overwrites again
- check point: This pointer records the current position to be erased , It's also going back and forth , Before erasing a record, update the record to a data file
quote 51 Legend of blog : The picture is from https://blog.51cto.com/wangwei007/2287431
redo log When it is full , The pointer returns to the origin , Restart overwrite save , If write pos Catch up checkpoint, Indicates full , No new updates can be performed at this time , You have to stop and erase some records , hold checkpoint Push forward the node
1.4、Redo log Configuration parameters
Check... By command redo log Parameters :
1.5、Redo Data persistence strategy
【 Expand knowledge 】, Every InnoDB The storage engine has at least 1 Log redo filegroups (redo file group), Each filegroup has at least 2 individual redo Log files , The default is ib_logfile0
and ib_logfile1
, The storage path is ${datadir}
Redo Buffer Persist to Redo Log The strategy of , Through the variable innodb_flush_log_at_trx_commit
The value of
Insert picture description here
- 0: Set the value to 0, Express Log Buffer The data in does not go through OS cache , Call directly fsync Directly brush to disk file to save
- 1: Set the value to 1( The default value is ), After the transaction is committed , It will be saved to log buffer, Then save to os buffer cache , At the same time call fsync Sync to disk
- 2: Set the value to 2, The data is not written log buffer, Cache directly to os buffer, Every second , call fsync Swipe data to disk
appendix : Reference material
- MySQL InnoDB redo Log elementary analysis
- Detailed analysis MySQL Transaction log (redo log and undo log)
边栏推荐
- EMC-电路保护器件-防浪涌及冲击电流用
- Can I choose to open an account for stock trading on flush? Is it safe?
- 如果浏览器被意外关闭,react怎么缓存用户填写的表单?
- PCB plug hole technology~
- 【单体】流辰信息I-BPSv3服务器推荐配置
- leetcode刷题:二叉树01(二叉树的前序遍历)
- Introduction à l'ingénierie logicielle (sixième édition) notes d'examen de Zhang haifan
- 从MLPerf谈起:如何引领AI加速器的下一波浪潮
- 函数基本学习之一
- 【直播回顾】战码先锋首期8节直播完美落幕,下期敬请期待!
猜你喜欢
杰理之、产线装配环节【篇】
2022年低压电工考试试题及答案
杰理之、产线装配环节【篇】
【深度学习】利用深度学习监控女朋友的微信聊天?
Slf4j打印异常的堆栈信息
AirServer2022最新版功能介绍及下载
【智能QbD风险评估工具】上海道宁为您带来LeanQbD介绍、试用、教程
Significance and measures of security encryption of industrial control equipment
十三届蓝桥杯B组国赛
I received a letter from CTO inviting me to interview machine learning engineer
随机推荐
BlocProvider 为什么感觉和 Provider 很相似?
在技术升级中迎合消费者需求,安吉尔净水器“价值战”的竞争之道
【mysql 07】GPG key retrieval failed: “Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022“
Slf4j打印异常的堆栈信息
旁路由设置的正确方式
latex如何打空格
能升职加薪?PMP证书含金量浅析
JS how to get a list of elements in a collection object
2022安全员-B证考试练习题模拟考试平台操作
焱融看 | 混合云时代下,如何制定多云策略
[NOIP2013]积木大赛 [NOIP2018]道路铺设 贪心/差分
杰理之、产线装配环节【篇】
Halcon知识:三维重构的一个尝试
函数基本学习之一
BC35&BC95 ONENET MQTT(旧)
上半年暂停考试要补考?包含监理工程师、建筑师等十项考试
Application of real estate management based on 3D GIS
最近公共祖先离线做法(tarjan)
游览器打开摄像头案例
杰理之、产线装配环节【篇】