Skip to content

Commit

Permalink
Fix unhandled MANIFEST write errors (facebook#12865)
Browse files Browse the repository at this point in the history
Summary:
The failure of `WriteCurrentStateToManifest()` in `VersionSet::ProcessManifestWrites()` was not handled properly. If it failed, `manifest_io_status` was not updated, leading to `manifest_file_number_` being updated to the newly created manifest even though its bad. This would lead to the bad manifest immediately getting deleted, and also the good manifest (referenced by `CURRENT`) getting deleted by obsolete file deletion because of `manifest_file_number_` not referencing its number.

Pull Request resolved: facebook#12865

Reviewed By: hx235

Differential Revision: D59782940

Pulled By: anand1976

fbshipit-source-id: f752fb9a1c23fd3d734616e273613cbac204301b
  • Loading branch information
anand1976 authored and facebook-github-bot committed Jul 16, 2024
1 parent 4ff35af commit 5aa6754
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5562,7 +5562,9 @@ Status VersionSet::ProcessManifestWrites(
s = WriteCurrentStateToManifest(write_options, curr_state,
wal_additions, descriptor_log_.get(),
io_s);
} else {
assert(s == io_s);
}
if (!io_s.ok()) {
manifest_io_status = io_s;
s = io_s;
}
Expand Down
1 change: 1 addition & 0 deletions unreleased_history/bug_fixes/handle_manifest_error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug in handling MANIFEST write error that caused the latest valid MANIFEST file to get deleted, resulting in the DB being unopenable.

0 comments on commit 5aa6754

Please sign in to comment.