VerifyChecksum() API should preserve options

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/4275

Reviewed By: yiwu-arbug

Differential Revision: D9369766

Pulled By: mikhail-antonov

fbshipit-source-id: d91b64c34cc1976b324a260767fce343fa32afde
This commit is contained in:
Mikhail Antonov 2018-08-16 16:39:24 -07:00 committed by Facebook Github Bot
parent 9c0c8f5ff6
commit 889a0553c8

View file

@ -3041,8 +3041,6 @@ Status DBImpl::IngestExternalFile(
Status DBImpl::VerifyChecksum() { Status DBImpl::VerifyChecksum() {
Status s; Status s;
Options options;
EnvOptions env_options;
std::vector<ColumnFamilyData*> cfd_list; std::vector<ColumnFamilyData*> cfd_list;
{ {
InstrumentedMutexLock l(&mutex_); InstrumentedMutexLock l(&mutex_);
@ -3060,13 +3058,19 @@ Status DBImpl::VerifyChecksum() {
for (auto& sv : sv_list) { for (auto& sv : sv_list) {
VersionStorageInfo* vstorage = sv->current->storage_info(); VersionStorageInfo* vstorage = sv->current->storage_info();
ColumnFamilyData* cfd = sv->current->cfd(); ColumnFamilyData* cfd = sv->current->cfd();
Options opts;
{
InstrumentedMutexLock l(&mutex_);
opts = Options(BuildDBOptions(immutable_db_options_,
mutable_db_options_), cfd->GetLatestCFOptions());
}
for (int i = 0; i < vstorage->num_non_empty_levels() && s.ok(); i++) { for (int i = 0; i < vstorage->num_non_empty_levels() && s.ok(); i++) {
for (size_t j = 0; j < vstorage->LevelFilesBrief(i).num_files && s.ok(); for (size_t j = 0; j < vstorage->LevelFilesBrief(i).num_files && s.ok();
j++) { j++) {
const auto& fd = vstorage->LevelFilesBrief(i).files[j].fd; const auto& fd = vstorage->LevelFilesBrief(i).files[j].fd;
std::string fname = TableFileName(cfd->ioptions()->cf_paths, std::string fname = TableFileName(cfd->ioptions()->cf_paths,
fd.GetNumber(), fd.GetPathId()); fd.GetNumber(), fd.GetPathId());
s = rocksdb::VerifySstFileChecksum(options, env_options, fname); s = rocksdb::VerifySstFileChecksum(opts, env_options_, fname);
} }
} }
if (!s.ok()) { if (!s.ok()) {