Skip to content

PBTree: Fix deadlock when segment deleted#11828

Merged
MarcosZyk merged 1 commit intoapache:masterfrom
bigreybear:fix-deadlock
Jan 3, 2024
Merged

PBTree: Fix deadlock when segment deleted#11828
MarcosZyk merged 1 commit intoapache:masterfrom
bigreybear:fix-deadlock

Conversation

@bigreybear
Copy link
Copy Markdown
Contributor

Description

Previously, there was a deadlock issue caused by a reentrant write lock that would only unlock once, leading to a situation where any read thread attempting to access the page would be blocked.

This reentrant lock scenario, although rare, occurred recurrently on the test server. If one page has just allocated (more precisely, pre-allocated) last few bytes, it will be removed from local(context) index buckets but not added back. Right now a segment of this page was transplanted into another page, the previous implementation failed to update spare space variation of this page in the local index buckets, which are designed for quick retrieval based on specified spare space. However, this page might have been previously marked in the global index bucket, with a spare space before allocation. And then it could be retrieved by the previous bucket entry, creating a reentrant lock situation.

This revised version marks spare space variation of segment transplatation in local index buckets, eliminating the deadlock issue.


Key changed/added classes (or packages if there are too many classes) in this PR

@MarcosZyk MarcosZyk merged commit 9aedab8 into apache:master Jan 3, 2024
SzyWilliam pushed a commit to SzyWilliam/iotdb that referenced this pull request Nov 26, 2024
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.

2 participants