Skip to content

Commit

Permalink
assert cloud_manifest when necessary (facebook#164)
Browse files Browse the repository at this point in the history
Apparently, it's possible that we pass a null cloud_manifest_ when calling RemapFilename. So we need to assert cloud_manifest only if necessary.
  • Loading branch information
seckcoder authored Jun 20, 2022
1 parent c1c9237 commit c92b6db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cloud/cloud_env_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ std::string RemapFilenameWithCloudManifest(const std::string& logical_path, Clou
switch (type) {
case kTableFile:
// We should not be accessing sst files before CLOUDMANIFEST is loaded
assert(cloud_manifest);
epoch = cloud_manifest->GetEpoch(fileNumber);
break;
case kDescriptorFile:
Expand All @@ -894,6 +895,7 @@ std::string RemapFilenameWithCloudManifest(const std::string& logical_path, Clou
// Even though logical file might say MANIFEST-000001, we cut the number
// suffix and store MANIFEST-[epoch] in the cloud and locally.
file_name = "MANIFEST";
assert(cloud_manifest);
epoch = cloud_manifest->GetCurrentEpoch();
break;
default:
Expand All @@ -908,7 +910,6 @@ std::string CloudEnvImpl::RemapFilename(const std::string& logical_path) const {
if (UNLIKELY(test_disable_cloud_manifest_)) {
return logical_path;
}
assert(cloud_manifest_);
return RemapFilenameWithCloudManifest(logical_path, cloud_manifest_.get());
}

Expand Down

0 comments on commit c92b6db

Please sign in to comment.