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 deadlock between Flush and UnregisterDB #349

Merged
merged 5 commits into from
Oct 9, 2023

Conversation

SpadeA-Tang
Copy link
Member

@SpadeA-Tang SpadeA-Tang commented Oct 7, 2023

The caller of MaybeFlushLocked should be called without holding db mutex.

i
Signed-off-by: SpadeA-Tang <[email protected]>
@@ -174,6 +178,7 @@ void WriteBufferManager::FreeMemWithCache(size_t mem) {
#endif // ROCKSDB_LITE
}

// Must be called without holding db mutex.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not entirely correct. The lock of this_db (if not null) must be held.

@@ -99,6 +102,7 @@ void WriteBufferManager::UnregisterColumnFamily(ColumnFamilyHandle* cf) {
MaybeFlushLocked();
}

// Must be called without holding db mutex.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong.

@@ -73,6 +73,7 @@ void WriteBufferManager::SetFlushSize(size_t new_size) {
}
}

// Must be called without holding db mutex.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment should be placed in header file.

Signed-off-by: SpadeA-Tang <[email protected]>
u
Signed-off-by: SpadeA-Tang <[email protected]>
U
Signed-off-by: SpadeA-Tang <[email protected]>
@SpadeA-Tang
Copy link
Member Author

I discovered some comments are already in header file, I removed the redundancies. PTAL again @tabokie thanks.

Signed-off-by: SpadeA-Tang <[email protected]>
@tabokie tabokie merged commit 0813e37 into tikv:6.29.tikv Oct 9, 2023
2 checks passed
v01dstar pushed a commit to v01dstar/rocksdb that referenced this pull request May 29, 2024
v01dstar pushed a commit to v01dstar/rocksdb that referenced this pull request Oct 2, 2024
v01dstar pushed a commit to v01dstar/rocksdb that referenced this pull request Oct 2, 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.

3 participants