fix: [lab1] fix incorrect pin_count in buffer_pool_test.cpp #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_ 的人感到困扰。