OpenTenBase / OpenTenBase/TXSQL
Bug: fseg_get_pages_info does not release pages during extent iteration
Nessuno ha ancora preso questa issue.
- Lingua principale
- C++
- Stelle
- 337
- Fork
- 234
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia leggendo fseg_get_pages_info() in storage/innobase/fsp/fsp0fsp.cc, quindi esamina le dichiarazioni e l’implementazione di mtr_t in storage/innobase/include/mtr0mtr.h e storage/innobase/mtr/mtr0mtr.cc. Segui il percorso CHECK INDEX descritto nell’issue. Il lavoro è completato quando le scansioni degli extent delimitano i page latch mantenuti, preservando i risultati esistenti delle informazioni sulle pagine e il comportamento di CHECK INDEX.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- databases
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 57/100