summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDwight <dwight@10gen.com>2011-04-28 13:36:22 -0400
committerDwight <dwight@10gen.com>2011-04-28 13:36:22 -0400
commit02048643945239f7e17795b0707481cd11f947c4 (patch)
tree31ba18cebfadfaad88908c98486bfa644723e063 /db
parent77f533612ca7eaa54b9c0718e18462bae541c0f9 (diff)
downloadmongo-02048643945239f7e17795b0707481cd11f947c4.tar.gz
fix journal recovery for case when lsn file is zero bytes long
Diffstat (limited to 'db')
-rw-r--r--db/dur_journal.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/db/dur_journal.cpp b/db/dur_journal.cpp
index 1738884006c..b8c259a6763 100644
--- a/db/dur_journal.cpp
+++ b/db/dur_journal.cpp
@@ -486,6 +486,11 @@ namespace mongo {
File f;
f.open(lsnPath().string().c_str());
assert(f.is_open());
+ if( f.len() == 0 ) {
+ // this could be 'normal' if we crashed at the right moment
+ log() << "info lsn file is zero bytes long" << endl;
+ return 0;
+ }
f.read(0,(char*)&L, sizeof(L));
unsigned long long lsn = L.get();
return lsn;