03 Buffer Pool

Buffer Pool

Buffer Pool 缓存数据页与索引页;读未命中才从表空间加载,脏页后台刷出前必须满足 WAL。
版本:MySQL Community Server 26.10.0(InnoDB);核实日期:2026-11-12。官方在线文档可能继续更新,源码链接固定到对应发布标签。图为原理抽象,省略非本页重点。
specification { element actor { style { shape person; color amber } } element system { style { color muted } } element component { style { color primary } } element storage { style { shape storage; color green } } } model { q = actor '查询 / 修改线程' bp = storage 'Buffer Pool' disk = storage '表空间文件' flush = component '页清理 / 刷脏' redo = storage 'redo 日志' } views { dynamic view index { title '核心链路' variant sequence q -> bp '按页号查找目标页' opt '缓存未命中' { bp -> disk '请求读页' disk -> bp '加载页并加入缓存管理' } bp -> q '返回可用页供读取或修改' q -> bp '修改后标记脏页' flush -> redo '确保该页所需 redo 已持久化' flush -> bp '选择需要刷出的脏页' flush -> disk '通过相应写入保护路径刷出页' } }

关键判断

  • 缓存命中路径会跳过图中的读盘步骤;缓存单位是页,不是整条 SQL 的最终结果。
  • LRU 及 old / young 分区管理访问热度,flush list 跟踪脏页;脏页不能不经保护直接丢弃。
  • 刷脏、checkpoint 与 redo 空间相互影响,内存命中率高仍可能被写入与日志压力限制;doublewrite 用于防范部分页写问题。

边界

图省略预读、压缩与多实例等细节;doublewrite 行为受版本、配置和存储能力影响,不能等同为 redo。

官方出处与源码

回到首页 · 上一篇 · 下一篇