From 1f4ba96c5a1adc591708c9db6afeb555c0d1e4c5 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 7 Feb 2011 23:40:27 -0500 Subject: if there is an old lock file, no journal files, and no dbs present, safe to start --- db/instance.cpp | 28 +++++++++++++++++++++------- 1 file 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 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 { -- cgit v1.2.1