summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dillinger <peterd@meta.com>2024-02-05 10:26:41 -0800
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2024-02-05 10:26:41 -0800
commit6e88126dd33219727021d9d9f84b42a47cc647b1 (patch)
tree44e397ea9e288d3fedacd2f3beb066ee527b336a
parent4eaa771c01727a6785b81f5f4a09840d38e31cf6 (diff)
Don't log an error when an auxiliary dir is missing (#12326)
Summary: info_log gets an error logged when wal_dir or a db_path/cf_path is missing. Under this condition, the directory is created later (in DBImpl::Recover -> Directories::SetDirectories) with no error status returned. To avoid error spam in logs, change these to a descriptive "header" log entry. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12326 Test Plan: manual with DBBasicTest.DBCloseAllDirectoryFDs which exercises this code Reviewed By: jowlyzhang Differential Revision: D53374743 Pulled By: pdillinger fbshipit-source-id: 32d1ce18809da13a25bdd6183d661f66a3b6a111
-rw-r--r--db/db_info_dumper.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/db/db_info_dumper.cc b/db/db_info_dumper.cc
index 748e55019..e45489712 100644
--- a/db/db_info_dumper.cc
+++ b/db/db_info_dumper.cc
@@ -98,7 +98,12 @@ void DumpDBFileSummary(const ImmutableDBOptions& options,
for (auto& db_path : options.db_paths) {
if (dbname.compare(db_path.path) != 0) {
s = env->GetChildren(db_path.path, &files);
- if (!s.ok()) {
+ if (s.IsNotFound() || s.IsPathNotFound()) {
+ Header(options.info_log,
+ "Directory from db_paths/cf_paths does not yet exist: %s\n",
+ db_path.path.c_str());
+ continue;
+ } else if (!s.ok()) {
Error(options.info_log, "Error when reading %s dir %s\n",
db_path.path.c_str(), s.ToString().c_str());
continue;
@@ -121,12 +126,18 @@ void DumpDBFileSummary(const ImmutableDBOptions& options,
// Get wal file in wal_dir
const auto& wal_dir = options.GetWalDir(dbname);
+ bool log_wal_info = true;
if (!options.IsWalDirSameAsDBPath(dbname)) {
s = env->GetChildren(wal_dir, &files);
- if (!s.ok()) {
- Error(options.info_log, "Error when reading %s dir %s\n", wal_dir.c_str(),
- s.ToString().c_str());
- return;
+ if (s.IsNotFound() || s.IsPathNotFound()) {
+ Header(options.info_log,
+ "Write Ahead Log directory does not yet exist: %s\n",
+ wal_dir.c_str());
+ log_wal_info = false;
+ } else if (!s.ok()) {
+ Error(options.info_log, "Error when reading wal dir %s: %s\n",
+ wal_dir.c_str(), s.ToString().c_str());
+ log_wal_info = false;
}
wal_info.clear();
for (const std::string& file : files) {
@@ -146,7 +157,9 @@ void DumpDBFileSummary(const ImmutableDBOptions& options,
}
}
}
- Header(options.info_log, "Write Ahead Log file in %s: %s\n", wal_dir.c_str(),
- wal_info.c_str());
+ if (log_wal_info) {
+ Header(options.info_log, "Write Ahead Log file in %s: %s\n",
+ wal_dir.c_str(), wal_info.c_str());
+ }
}
} // namespace ROCKSDB_NAMESPACE