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

Separate WAL page idx lock from page lock in BMFileHandle #1398

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

ray6080
Copy link
Contributor

@ray6080 ray6080 commented Mar 21, 2023

This PR introduces WALPageIdxGroup in BMFileHandle, the WALPageIdxGroup keeps a set of WAL page indexes for a page group with updated pages in WAL file.
This also changes how BMFileHandle stores wal page indexes, switching from vector-based to map-based. We assume each write transaction will only touch a small number of page groups, so map-based method can be efficient.

After the change, we can now remove two interfaces, pinWithoutAcquiringPageLock and unpinWithoutAcquiringPageLock, in BufferManager. PageLock is only used specifically by BufferManager to correctly manage pages and frames.
Any operations that require sync on accessing wal page idx of an original page should acquire the WAL page idx lock.

Additionally, this PR fixes a potential bug in BMFileHandle::clearWALPageIdxIfNecessary.
There was a missing lock acquire (only releasePageLock(pageIdx); was called) in the function, but adding lock acquiring logic can lead to dead locks in the test SetNodeStructuredPropTransactionTest::SetVeryLongStringErrorsTest.
The reason is writing long string overflow triggers exception thrown, which didn't correctly release locks.
See changes in StringPropertyColumn::writeValueForSingleNodeIDPosition.
The change is also propagated to ListPropertyColumn::writeValueForSingleNodeIDPosition though it has nothing to do with the failing test.

@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Patch coverage: 94.33% and project coverage change: -0.02 ⚠️

Comparison is base (b999827) 92.74% compared to head (fbddf5c) 92.73%.

❗ Current head fbddf5c differs from pull request most recent head 5d41f84. Consider uploading reports for the commit 5d41f84 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1398      +/-   ##
==========================================
- Coverage   92.74%   92.73%   -0.02%     
==========================================
  Files         642      642              
  Lines       22090    22110      +20     
==========================================
+ Hits        20488    20504      +16     
- Misses       1602     1606       +4     
Impacted Files Coverage Δ
src/include/common/types/types.h 100.00% <ø> (ø)
...rc/include/storage/buffer_manager/buffer_manager.h 73.33% <ø> (-6.67%) ⬇️
src/include/storage/storage_structure/column.h 94.84% <ø> (ø)
...torage/storage_structure/storage_structure_utils.h 100.00% <ø> (ø)
src/storage/storage_structure/column.cpp 91.79% <81.48%> (-3.21%) ⬇️
src/storage/buffer_manager/bm_file_handle.cpp 97.89% <97.82%> (+2.29%) ⬆️
...rc/include/storage/buffer_manager/bm_file_handle.h 95.45% <100.00%> (+1.33%) ⬆️
src/storage/buffer_manager/buffer_manager.cpp 75.86% <100.00%> (-1.56%) ⬇️
src/storage/storage_structure/disk_array.cpp 93.44% <100.00%> (ø)
...rc/storage/storage_structure/storage_structure.cpp 100.00% <100.00%> (ø)
... and 2 more

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ray6080 ray6080 merged commit 3345cb3 into master Mar 23, 2023
@ray6080 ray6080 deleted the versioned-page-lock branch March 23, 2023 22:27
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.

None yet

2 participants