diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-02-07 23:40:27 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-02-07 23:40:27 -0500 |
commit | 1f4ba96c5a1adc591708c9db6afeb555c0d1e4c5 (patch) | |
tree | 4a62db6a908b04588e6ec9b59e0c8b8bd63c3c7c /db/instance.cpp | |
parent | 256e52081dd1cf0873aaf9f37d57892fa12d6082 (diff) | |
download | mongo-1f4ba96c5a1adc591708c9db6afeb555c0d1e4c5.tar.gz |
if there is an old lock file, no journal files, and no dbs present, safe to start
Diffstat (limited to 'db/instance.cpp')
-rw-r--r-- | db/instance.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/db/instance.cpp b/db/instance.cpp index 65e422c5a40..36639c1fab3 100644 --- a/db/instance.cpp +++ b/db/instance.cpp @@ -885,16 +885,30 @@ namespace mongo { if ( oldFile ) { // we check this here because we want to see if we can get the lock // if we can't, then its probably just another mongod running - + string errmsg; if (cmdLine.dur) { if (!dur::haveJournalFiles()) { - errmsg = str::stream() - << "************** \n" - << "old lock file: " << name << ". probably means unclean shutdown\n" - << "but there are no journal files to recover.\n" - << "see: http://dochub.mongodb.org/core/repair for more information\n" - << "*************"; + + vector<string> dbnames; + getDatabaseNames( dbnames ); + + if ( dbnames.size() == 0 ) { + // this means that mongod crashed + // between initial startup and when journaling was initialized + // it is safe to continue + } + else { + errmsg = str::stream() + << "************** \n" + << "old lock file: " << name << ". probably means unclean shutdown\n" + << "but there are no journal files to recover.\n" + << "this is likely human error of filesystem corruption.\n" + << "see: http://dochub.mongodb.org/core/repair for more information\n" + << "*************"; + } + + } } else { |