Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

stackByStack
Copy link
Contributor

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 pin_count_ remains at 1, suggesting that the page is still in use. This could only be a source of frustration for those who checks the pin_count_ during page eviction.

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

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 pin_count_ remains at 1, suggesting that the page is still in use. This could only be a source of frustration for those who checks the pin_count_ during page eviction🤣.

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

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

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

@ycycse ycycse requested a review from RkGrit March 28, 2024 02:12
@ycycse ycycse changed the title fix: [lab1] fix unit test buffer_pool_test.cpp fix: [lab1] fix incorrect pin_count in buffer_pool_test.cpp Mar 28, 2024
@RkGrit RkGrit merged commit e120a8d into THSS-DB:master Mar 28, 2024
@stackByStack stackByStack deleted the yangmh branch March 28, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants