Bug: fseg_get_pages_info does not release pages during extent iteration
还没有人认领这个 Issue。
评估
调研方向
先阅读 storage/innobase/fsp/fsp0fsp.cc 中的 fseg_get_pages_info(),然后检查 storage/innobase/include/mtr0mtr.h 和 storage/innobase/mtr/mtr0mtr.cc 中 mtr_t 的声明与实现。跟踪 issue 中描述的 CHECK INDEX 路径。完成的标准是:extent 扫描限定所保留的页闩锁,同时保留现有的页面信息结果和 CHECK INDEX 行为。
由索引模型根据 Issue 内容生成。
描述
Bug: fseg_get_pages_info does not release pages during extent iteration
Problem
In fseg_get_pages_info() (storage/innobase/fsp/fsp0fsp.cc), when scanning the FSEG_NOT_FULL and FSEG_FULL extent lists for a segment, the mtr holds latches on every visited page descriptor (xdes) without releasing them until the entire function completes and mtr_commit() is called.
For tables with a large number of extents (large tables or tables with fragmented segments), this can mean holding hundreds or thousands of page latches simultaneously within a single mini-transaction. This causes:
- Excessive buffer pool frame consumption (each latched page pins a buffer pool frame)
- Increased memory pressure and potential OOM
CHECK INDEXon large tables becomes unreliable (may OOM)
Root Cause
The mtr_t memo stack grows unbounded during extent list traversal in fseg_get_pages_info(). Each call to xdes_lst_get_descriptor() and xdes_mtr_get_bit() adds a page latch to the mtr memo, but these latches are only released at mtr_commit() which happens at the very end of the function.
Fix
Add a new function mtr_t::release_all_after_savepoint() that releases all pages held in the mtr memo after a given savepoint. Then in fseg_get_pages_info(), set a savepoint and release pages every 100 iterations, effectively bounding the number of simultaneously held latches.
Changes
-
storage/innobase/include/mtr0mtr.h: Declarerelease_all_after_savepoint(ulint savepoint)method andmtr_release_all_after_savepoint()macro. -
storage/innobase/mtr/mtr0mtr.cc: ImplementRelease_all_after_savepointfunctor andmtr_t::release_all_after_savepoint()method. -
storage/innobase/fsp/fsp0fsp.cc: Infseg_get_pages_info(), add savepoint and release logic every 100 pages during FSEG_NOT_FULL and FSEG_FULL list scans.
Affected Scenarios
CHECK INDEXon large tables —ha_innobase::check_index()→innobase_get_index_status()→fseg_get_pages_info()for both leaf and top segments of each index
- 主要语言
- C++
- 星标
- 338
- 派生
- 235
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenTenBase/TXSQL 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
OpenTenBase/TXSQL#95 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
OpenTenBase/TXSQL#57 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 32/100
OpenTenBase/TXSQL#113 ·
-
难度 5/5 一周以上 新手友好度 35/100
OpenTenBase/TXSQL#112 ·
-
难度 5/5 一周以上 新手友好度 25/100
OpenTenBase/TXSQL#111 ·
查看 OpenTenBase/TXSQL 的全部 Issue
相似的 Issue
-
Website Doc Typo 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
难度 1/5 1-3 小时 新手友好度 92/100
autowarefoundation/autoware_universe#13413 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
automated-analysis bug memory-safety
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 88/100