diff options
-rw-r--r-- | src/mongo/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/memconcept.cpp | 140 | ||||
-rw-r--r-- | src/mongo/db/memconcept.h | 80 | ||||
-rw-r--r-- | src/mongo/db/pdfile.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/pdfile.h | 8 | ||||
-rw-r--r-- | src/mongo/db/storage/durable_mapped_file.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/storage/extent_manager.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/storage/record.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/structure/btree/btree.h | 2 | ||||
-rw-r--r-- | src/mongo/util/mmap_win.cpp | 5 |
10 files changed, 3 insertions, 246 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index e64b2253f16..7cd24612e19 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -511,7 +511,6 @@ env.Library('index_set', [ 'db/index_set.cpp' ] ) # libs. serverOnlyFiles = [ "db/curop.cpp", "db/kill_current_op.cpp", - "db/memconcept.cpp", "db/interrupt_status_mongod.cpp", "db/d_globals.cpp", "db/pagefault.cpp", diff --git a/src/mongo/db/memconcept.cpp b/src/mongo/db/memconcept.cpp deleted file mode 100644 index 57cb93f2db6..00000000000 --- a/src/mongo/db/memconcept.cpp +++ /dev/null @@ -1,140 +0,0 @@ - -/** -* Copyright (C) 2012 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/>. -* -* As a special exception, the copyright holders give permission to link the -* code of portions of this program with the OpenSSL library under certain -* conditions as described in each individual source file and distribute -* linked combinations including the program with the OpenSSL library. You -* must comply with the GNU Affero General Public License in all respects for -* all of the code used other than as permitted herein. If you modify file(s) -* with this exception, you may extend this exception to your version of the -* file(s), but you are not obligated to do so. If you do not wish to do so, -* delete this exception statement from your version. If you delete this -* exception statement from all source files in the program, then also delete -* it in the license file. -*/ - -#if 1 - -#define DDD(x) - -#include "mongo/db/memconcept.h" - -#include <boost/functional/hash.hpp> -#include <map> -#include <string> - -#include "mongo/util/assert_util.h" -#include "mongo/util/log.h" -#include "mongo/util/startup_test.h" - -using namespace std; - -namespace mongo { - namespace memconcept { - - concept::concept(const char * desc) : c(desc) { } - - // these string pointers we use as unique identifiers - like enums. thus it is important - // you don't use another with the same literal name - concept concept::err("err"); - concept concept::something("something"); - concept concept::database("database"); - concept concept::other("other"); - concept concept::memorymappedfile("memorymappedfile"); - concept concept::nsdetails("nsdetails"); - concept concept::datafileheader("datafileheader"); - concept concept::extent("extent"); - concept concept::record("record"); - concept concept::deletedrecord("deletedrecord"); - concept concept::btreebucket("btreebucket"); - - class X : public StartupTest { - public: - virtual void run() { - } - } concepttest; - - struct C { - void *p; - unsigned len; - concept c; - char desc[16]; - string toString() const; - }; - - string C::toString() const { - stringstream ss; - ss << p << ' ' << c.toString() << ' ' << len << ' ' << desc; - return ss.str(); - } - - const int N = 100003; - - class map { - C nodes[N]; - boost::hash<void *> h; - public: - C& find(void *p) { - unsigned x = h(p); - return nodes[x % N]; - } - map() { - memset(this, 0, sizeof(*this)); - for( int i = 0; i < N; i++ ) - nodes[i].c = concept::err; - } - void dump(); - } map; - - void map::dump() { - // sort - std::map<void*,C*> m; - for( int i = 0; i < N; i++ ) { - if( nodes[i].p ) { - m[ nodes[i].p ] = &nodes[i]; - } - } - // print - for( std::map<void*,C*>::const_iterator i = m.begin(); i != m.end(); i++ ) { - log() << i->second->toString() << endl; - } - } - -#if 0 && defined(_DEBUG) - bool d = false; - void is(void *p, concept c, const StringData& description, unsigned len) { - DDD( log() << "is " << p << ' ' << c.toString() << ' ' << description.data() << ' ' << len << endl; ) - C &node = map.find(p); - node.p = p; - node.c = c; - node.len = len; - strncpy(node.desc, description.data(), 15); - } - - void invalidate(void *p, unsigned len) { - DDD( log() << "inv " << p << " invalidate" << endl; ) - C &node = map.find(p); - node.p = p; - node.c = concept::err; - // len is not used currently. hmmm. - } -#endif - - } -} - -#endif diff --git a/src/mongo/db/memconcept.h b/src/mongo/db/memconcept.h deleted file mode 100644 index 6088576044a..00000000000 --- a/src/mongo/db/memconcept.h +++ /dev/null @@ -1,80 +0,0 @@ -/** -* Copyright (C) 2012 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/>. -* -* As a special exception, the copyright holders give permission to link the -* code of portions of this program with the OpenSSL library under certain -* conditions as described in each individual source file and distribute -* linked combinations including the program with the OpenSSL library. You -* must comply with the GNU Affero General Public License in all respects for -* all of the code used other than as permitted herein. If you modify file(s) -* with this exception, you may extend this exception to your version of the -* file(s), but you are not obligated to do so. If you do not wish to do so, -* delete this exception statement from your version. If you delete this -* exception statement from all source files in the program, then also delete -* it in the license file. -*/ - - -/* The idea here is to 'name' memory pointers so that we can do diagnostics. - these diagnostics might involve concurrency or other things. mainly would - be for _DEBUG builds. Experimental we'll see how useful. -*/ - -#pragma once - -#include "mongo/base/string_data.h" - -namespace mongo { - namespace memconcept { - - /** these are like fancy enums - you can use them as "types" of things - and see if foo.concept == bar.concept. - copyable. - */ - class concept { - public: - concept() { *this = err; } - const char * toString() const { return c; } - static concept err; - static concept something; - static concept database; - static concept other; - static concept memorymappedfile; - static concept nsdetails; - static concept datafileheader; - static concept extent; - static concept record; - static concept deletedrecord; - static concept btreebucket; - private: - const char * c; - concept(const char *); - }; - - /** file was unmapped or something */ - void invalidate(void *p, unsigned len=0); - - /** note you can be more than one thing; a datafile header is also the starting pointer - for a file */ - void is(void *p, concept c, const StringData& desc = StringData( "", 0 ), unsigned len=0); - -#if 1 -//#if !defined(_DEBUG) - inline void invalidate(void *p, unsigned len) { } - inline void is(void *p, concept c, const StringData& desc, unsigned) { } -#endif - - } -} diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp index 8c24213b95d..919625cf5c4 100644 --- a/src/mongo/db/pdfile.cpp +++ b/src/mongo/db/pdfile.cpp @@ -66,7 +66,6 @@ _ disallow system* manipulations from the database. #include "mongo/db/instance.h" #include "mongo/db/kill_current_op.h" #include "mongo/db/lasterror.h" -#include "mongo/db/memconcept.h" #include "mongo/db/namespace_string.h" #include "mongo/db/ops/delete.h" #include "mongo/db/repl/is_master.h" diff --git a/src/mongo/db/pdfile.h b/src/mongo/db/pdfile.h index e79fac08996..cc1dba7b2b9 100644 --- a/src/mongo/db/pdfile.h +++ b/src/mongo/db/pdfile.h @@ -41,7 +41,6 @@ #include "mongo/db/database.h" #include "mongo/db/diskloc.h" #include "mongo/db/jsobjmanipulator.h" -#include "mongo/db/memconcept.h" #include "mongo/db/storage/data_file.h" #include "mongo/db/storage/durable_mapped_file.h" #include "mongo/db/storage/extent.h" @@ -71,7 +70,6 @@ namespace mongo { inline NamespaceIndex* nsindex(const StringData& ns) { Database *database = cc().database(); verify( database ); - memconcept::is(database, memconcept::concept::database, ns, sizeof(Database)); DEV { StringData dbname = nsToDatabaseSubstring( ns ); if ( database->name() != dbname ) { @@ -86,11 +84,7 @@ namespace mongo { inline NamespaceDetails* nsdetails(const StringData& ns) { // if this faults, did you set the current db first? (Client::Context + dblock) - NamespaceDetails *d = nsindex(ns)->details(ns); - if( d ) { - memconcept::is(d, memconcept::concept::nsdetails, ns, sizeof(NamespaceDetails)); - } - return d; + return nsindex(ns)->details(ns); } BOOST_STATIC_ASSERT( 16 == sizeof(DeletedRecord) ); diff --git a/src/mongo/db/storage/durable_mapped_file.cpp b/src/mongo/db/storage/durable_mapped_file.cpp index 5e491fc7d97..45ebc9d653f 100644 --- a/src/mongo/db/storage/durable_mapped_file.cpp +++ b/src/mongo/db/storage/durable_mapped_file.cpp @@ -40,7 +40,6 @@ #include "mongo/db/d_concurrency.h" #include "mongo/db/dur.h" #include "mongo/db/dur_journalformat.h" -#include "mongo/db/memconcept.h" #include "mongo/util/mongoutils/str.h" using namespace mongoutils; @@ -206,7 +205,6 @@ namespace mongo { LockMongoFilesExclusive lk; privateViews.remove(_view_private); - memconcept::invalidate(_view_private); _view_write = _view_private = 0; MemoryMappedFile::close(); } diff --git a/src/mongo/db/storage/extent_manager.cpp b/src/mongo/db/storage/extent_manager.cpp index b969960c322..bd7b399a227 100644 --- a/src/mongo/db/storage/extent_manager.cpp +++ b/src/mongo/db/storage/extent_manager.cpp @@ -34,7 +34,6 @@ #include "mongo/db/client.h" #include "mongo/db/d_concurrency.h" -#include "mongo/db/memconcept.h" #include "mongo/db/namespace_details.h" #include "mongo/db/storage/data_file.h" #include "mongo/db/storage/extent.h" @@ -224,7 +223,6 @@ namespace mongo { Extent* e = reinterpret_cast<Extent*>( _getOpenFile( loc.a() )->p() + loc.getOfs() ); if ( doSanityCheck ) e->assertOk(); - memconcept::is(e, memconcept::concept::extent); return e; } diff --git a/src/mongo/db/storage/record.cpp b/src/mongo/db/storage/record.cpp index 8daae40519f..99dea97c367 100644 --- a/src/mongo/db/storage/record.cpp +++ b/src/mongo/db/storage/record.cpp @@ -526,16 +526,12 @@ namespace mongo { Record* DiskLoc::rec() const { // XXX-ERH verify(a() != -1); - Record *r = cc().database()->getExtentManager().recordFor( *this ); - memconcept::is(r, memconcept::concept::record); - return r; + return cc().database()->getExtentManager().recordFor( *this ); } DeletedRecord* DiskLoc::drec() const { verify( _a != -1 ); - DeletedRecord* dr = reinterpret_cast<DeletedRecord*>(rec()); - memconcept::is(dr, memconcept::concept::deletedrecord); - return dr; + return reinterpret_cast<DeletedRecord*>(rec()); } Extent* DiskLoc::ext() const { diff --git a/src/mongo/db/structure/btree/btree.h b/src/mongo/db/structure/btree/btree.h index 36a6aa7acaa..8a22e0ebbed 100644 --- a/src/mongo/db/structure/btree/btree.h +++ b/src/mongo/db/structure/btree/btree.h @@ -35,7 +35,6 @@ #include "mongo/db/diskloc.h" #include "mongo/db/dur.h" #include "mongo/db/jsobj.h" -#include "mongo/db/memconcept.h" #include "mongo/db/storage/record.h" #include "mongo/db/structure/btree/key.h" @@ -1078,7 +1077,6 @@ namespace mongo { const BtreeBucket<V> * DiskLoc::btree() const { verify( _a != -1 ); Record *r = rec(); - memconcept::is(r, memconcept::concept::btreebucket, "", 8192); return (const BtreeBucket<V> *) r->data(); } diff --git a/src/mongo/util/mmap_win.cpp b/src/mongo/util/mmap_win.cpp index 71dfc2f0a53..670f645f1a4 100644 --- a/src/mongo/util/mmap_win.cpp +++ b/src/mongo/util/mmap_win.cpp @@ -18,7 +18,6 @@ #include "mongo/pch.h" #include "mongo/db/d_concurrency.h" -#include "mongo/db/memconcept.h" #include "mongo/db/storage/durable_mapped_file.h" #include "mongo/util/file_allocator.h" #include "mongo/util/mmap.h" @@ -82,7 +81,6 @@ namespace mongo { void MemoryMappedFile::close() { LockMongoFilesShared::assertExclusivelyLocked(); for( vector<void*>::iterator i = views.begin(); i != views.end(); i++ ) { - memconcept::invalidate(*i); clearWritableBits(*i); UnmapViewOfFile(*i); } @@ -117,7 +115,6 @@ namespace mongo { << endl; fassertFailed( 16165 ); } - memconcept::is( readOnlyMapAddress, memconcept::concept::other, filename() ); views.push_back( readOnlyMapAddress ); return readOnlyMapAddress; } @@ -211,7 +208,6 @@ namespace mongo { } } views.push_back(view); - memconcept::is(view, memconcept::concept::memorymappedfile, this->filename(), (unsigned) length); len = length; return view; } @@ -290,7 +286,6 @@ namespace mongo { } clearWritableBits( privateMapAddress ); views.push_back( privateMapAddress ); - memconcept::is( privateMapAddress, memconcept::concept::memorymappedfile, filename() ); return privateMapAddress; } |