diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-04-24 14:16:31 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-27 23:44:41 +0000 |
commit | 06755cd5a43d08b5e1e9163e060177d728ae6696 (patch) | |
tree | 9e0c09b02e91e565a4658c34a16f2e51debab5ea /src/mongo/db | |
parent | 404e44ce81b762db8ceee31df8e5b344f717e6a5 (diff) | |
download | mongo-06755cd5a43d08b5e1e9163e060177d728ae6696.tar.gz |
SERVER-46398 Expand the data directory not found message on startup to be more informative
Diffstat (limited to 'src/mongo/db')
4 files changed, 12 insertions, 4 deletions
diff --git a/src/mongo/db/storage/storage_engine_lock_file.cpp b/src/mongo/db/storage/storage_engine_lock_file.cpp index 4c67d761f13..ff82910244d 100644 --- a/src/mongo/db/storage/storage_engine_lock_file.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file.cpp @@ -34,6 +34,7 @@ #include "mongo/db/storage/storage_engine_lock_file.h" #include "mongo/platform/process_id.h" +#include "mongo/util/str.h" namespace mongo { namespace { @@ -55,4 +56,11 @@ Status StorageEngineLockFile::writePid() { return writeString(pidStr); } +std::string StorageEngineLockFile::_getNonExistentPathMessage() const { + return str::stream() << "Data directory " << _dbpath + << " not found. Create the missing directory or specify another path " + "using (1) the --dbpath command line option, or (2) by adding the " + "'storage.dbPath' option in the configuration file."; +} + } // namespace mongo diff --git a/src/mongo/db/storage/storage_engine_lock_file.h b/src/mongo/db/storage/storage_engine_lock_file.h index 603a83adfaa..bea803a1b95 100644 --- a/src/mongo/db/storage/storage_engine_lock_file.h +++ b/src/mongo/db/storage/storage_engine_lock_file.h @@ -97,6 +97,8 @@ public: void clearPidAndUnlock(); private: + std::string _getNonExistentPathMessage() const; + std::string _dbpath; std::string _filespec; bool _uncleanShutdown; diff --git a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp index 1287c39953f..a1057b1ee6f 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp @@ -137,8 +137,7 @@ bool StorageEngineLockFile::createdByUncleanShutdown() const { Status StorageEngineLockFile::open() { try { if (!boost::filesystem::exists(_dbpath)) { - return Status(ErrorCodes::NonExistentPath, - str::stream() << "Data directory " << _dbpath << " not found."); + return Status(ErrorCodes::NonExistentPath, _getNonExistentPathMessage()); } } catch (const std::exception& ex) { return Status(ErrorCodes::UnknownError, diff --git a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp index ae21aac6e46..4dcf05d3995 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp @@ -102,8 +102,7 @@ bool StorageEngineLockFile::createdByUncleanShutdown() const { Status StorageEngineLockFile::open() { try { if (!boost::filesystem::exists(_dbpath)) { - return Status(ErrorCodes::NonExistentPath, - str::stream() << "Data directory " << _dbpath << " not found."); + return Status(ErrorCodes::NonExistentPath, _getNonExistentPathMessage()); } } catch (const std::exception& ex) { return Status(ErrorCodes::UnknownError, |