minor: helpful error message when unable to acquire dbpath lock in tools

This commit is contained in:
Mike Dirolf
2010-03-11 11:55:10 -05:00
parent 62df0bde11
commit 0ecf45bf84

View File

@@ -47,7 +47,10 @@ namespace mongo {
;
if ( localDBAllowed )
_options->add_options()
("dbpath",po::value<string>(), "directly access mongod data files in the given path, instead of connecting to a mongod instance - needs to lock the data directory, so cannot be used if a mongod is currently accessing the same path" )
("dbpath",po::value<string>(), "directly access mongod data "
"files in the given path, instead of connecting to a mongod "
"instance - needs to lock the data directory, so cannot be "
"used if a mongod is currently accessing the same path" )
("directoryperdb", "if dbpath specified, each db is in a separate directory" )
;
@@ -157,7 +160,17 @@ namespace mongo {
_host = "DIRECT";
static string myDbpath = getParam( "dbpath" );
dbpath = myDbpath.c_str();
acquirePathLock();
try {
acquirePathLock();
}
catch ( DBException& e ){
cerr << endl << "If you are running a mongod on the same "
"path you should connect to that instead of direct data "
"file access" << endl << endl;
dbexit( EXIT_CLEAN );
return -1;
}
theFileAllocator().start();
}