CMU 15445 Project 4
Garbage Collection
The following example comes from the test case TxnExecutorTest_GarbageCollection:
Before the first garbage collection,

- When
txn_watermark_at_0is not committed, the watermark is 1. - When
txn_watermark_at_0is committed, the watermark changes to 7, i.e. the earlist running transaction istxn_watermark_at_1. At this time, for the first tuple in the table heap,txn_watermark_at_1should read the undo log chain to ts=4. - When
txn_watermark_at_1is committed, the watermark changes to 12, i.e. the earlist running transaction istxn_watermark_at_2. At this time, for the first tuple in the table heap,txn_watermark_at_2should read the undo log chain to ts=10. Hence, the tuple at 'ts=4' is eligible for deletion. For the third tuple in the table heap, transactiontxn_watermark_at_2should only read the tuple at 'ts=10'. Hence, the tuple at 'ts=5' is eligible for deletion. Therefore, we could know all undo logs intxn2should be removed andtxn2also need be removed fromtxn_map_whenGarbageCollectionis invoked. - When
txn_watermark_at_2is committed, the watermark changes to 17, i.e. the earlist running transaction istxn_watermark_at_3. At this time,txn_watermark_at_3do not traverse the undo log chain. Hence,txn3should be removed fromtxn_map_whenGarbageCollectionis invoked.
Reference
posted on 2024-10-06 15:59 winter-loo 阅读(29) 评论(0) 收藏 举报
浙公网安备 33010602011771号