summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file.cpp8
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file.h2
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file_posix.cpp3
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file_windows.cpp3
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,