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

Preserve logs on write error. #188

Merged
merged 3 commits into from
Mar 7, 2023
Merged

Preserve logs on write error. #188

merged 3 commits into from
Mar 7, 2023

Conversation

arkpar
Copy link
Member

@arkpar arkpar commented Mar 7, 2023

This fixes a potential DB corruption on write error. When the database is closed with an error, all existing logs must be preserved so that log recovery may fix it on next open.

@arkpar arkpar requested review from Tpt and cheme March 7, 2023 12:31
@@ -867,7 +867,6 @@ pub struct Db {
flush_thread: Option<thread::JoinHandle<()>>,
log_thread: Option<thread::JoinHandle<()>>,
cleanup_thread: Option<thread::JoinHandle<()>>,
join_on_shutdown: bool,
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed is since it is not very useful. Each thead is an Option anyway. the only thing it prevented is calling kill_logs on shutdown. Which is what the test actually requires.

Copy link
Contributor

@Tpt Tpt left a comment

Choose a reason for hiding this comment

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

Thank you! It's sad that the fuzzer has not been able to find this possible error earlier

@arkpar arkpar merged commit 1117eca into master Mar 7, 2023
@arkpar arkpar deleted the arkpar-preserve-logs branch March 7, 2023 21:47
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