InnoDB change buffer: Unsafe at any speed
The tale of some corruption bugs and how they were found
- Track: MariaDB, MySQL and Friends devroom
- Room: K.3.201
- Day: Sunday
- Start: 11:30
- End: 11:50
- Video with Q&A: We've hit a snag. The Video only link still works!
- Video only: We're not quite ready yet
- Chat: We've hit a snag. The Video only link still works!
One of the innovations in InnoDB was the change buffer (originally, insert buffer), which aims to convert random I/O to more sequential I/O, by buffering certain changes to secondary index B-tree leaf pages.
Due to its design and nature, any bugs related to the change buffer are extremely hard to reproduce. The change buffer is also becoming irrelevant, as the difference between random and sequential I/O is disappearing along with rotational storage (HDDs).
Thanks to the rr debugger and some improvements to InnoDB data structures, we have been able to reproduce and fix several tricky bugs related to the InnoDB change buffer.
We shortly explain how MVCC works for InnoDB secondary indexes and how the change buffer is supposed to work.
We describe some bug scenarios at a high level, possibly showing some code snippets or procedure call stacks.
Finally, we show how instead of debugging a core dump and guessing what lead to the problem, we can use "rr record" and get a deterministic execution trace leading to the failure in "rr replay". We can set breakpoints and data watchpoints and examine the state of the traced process at any point of time of execution. This even works across process boundaries, for crash recovery bugs.
Speakers
Marko Mäkelä |
Links
- rr debugger
- MySQL Bug #61104 InnoDB: Failing assertion: page_get_n_recs(page) 1
- MDEV-30009 InnoDB shutdown hangs when the change buffer is corrupted
- MDEV-26917 InnoDB: Clustered record for sec rec not found index
- MDEV-27734 Set innodb_change_buffering=none by default
- MDEV-24449 Corruption of system tablespace or last recovered page
- MDEV-11634 Improve the InnoDB change buffer
- How InnoDB Multi-Version Concurrency Control (MVCC) works
- Submit feedback