Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fengzhao/mysql-wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
fengzhao committed Feb 18, 2025
2 parents 168ac4b + 2ef75b8 commit 5f2a5e2
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 226 deletions.
16 changes: 16 additions & 0 deletions docs/advanced/4.InnoDB内存结构——缓冲池.md
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,22 @@ InnoDB 未压缩的数据页是 16KB,根据选项组合值,MySQL 为每个
[参考](https://www.cnblogs.com/mysql-dba/p/5125220.html)
## InnoDB 数据页解析
数据库采用数据页的形式组织数据。MySQL 默认的非压缩数据页为 16KB。
在 ibd 中间中,0-16KB 偏移量即为 0 号数据页,16KB-32KB 的为 1 号数据页,依次类推。
数据页的头尾除了一些元信息外,还有 Checksum 校验值,这些校验值在写入磁盘前计算得到,当从磁盘中读取时,重新计算校验值并与数据页中存储的对比,如果发现不同,则会导致 MySQL crash。
遇到这种情况,往往需要从备份集中恢复数据,如果备份不可用,只能使用 innodb_force_recovery 强行启动,然后尽可能多的导出数据。这篇月报中介绍了一种从物理文件中恢复数据的方法,在走投无路的情况下可以使用。
### 数据页格式
严格来讲,InnoDB 的数据页有很多种,比如,索引页,Undo 页,Inode 页,系统页,BloB 页等,一共有 10 多种
数据页包括七个部分,数据页文件头,数据页头,最大最小记录,用户记录,空闲空间,数据目录,数据页尾部。简单的来说,数据页分两部分,一部分存储数据记录,按照记录的大小通过记录的指针连接起来。
## 总结
到此,我已经将缓冲池 `Buffer Pool`介绍完毕了。
Expand Down
Loading

0 comments on commit 5f2a5e2

Please sign in to comment.