diff options
author | GWlodarek <gregory.wlodarek@mongodb.com> | 2017-06-06 09:44:30 -0400 |
---|---|---|
committer | GWlodarek <gregory.wlodarek@mongodb.com> | 2017-06-06 09:44:30 -0400 |
commit | 6380680e6e26c1b0a4006df374340d6dda8856ba (patch) | |
tree | 8dad1301f27711db795a67ece8d728b88fc4ce5d | |
parent | 3d478b58b4f005d7b8591e7cc8338ddfdd4daf54 (diff) | |
download | mongo-6380680e6e26c1b0a4006df374340d6dda8856ba.tar.gz |
SERVER-2938 Improved lock file error message
-rw-r--r-- | jstests/noPassthrough/lock_file_fail_to_open.js | 4 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_engine_lock_file_posix.cpp | 16 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_engine_lock_file_windows.cpp | 9 |
3 files changed, 21 insertions, 8 deletions
diff --git a/jstests/noPassthrough/lock_file_fail_to_open.js b/jstests/noPassthrough/lock_file_fail_to_open.js index 517fd5ec774..ee338f30b56 100644 --- a/jstests/noPassthrough/lock_file_fail_to_open.js +++ b/jstests/noPassthrough/lock_file_fail_to_open.js @@ -24,9 +24,9 @@ assert(mongo2 === null); assert.soon(() => { var logContents = rawMongoProgramOutput(); - return logContents.indexOf("Unable to lock file") > 0 || + return logContents.indexOf("Unable to lock the lock file") > 0 || // Windows error message is different. - logContents.indexOf("Unable to create/open lock file") > 0; + logContents.indexOf("Unable to create/open the lock file") > 0; }); } finally { MongoRunner.stopMongod(mongo1); 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 9395b618b4c..687d9f6b7a3 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp @@ -151,9 +151,14 @@ Status StorageEngineLockFile::open() { << _dbpath); } return Status(ErrorCodes::DBPathInUse, - str::stream() << "Unable to create/open lock file: " << _filespec << ' ' + str::stream() << "Unable to create/open the lock file: " << _filespec << " (" << errnoWithDescription(errorcode) - << " Is a mongod instance already running?"); + << ")." + << " Ensure the user executing mongod is the owner of the lock " + "file and has the appropriate permissions. Also make sure " + "that another mongod instance is not already running on the " + << _dbpath + << " directory"); } #if !defined(__sun) int ret = ::flock(lockFile, LOCK_EX | LOCK_NB); @@ -167,9 +172,12 @@ Status StorageEngineLockFile::open() { int errorcode = errno; ::close(lockFile); return Status(ErrorCodes::DBPathInUse, - str::stream() << "Unable to lock file: " << _filespec << ' ' + str::stream() << "Unable to lock the lock file: " << _filespec << " (" << errnoWithDescription(errorcode) - << ". Is a mongod instance already running?"); + << ")." + << " Another mongod instance is already running on the " + << _dbpath + << " directory"); } _lockFileHandle->_fd = lockFile; return Status::OK(); 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 24d87a548ec..287d63969f2 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_windows.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_windows.cpp @@ -131,9 +131,14 @@ Status StorageEngineLockFile::open() { << _dbpath); } return Status(ErrorCodes::DBPathInUse, - str::stream() << "Unable to create/open lock file: " << _filespec << ' ' + str::stream() << "Unable to create/open the lock file: " << _filespec << " (" << errnoWithDescription(errorcode) - << ". Is a mongod instance already running?"); + << ")." + << " Ensure the user executing mongod is the owner of the lock " + "file and has the appropriate permissions. Also make sure " + "that another mongod instance is not already running on the " + << _dbpath + << " directory"); } _lockFileHandle->_handle = lockFileHandle; return Status::OK(); |