THSS-DB / TDB

Educational Database Management System for Software School of Tsinghua University
Mulan Permissive Software License, Version 2
13 stars 17 forks source link

fix: [lab1] fix incorrect pin_count in buffer_pool_test.cpp #6

Closed stackByStack closed 5 months ago

stackByStack commented 5 months ago

The issue arises from two instances where a pin operation occurs: one during allocate_page and another within init_empty_page. However, there seems to be only a single unpin operation via record_page_handle.cleanup(). This discrepancy leads to a situation where cannot flush the page because the pincount remains at 1, suggesting that the page is still in use. This could only be a source of frustration for those who checks the pincount during page eviction.

该问题是由发生 pin 操作的两个实例引起的:一个是在 allocate_page 期间,另一个是在 init_empty_page 期间。 然而,似乎只有一个通过 record_page_handle.cleanup() 的unpin操作。 这会导致无法刷新页面的情况,因为 pincount 仍为 1,表明该页面仍在使用中。 这可能只会让那些在页面驱逐期间检查 pincount 的人感到困扰。

stackByStack commented 5 months ago

目前认为,进入evict_all_pages前page的pin_count_应为0 gdb server验证了该观点 d4818207a1e0fce7915b38ee61398a8

此处的1为frame查找函数pin的,具体可查看源码,而这意味着进入evict_all_pages前page的pin_count_应为0,而test1没有达到这个预期,故应被修正