From 07dc955a1f774e9f5699cde7cbd24f342297dc3c Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Tue, 29 Sep 2020 15:25:31 -0700 Subject: [PATCH] Report error of GetChildren (#7459) Summary: As title Pull Request resolved: https://github.com/facebook/rocksdb/pull/7459 Test Plan: make check Reviewed By: anand1976 Differential Revision: D23999393 Pulled By: riversand963 fbshipit-source-id: 09df8e1637f4df3616c63ee314de397b35be4e4a --- db/db_impl/db_impl_files.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/db/db_impl/db_impl_files.cc b/db/db_impl/db_impl_files.cc index ee8494919..2d30f5857 100644 --- a/db/db_impl/db_impl_files.cc +++ b/db/db_impl/db_impl_files.cc @@ -762,10 +762,13 @@ Status DBImpl::FinishBestEffortsRecovery() { uint64_t next_file_number = versions_->current_next_file_number(); uint64_t largest_file_number = next_file_number; std::set files_to_delete; + Status s; for (const auto& path : paths) { std::vector files; - // Should we handle it? - env_->GetChildren(path, &files).PermitUncheckedError(); + s = env_->GetChildren(path, &files); + if (!s.ok()) { + break; + } for (const auto& fname : files) { uint64_t number = 0; FileType type; @@ -781,6 +784,10 @@ Status DBImpl::FinishBestEffortsRecovery() { } } } + if (!s.ok()) { + return s; + } + if (largest_file_number > next_file_number) { versions_->next_file_number_.store(largest_file_number + 1); } @@ -792,7 +799,7 @@ Status DBImpl::FinishBestEffortsRecovery() { assert(default_cfd); // Even if new_descriptor_log is false, we will still switch to a new // MANIFEST and update CURRENT file, since this is in recovery. - Status s = versions_->LogAndApply( + s = versions_->LogAndApply( default_cfd, *default_cfd->GetLatestMutableCFOptions(), &edit, &mutex_, directories_.GetDbDir(), /*new_descriptor_log*/ false); if (!s.ok()) {