diff options
4 files changed, 13 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 1f68840e7f3..40fd1d302b4 100644 --- a/src/mongo/db/storage/storage_engine_lock_file.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file.cpp @@ -34,6 +34,8 @@ #include "mongo/db/storage/storage_engine_lock_file.h" +#include "mongo/util/str.h" + namespace mongo { namespace { @@ -45,4 +47,11 @@ boost::optional<StorageEngineLockFile>& StorageEngineLockFile::get(ServiceContex return getLockFile(service); } +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 b043dd6ed9b..5b1b0f38184 100644 --- a/src/mongo/db/storage/storage_engine_lock_file.h +++ b/src/mongo/db/storage/storage_engine_lock_file.h @@ -92,6 +92,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 e08764a4aa9..46a9d6246a6 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp @@ -130,8 +130,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 97bd280c3fe..b141044246d 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp @@ -104,8 +104,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, |