summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorYu Zhang <yuzhangyu@fb.com>2024-07-24 17:50:08 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2024-07-24 17:50:08 -0700
commit9883b5f497a6c451065595c8c668728cfa5b8f59 (patch)
tree1c4b323801f74bf1badb6d77a9586f5f397bf6cf /db
parent05c9c9aeedf315587af8b22a2e4fe4dc0f6784fa (diff)
Fix manifest_number_ point to invalid file (#12882)
Summary: This PR fix `VersionSet`'s `manifest_number_` could be pointing to an invalid number intermediately. This happens when a new manifest roll is attempted but fast failed after loading table handlers and before the new manifest file creation/writing is actually attempted. In theory, a later manifest roll effort will overthrow this intermediate invalid in memory state. There is on harm when the DB crashes in this invalid state either. But efforts that takes a file snapshot of the DB like backup will incorrectly try to copy a non existing manifest file. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12882 Reviewed By: cbi42 Differential Revision: D60204956 Pulled By: jowlyzhang fbshipit-source-id: effbdb124b582f879d114988af06ac63867fc549
Diffstat (limited to 'db')
-rw-r--r--db/version_set.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/db/version_set.cc b/db/version_set.cc
index 86f47aca7..1be0468a5 100644
--- a/db/version_set.cc
+++ b/db/version_set.cc
@@ -5768,10 +5768,6 @@ Status VersionSet::ProcessManifestWrites(
for (auto v : versions) {
delete v;
}
- if (manifest_io_status.ok()) {
- manifest_file_number_ = pending_manifest_file_number_;
- manifest_file_size_ = new_manifest_file_size;
- }
// If manifest append failed for whatever reason, the file could be
// corrupted. So we need to force the next version update to start a
// new manifest file.
@@ -5803,7 +5799,7 @@ Status VersionSet::ProcessManifestWrites(
// a) CURRENT points to the new MANIFEST, and the new MANIFEST is present.
// b) CURRENT points to the original MANIFEST, and the original MANIFEST
// also exists.
- if (new_descriptor_log && !manifest_io_status.ok()) {
+ if (!manifest_io_status.ok() && new_descriptor_log) {
ROCKS_LOG_INFO(db_options_->info_log,
"Deleting manifest %" PRIu64 " current manifest %" PRIu64
"\n",