Share the joy
To solve non-repeatable read:
1. lock
2. mvcc
As long as there is an update, then generate a new record with current tx_id. undo log points to previous one.
When read, it should have:
ReadView { m_ids_list, min_trx_id, max_trx_id, creator_trx_id }
When read or doing a transaction, it should have current tx_id and its ReadView. Go to the record, check if the top record’s tx_id is smaller than the tx_id in ReadView. If so, then this is the value for it. If not, check the next record in undo log…
Good article for MVCC.
https://blog.csdn.net/flying_hengfei/article/details/106965517