diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-03-17 00:07:52 +0100 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-03-17 00:07:52 +0100 |
commit | 98b8b639326ab4c89eed73739d9903993c4c8959 (patch) | |
tree | 0462df078bf740093774d033b75f0ea24a31fa97 /db/storage.cpp | |
parent | f5d6e97ca8d2f3e7c4cdd5c9afbf8e756ef65bc2 (diff) | |
parent | 582fc32574a3b158c81e49cb00e6ae59205e66ba (diff) | |
download | mongodb-98b8b639326ab4c89eed73739d9903993c4c8959.tar.gz |
Merge commit 'upstream/1.8.0
Diffstat (limited to 'db/storage.cpp')
-rw-r--r-- | db/storage.cpp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/db/storage.cpp b/db/storage.cpp deleted file mode 100644 index 63e7639..0000000 --- a/db/storage.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// storage.cpp -/* - * Copyright (C) 2010 10gen Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include "pch.h" -#include "pdfile.h" -//#include "reccache.h" -#include "rec.h" -#include "db.h" - -namespace mongo { - -// pick your store for indexes by setting this typedef -// this doesn't need to be an ifdef, we can make it dynamic -#if defined(_RECSTORE) -RecStoreInterface *btreeStore = new CachedBasicRecStore(); -#else -MongoMemMapped_RecStore *btreeStore = new MongoMemMapped_RecStore(); -#endif - -#if 0 - -#if defined(_RECSTORE) - static int inited; -#endif - -void writerThread(); - -void BasicRecStore::init(const char *fn, unsigned recsize) -{ - massert( 10394 , "compile packing problem recstore?", sizeof(RecStoreHeader) == 8192); - filename = fn; - f.open(fn); - uassert( 10130 , string("couldn't open file:")+fn, f.is_open() ); - len = f.len(); - if( len == 0 ) { - log() << "creating recstore file " << fn << '\n'; - h.recsize = recsize; - len = sizeof(RecStoreHeader); - f.write(0, (const char *) &h, sizeof(RecStoreHeader)); - } - else { - f.read(0, (char *) &h, sizeof(RecStoreHeader)); - massert( 10395 , string("recstore was not closed cleanly: ")+fn, h.cleanShutdown==0); - massert( 10396 , string("recstore recsize mismatch, file:")+fn, h.recsize == recsize); - massert( 10397 , string("bad recstore [1], file:")+fn, (h.leof-sizeof(RecStoreHeader)) % recsize == 0); - if( h.leof > len ) { - stringstream ss; - ss << "bad recstore, file:" << fn << " leof:" << h.leof << " len:" << len; - massert( 10398 , ss.str(), false); - } - if( h.cleanShutdown ) - log() << "warning: non-clean shutdown for file " << fn << '\n'; - h.cleanShutdown = 2; - writeHeader(); - f.fsync(); - } -#if defined(_RECSTORE) - if( inited++ == 0 ) { - boost::thread t(writerThread); - } -#endif -} - -#endif - -} |