From d48a16161eac5f462e4e0b453dc9bdd9c5683070 Mon Sep 17 00:00:00 2001 From: dwight Date: Mon, 13 Sep 2010 08:31:28 -0400 Subject: [PATCH] for testing --- db/namespace.cpp | 6 +++--- pch.h | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/db/namespace.cpp b/db/namespace.cpp index b3ab3cbae51..682300a7dd8 100644 --- a/db/namespace.cpp +++ b/db/namespace.cpp @@ -133,8 +133,8 @@ namespace mongo { boost::filesystem::path nsPath = path(); string pathString = nsPath.string(); MMF::Pointer p; - if( MMF::exists(nsPath) ) { - p = f.map(pathString.c_str()); + if( MMF::exists(nsPath) ) { + p = f.mapWithOptions(pathString.c_str(), durable?MMF::READONLY:0); if( !p.isNull() ) { len = f.length(); if ( len % (1024*1024) != 0 ){ @@ -148,7 +148,7 @@ namespace mongo { massert( 10343 , "bad lenForNewNsFiles", lenForNewNsFiles >= 1024*1024 ); maybeMkdir(); unsigned long long l = lenForNewNsFiles; - p = f.map(pathString.c_str(), l); + p = f.map(pathString.c_str(), l, durable?MMF::READONLY:0); if( !p.isNull() ) { len = l; assert( len == lenForNewNsFiles ); diff --git a/pch.h b/pch.h index a6b4b63c0b7..f2c623fd883 100644 --- a/pch.h +++ b/pch.h @@ -93,6 +93,14 @@ namespace mongo { + /* this likely goes away later. to facilitate testing for a while without impacting other things. */ +#if defined(_DURABLE) + const bool durable = true; +#error don't use this yet +#else + const bool durable = false; +#endif + using namespace std; using boost::shared_ptr;