当前位置:网站首页>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)
边栏推荐
- BlocProvider 为什么感觉和 Provider 很相似?
- leetcode刷题:二叉树03(二叉树的后序遍历)
- 安装mysql时出现:需要这两个包perl(Data::Dumper),perl(JSON)
- TOPS,处理器运算能力单位、每秒钟可进行一万亿次
- 芭比Q了!新上架的游戏APP,咋分析?
- 运放-滞回(迟滞)比较器全流程实战计算
- 中通笔试题:翻转字符串,例如abcd打印出dcba
- 微信小程序,连续播放多段视频。合成一个视频的样子,自定义视频进度条
- Internet of things RFID, etc
- Introduction à l'ingénierie logicielle (sixième édition) notes d'examen de Zhang haifan
猜你喜欢
深度学习 常见的损失函数
BC35&BC95 ONENET MQTT(旧)
薛定谔的日语学习小程序源码
[deep learning] use deep learning to monitor your girlfriend's wechat chat?
Pytest Collection (2) - mode de fonctionnement pytest
pytest合集(2)— pytest運行方式
Past and present life of product modular design
十三届蓝桥杯B组国赛
Pytest collection (2) - pytest operation mode
2022安全员-B证考试练习题模拟考试平台操作
随机推荐
基于YOLOv5的口罩佩戴检测方法
Business visualization - make your flowchart'run'up
leetcode刷题:栈与队列07(滑动窗口最大值)
【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程
Wechat applet, continuously playing multiple videos. Synthesize the appearance of a video and customize the video progress bar
微软、哥伦比亚大学|GODEL:目标导向对话的大规模预训练
【级联分类器训练参数】Training Haar Cascades
leetcode刷题:栈与队列05(逆波兰表达式求值)
EMC-电路保护器件-防浪涌及冲击电流用
业务可视化-让你的流程图'Run'起来
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
东哥套现,大佬隐退?
tensorflow 张量做卷积,输入量与卷积核维度的理解
【STM32】STM32CubeMX教程二–基本使用(新建工程点亮LED灯)
【深度学习】利用深度学习监控女朋友的微信聊天?
Electron学习(三)之简单交互操作
杰理之蓝牙耳机品控和生产技巧【篇】
Case of camera opening by tour
TOPS,处理器运算能力单位、每秒钟可进行一万亿次
[deep learning] use deep learning to monitor your girlfriend's wechat chat?