diff options
author | Dwight <dmerriman@gmail.com> | 2009-02-02 18:18:22 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2009-02-02 18:18:22 -0500 |
commit | d1ba9dfb497031952f774c7972fdeea4d2992189 (patch) | |
tree | 9a5cd8bd0be45a9efe4eb727be9005cd495595bc | |
parent | c8acc4ac0a0d6dba77435768fbc61cc40f55e8c9 (diff) | |
download | mongo-d1ba9dfb497031952f774c7972fdeea4d2992189.tar.gz |
datastore work
-rw-r--r-- | SConstruct | 2 | ||||
-rw-r--r-- | db/btree.cpp | 45 | ||||
-rw-r--r-- | db/btree.h | 3 | ||||
-rw-r--r-- | db/db.cpp | 5 | ||||
-rw-r--r-- | db/db.h | 6 | ||||
-rw-r--r-- | db/db.vcproj | 1760 | ||||
-rw-r--r-- | db/instance.cpp | 12 | ||||
-rw-r--r-- | db/namespace.cpp | 5 | ||||
-rw-r--r-- | db/rec.h | 14 | ||||
-rw-r--r-- | db/reccache.h | 121 | ||||
-rw-r--r-- | db/reci.h | 2 | ||||
-rw-r--r-- | db/recstore.h | 114 | ||||
-rw-r--r-- | db/storage.cpp | 108 | ||||
-rw-r--r-- | db/storage.h | 19 | ||||
-rw-r--r-- | jstests/index_check1.js | 9 | ||||
-rw-r--r-- | stdafx.cpp | 4 | ||||
-rw-r--r-- | stdafx.h | 4 |
17 files changed, 1244 insertions, 989 deletions
diff --git a/SConstruct b/SConstruct index 2c7e4efc246..5455048dc7a 100644 --- a/SConstruct +++ b/SConstruct @@ -113,7 +113,7 @@ else: coreDbFiles = Split( "" ) -serverOnlyFiles = Split( "db/query.cpp db/introspect.cpp db/btree.cpp db/clientcursor.cpp db/javajs.cpp db/tests.cpp db/repl.cpp db/btreecursor.cpp db/cloner.cpp db/namespace.cpp db/matcher.cpp db/dbcommands.cpp db/dbeval.cpp db/dbwebserver.cpp db/dbinfo.cpp db/dbhelpers.cpp db/instance.cpp db/pdfile.cpp db/cursor.cpp db/security_commands.cpp db/security.cpp util/miniwebserver.cpp" ) +serverOnlyFiles = Split( "db/query.cpp db/introspect.cpp db/btree.cpp db/clientcursor.cpp db/javajs.cpp db/tests.cpp db/repl.cpp db/btreecursor.cpp db/cloner.cpp db/namespace.cpp db/matcher.cpp db/dbcommands.cpp db/dbeval.cpp db/dbwebserver.cpp db/dbinfo.cpp db/dbhelpers.cpp db/instance.cpp db/pdfile.cpp db/cursor.cpp db/security_commands.cpp db/security.cpp util/miniwebserver.cpp db/storage.cpp" ) allClientFiles = commonFiles + coreDbFiles + [ "client/clientOnly.cpp" ]; diff --git a/db/btree.cpp b/db/btree.cpp index 417cc9c289f..64f84c9ca83 100644 --- a/db/btree.cpp +++ b/db/btree.cpp @@ -22,9 +22,6 @@ namespace mongo { - /* this will be an assertion check later for RecStoreInterface compliance checking */ - inline void written() { } - const int KeyMax = BucketSize / 10; int ninserts = 0; @@ -39,6 +36,11 @@ namespace mongo { /* BucketBasics --------------------------------------------------- */ + inline void BucketBasics::modified(const DiskLoc& thisLoc) { + dassert( thisLoc.btree() == this ); + BtreeStore::modified(thisLoc); + } + int BucketBasics::Size() const { assert( _Size == BucketSize ); return _Size; @@ -179,7 +181,6 @@ namespace mongo { the keynodes grow from the front. */ inline int BucketBasics::_alloc(int bytes) { - written(); topSize += bytes; emptySize -= bytes; int ofs = totalDataSize() - topSize; @@ -190,7 +191,6 @@ namespace mongo { void BucketBasics::_delKeyAtPos(int keypos) { assert( keypos >= 0 && keypos <= n ); assert( childForPos(keypos).isNull() ); - written(); n--; assert( n > 0 || nextChild.isNull() ); for ( int j = keypos; j < n; j++ ) @@ -201,7 +201,6 @@ namespace mongo { /* add a key. must be > all existing. be careful to set next ptr right. */ void BucketBasics::pushBack(const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order, DiskLoc prevChild) { - written(); int bytesNeeded = key.objsize() + sizeof(_KeyNode); assert( bytesNeeded <= emptySize ); assert( n == 0 || keyNode(n-1).key.woCompare(key, order) <= 0 ); @@ -214,8 +213,9 @@ namespace mongo { memcpy(p, key.objdata(), key.objsize()); } - bool BucketBasics::basicInsert(int keypos, const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order) { - written(); + /* insert a key in a bucket with no complexity -- no splits required */ + bool BucketBasics::basicInsert(const DiskLoc& thisLoc, int keypos, const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order) { + modified(thisLoc); assert( keypos >= 0 && keypos <= n ); int bytesNeeded = key.objsize() + sizeof(_KeyNode); if ( bytesNeeded > emptySize ) { @@ -243,7 +243,6 @@ namespace mongo { if ( flags & Packed ) return; - written(); int tdz = totalDataSize(); char temp[BucketSize]; int ofs = tdz; @@ -269,7 +268,6 @@ namespace mongo { n = N; setNotPacked(); pack( order ); - written(); } /* - BtreeBucket --------------------------------------------------- */ @@ -359,9 +357,8 @@ namespace mongo { void BtreeBucket::delBucket(const DiskLoc& thisLoc, IndexDetails& id) { aboutToDeleteBucket(thisLoc); assert( !isHead() ); - written(); - BtreeBucket *p = parent.btree(); + BtreeBucket *p = parent.btreemod(); if ( p->nextChild == thisLoc ) { p->nextChild.Null(); } @@ -385,6 +382,7 @@ found: it (meaning it is ineligible for reuse). */ memset(this, 0, Size()); + modified(thisLoc); #else //defensive: n = -1; @@ -399,8 +397,7 @@ found: /* note: may delete the entire bucket! this invalid upon return sometimes. */ void BtreeBucket::delKeyAtPos(const DiskLoc& thisLoc, IndexDetails& id, int p) { - written(); - dassert( thisLoc.btree() == this ); + modified(thisLoc); assert(n>0); DiskLoc left = childForPos(p); @@ -451,7 +448,7 @@ found: if ( !child.isNull() ) { if ( insert_debug ) out() << " " << child.toString() << ".parent=" << thisLoc.toString() << endl; - child.btree()->parent = thisLoc; + child.btreemod()->parent = thisLoc; } } @@ -463,20 +460,21 @@ found: fix(thisLoc, k(i).prevChildBucket); } - /* keypos - where to insert the key i3n range 0..n. 0=make leftmost, n=make rightmost. + /* insert a key in this bucket, splitting if necessary. + keypos - where to insert the key i3n range 0..n. 0=make leftmost, n=make rightmost. */ void BtreeBucket::insertHere(DiskLoc thisLoc, int keypos, DiskLoc recordLoc, BSONObj& key, const BSONObj& order, DiskLoc lchild, DiskLoc rchild, IndexDetails& idx) { - dassert( thisLoc.btree() == this ); + modified(thisLoc); if ( insert_debug ) out() << " " << thisLoc.toString() << ".insertHere " << key.toString() << '/' << recordLoc.toString() << ' ' << lchild.toString() << ' ' << rchild.toString() << " keypos:" << keypos << endl; DiskLoc oldLoc = thisLoc; - if ( basicInsert(keypos, recordLoc, key, order) ) { + if ( basicInsert(thisLoc, keypos, recordLoc, key, order) ) { _KeyNode& kn = k(keypos); if ( keypos+1 == n ) { // last key if ( nextChild != lchild ) { @@ -499,7 +497,7 @@ found: assert( kn.prevChildBucket == lchild ); nextChild = rchild; if ( !rchild.isNull() ) - rchild.btree()->parent = thisLoc; + rchild.btreemod()->parent = thisLoc; } else { k(keypos).prevChildBucket = lchild; @@ -521,12 +519,13 @@ found: } k(keypos+1).prevChildBucket = rchild; if ( !rchild.isNull() ) - rchild.btree()->parent = thisLoc; + rchild.btreemod()->parent = thisLoc; } return; } - // split + /* ---------- split ---------------- */ + if ( split_debug ) out() << " " << thisLoc.toString() << ".split" << endl; @@ -569,12 +568,12 @@ found: if ( split_debug ) out() << " we were root, making new root:" << hex << parent.getOfs() << dec << endl; free(p); - rLoc.btree()->parent = parent; + rLoc.btreemod()->parent = parent; } else { /* set this before calling _insert - if it splits it will do fixParent() logic and change the value. */ - rLoc.btree()->parent = parent; + rLoc.btreemod()->parent = parent; if ( split_debug ) out() << " promoting middle key " << middle.key.toString() << endl; parent.btree()->_insert(parent, middle.recordLoc, middle.key, order, /*dupsallowed*/true, thisLoc, rLoc, idx); diff --git a/db/btree.h b/db/btree.h index de4cccf8369..c2652b26140 100644 --- a/db/btree.h +++ b/db/btree.h @@ -82,6 +82,7 @@ namespace mongo { void assertValid(const BSONObj &order, bool force = false); int fullValidate(const DiskLoc& thisLoc, const BSONObj &order); /* traverses everything */ protected: + void modified(const DiskLoc& thisLoc); DiskLoc& getChild(int pos) { assert( pos >= 0 && pos <= n ); return pos == n ? nextChild : k(pos).prevChildBucket; @@ -100,7 +101,7 @@ namespace mongo { /* returns false if node is full and must be split keypos is where to insert -- inserted after that key #. so keypos=0 is the leftmost one. */ - bool basicInsert(int keypos, const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order); + bool basicInsert(const DiskLoc& thisLoc, int keypos, const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order); void pushBack(const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order, DiskLoc prevChild); void _delKeyAtPos(int keypos); // low level version that doesn't deal with child ptrs. diff --git a/db/db.cpp b/db/db.cpp index 6198d3b3801..f234ccd3d54 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -313,6 +313,8 @@ namespace mongo { log() << "opLogging = " << opLogging << endl; _oplog.init(); + RecCache::tempStore.init("/data/db/indexes.dat", BucketSize); + #if !defined(_WIN32) assert( signal(SIGSEGV, segvhandler) != SIG_ERR ); #endif @@ -619,3 +621,6 @@ namespace mongo { #endif } // namespace mongo + +#include "recstore.h" +#include "reccache.h" @@ -67,10 +67,16 @@ namespace mongo { } }; + void dbunlocked(); + struct dblock : public lock { dblock() : lock( dbMutex, dbMutexInfo ) { } + ~dblock() { + /* todo: this should be inlined */ + dbunlocked(); + } }; } // namespace mongo diff --git a/db/db.vcproj b/db/db.vcproj index 42c2e3593d8..f236937d050 100644 --- a/db/db.vcproj +++ b/db/db.vcproj @@ -256,131 +256,41 @@ </References>
<Files>
<Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ Name="misc and third party"
>
<File
- RelativePath=".\btree.cpp"
- >
- </File>
- <File
- RelativePath=".\btreecursor.cpp"
- >
- </File>
- <File
- RelativePath=".\clientcursor.cpp"
- >
- </File>
- <File
- RelativePath=".\cloner.cpp"
- >
- </File>
- <File
- RelativePath=".\commands.cpp"
- >
- </File>
- <File
- RelativePath=".\cursor.cpp"
- >
- </File>
- <File
- RelativePath=".\db.cpp"
- >
- </File>
- <File
- RelativePath=".\dbcommands.cpp"
- >
- </File>
- <File
- RelativePath=".\dbeval.cpp"
- >
- </File>
- <File
- RelativePath=".\dbhelpers.cpp"
- >
- </File>
- <File
- RelativePath=".\dbinfo.cpp"
- >
- </File>
- <File
- RelativePath=".\dbwebserver.cpp"
- >
- </File>
- <File
- RelativePath=".\instance.cpp"
- >
- </File>
- <File
- RelativePath=".\introspect.cpp"
- >
- </File>
- <File
- RelativePath=".\javajs.cpp"
- >
- </File>
- <File
- RelativePath=".\jsobj.cpp"
- >
- </File>
- <File
- RelativePath=".\json.cpp"
- >
- </File>
- <File
- RelativePath=".\lasterror.cpp"
- >
- </File>
- <File
- RelativePath=".\matcher.cpp"
- >
- </File>
- <File
- RelativePath="..\util\mmap_win.cpp"
- >
- </File>
- <File
- RelativePath=".\namespace.cpp"
- >
- </File>
- <File
- RelativePath=".\nonce.cpp"
- >
- </File>
- <File
- RelativePath=".\pdfile.cpp"
- >
- </File>
- <File
- RelativePath=".\query.cpp"
- >
- </File>
- <File
- RelativePath=".\queryoptimizer.cpp"
+ RelativePath="..\..\boostw\boost_1_34_1\boost\config\auto_link.hpp"
>
</File>
<File
- RelativePath=".\repl.cpp"
+ RelativePath=".\db.rc"
>
</File>
<File
- RelativePath=".\security.cpp"
+ RelativePath="C:\Program Files\Java\jdk\lib\jvm.lib"
>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath=".\security_commands.cpp"
+ RelativePath=".\makefile"
>
</File>
<File
- RelativePath="..\stdafx.cpp"
+ RelativePath="..\pcre-7.4\pcrecpp.cc"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
+ UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
@@ -388,7 +298,7 @@ >
<Tool
Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
+ UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
@@ -396,23 +306,35 @@ >
<Tool
Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
+ UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
- RelativePath=".\tests.cpp"
+ RelativePath="..\pcre-7.4\pcrecpp.h"
+ >
+ </File>
+ <File
+ RelativePath="..\targetver.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\boostw\boost_1_34_1\boost\version.hpp"
>
</File>
<Filter
- Name="util"
+ Name="pcre"
>
<File
- RelativePath="..\util\background.cpp"
+ RelativePath="..\pcre-7.4\config.h"
>
</File>
<File
- RelativePath="..\util\md5.c"
+ RelativePath="..\pcre-7.4\pcre.h"
+ >
+ </File>
+ <File
+ RelativePath="..\pcre-7.4\pcre_chartables.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -440,7 +362,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\util\md5main.c"
+ RelativePath="..\pcre-7.4\pcre_compile.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -468,974 +390,1048 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\grid\message.cpp"
+ RelativePath="..\pcre-7.4\pcre_config.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\miniwebserver.cpp"
+ RelativePath="..\pcre-7.4\pcre_dfa_exec.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\mmap.cpp"
+ RelativePath="..\pcre-7.4\pcre_exec.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\sock.cpp"
+ RelativePath="..\pcre-7.4\pcre_fullinfo.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\util.cpp"
+ RelativePath="..\pcre-7.4\pcre_get.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
- </Filter>
- <Filter
- Name="client"
- >
<File
- RelativePath="..\client\dbclient.cpp"
+ RelativePath="..\pcre-7.4\pcre_globals.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
- </Filter>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <Filter
- Name="util"
- >
<File
- RelativePath="..\util\builder.h"
+ RelativePath="..\pcre-7.4\pcre_info.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\goodies.h"
+ RelativePath="..\pcre-7.4\pcre_maketables.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\hashtab.h"
+ RelativePath="..\pcre-7.4\pcre_newline.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath=".\lasterror.h"
+ RelativePath="..\pcre-7.4\pcre_ord2utf8.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\log.h"
+ RelativePath="..\pcre-7.4\pcre_refcount.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\lruishmap.h"
+ RelativePath="..\pcre-7.4\pcre_scanner.cc"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\md5.h"
+ RelativePath="..\pcre-7.4\pcre_stringpiece.cc"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\md5.hpp"
+ RelativePath="..\pcre-7.4\pcre_study.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\miniwebserver.h"
+ RelativePath="..\pcre-7.4\pcre_tables.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\mmap.h"
+ RelativePath="..\pcre-7.4\pcre_try_flipped.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\sock.h"
+ RelativePath="..\pcre-7.4\pcre_ucp_searchfuncs.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\util\unittest.h"
+ RelativePath="..\pcre-7.4\pcre_valid_utf8.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
- </Filter>
- <Filter
- Name="client"
- >
<File
- RelativePath="..\client\connpool.h"
+ RelativePath="..\pcre-7.4\pcre_version.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\client\dbclient.h"
+ RelativePath="..\pcre-7.4\pcre_xclass.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath="..\client\model.h"
+ RelativePath="..\pcre-7.4\pcreposix.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
</File>
</Filter>
+ </Filter>
+ <Filter
+ Name="btree related"
+ >
+ <File
+ RelativePath=".\btree.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\btree.h"
+ >
+ </File>
+ <File
+ RelativePath=".\btreecursor.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="storage related"
+ >
+ <File
+ RelativePath=".\rec.h"
+ >
+ </File>
+ <File
+ RelativePath=".\reccache.h"
+ >
+ </File>
+ <File
+ RelativePath=".\reci.h"
+ >
+ </File>
+ <File
+ RelativePath=".\recstore.h"
+ >
+ </File>
+ <File
+ RelativePath=".\storage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\storage.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="client"
+ >
+ <File
+ RelativePath="..\client\connpool.h"
+ >
+ </File>
+ <File
+ RelativePath="..\client\dbclient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\client\dbclient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\client\model.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="db"
+ >
+ <File
+ RelativePath=".\clientcursor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\commands.h"
+ >
+ </File>
+ <File
+ RelativePath=".\curop.h"
+ >
+ </File>
+ <File
+ RelativePath=".\cursor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\database.h"
+ >
+ </File>
+ <File
+ RelativePath=".\db.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dbhelpers.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dbinfo.h"
+ >
+ </File>
+ <File
+ RelativePath=".\dbmessage.h"
+ >
+ </File>
+ <File
+ RelativePath=".\introspect.h"
+ >
+ </File>
+ <File
+ RelativePath=".\javajs.h"
+ >
+ </File>
+ <File
+ RelativePath=".\jsobj.h"
+ >
+ </File>
+ <File
+ RelativePath=".\json.h"
+ >
+ </File>
+ <File
+ RelativePath=".\matcher.h"
+ >
+ </File>
+ <File
+ RelativePath="..\grid\message.h"
+ >
+ </File>
+ <File
+ RelativePath=".\minilex.h"
+ >
+ </File>
+ <File
+ RelativePath=".\namespace.h"
+ >
+ </File>
+ <File
+ RelativePath=".\pdfile.h"
+ >
+ </File>
+ <File
+ RelativePath="..\grid\protocol.h"
+ >
+ </File>
+ <File
+ RelativePath=".\query.h"
+ >
+ </File>
+ <File
+ RelativePath=".\queryoptimizer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\repl.h"
+ >
+ </File>
+ <File
+ RelativePath=".\replset.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\scanandorder.h"
+ >
+ </File>
+ <File
+ RelativePath=".\security.h"
+ >
+ </File>
+ <File
+ RelativePath="..\stdafx.h"
+ >
+ </File>
<Filter
- Name="db"
+ Name="cpp"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
- RelativePath=".\btree.h"
- >
- </File>
- <File
- RelativePath=".\clientcursor.h"
- >
- </File>
- <File
- RelativePath=".\commands.h"
- >
- </File>
- <File
- RelativePath=".\curop.h"
- >
- </File>
- <File
- RelativePath=".\cursor.h"
+ RelativePath=".\clientcursor.cpp"
>
</File>
<File
- RelativePath=".\database.h"
+ RelativePath=".\cloner.cpp"
>
</File>
<File
- RelativePath=".\db.h"
+ RelativePath=".\commands.cpp"
>
</File>
<File
- RelativePath=".\dbhelpers.h"
+ RelativePath=".\cursor.cpp"
>
</File>
<File
- RelativePath=".\dbinfo.h"
+ RelativePath=".\db.cpp"
>
</File>
<File
- RelativePath=".\dbmessage.h"
+ RelativePath=".\dbcommands.cpp"
>
</File>
<File
- RelativePath=".\introspect.h"
+ RelativePath=".\dbeval.cpp"
>
</File>
<File
- RelativePath=".\javajs.h"
+ RelativePath=".\dbhelpers.cpp"
>
</File>
<File
- RelativePath=".\jsobj.h"
+ RelativePath=".\dbinfo.cpp"
>
</File>
<File
- RelativePath=".\json.h"
+ RelativePath=".\dbwebserver.cpp"
>
</File>
<File
- RelativePath=".\matcher.h"
+ RelativePath=".\instance.cpp"
>
</File>
<File
- RelativePath="..\grid\message.h"
+ RelativePath=".\introspect.cpp"
>
</File>
<File
- RelativePath=".\minilex.h"
+ RelativePath=".\javajs.cpp"
>
</File>
<File
- RelativePath=".\namespace.h"
+ RelativePath=".\jsobj.cpp"
>
</File>
<File
- RelativePath=".\pdfile.h"
+ RelativePath=".\json.cpp"
>
</File>
<File
- RelativePath="..\grid\protocol.h"
+ RelativePath=".\lasterror.cpp"
>
</File>
<File
- RelativePath=".\query.h"
+ RelativePath=".\matcher.cpp"
>
</File>
<File
- RelativePath=".\queryoptimizer.h"
+ RelativePath="..\util\mmap_win.cpp"
>
</File>
<File
- RelativePath=".\rec.h"
+ RelativePath=".\namespace.cpp"
>
</File>
<File
- RelativePath=".\reci.h"
+ RelativePath=".\nonce.cpp"
>
</File>
<File
- RelativePath=".\recstore.h"
+ RelativePath=".\pdfile.cpp"
>
</File>
<File
- RelativePath=".\repl.h"
+ RelativePath=".\query.cpp"
>
</File>
<File
- RelativePath=".\replset.h"
+ RelativePath=".\queryoptimizer.cpp"
>
</File>
<File
- RelativePath=".\resource.h"
+ RelativePath=".\repl.cpp"
>
</File>
<File
- RelativePath=".\scanandorder.h"
+ RelativePath=".\security.cpp"
>
</File>
<File
- RelativePath=".\security.h"
+ RelativePath=".\security_commands.cpp"
>
</File>
<File
- RelativePath="..\stdafx.h"
+ RelativePath="..\stdafx.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
</File>
<File
- RelativePath=".\storage.h"
+ RelativePath=".\tests.cpp"
>
</File>
</Filter>
</Filter>
<Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ Name="util"
>
<File
- RelativePath=".\db.rc"
+ RelativePath="..\util\builder.h"
>
</File>
<File
- RelativePath="..\targetver.h"
+ RelativePath="..\util\goodies.h"
>
</File>
- </Filter>
- <Filter
- Name="misc"
- >
<File
- RelativePath="..\..\boostw\boost_1_34_1\boost\config\auto_link.hpp"
+ RelativePath="..\util\hashtab.h"
>
</File>
<File
- RelativePath="C:\Program Files\Java\jdk\lib\jvm.lib"
+ RelativePath=".\lasterror.h"
>
- <FileConfiguration
- Name="release_nojni|Win32"
- ExcludedFromBuild="true"
- >
- <Tool
- Name="VCCustomBuildTool"
- />
- </FileConfiguration>
</File>
<File
- RelativePath=".\makefile"
+ RelativePath="..\util\log.h"
>
</File>
<File
- RelativePath="..\pcre-7.4\pcrecpp.cc"
+ RelativePath="..\util\lruishmap.h"
>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
- RelativePath="..\pcre-7.4\pcrecpp.h"
+ RelativePath="..\util\md5.h"
>
</File>
<File
- RelativePath="..\..\boostw\boost_1_34_1\boost\version.hpp"
+ RelativePath="..\util\md5.hpp"
>
</File>
- </Filter>
- <Filter
- Name="libs_etc"
- >
- </Filter>
- <Filter
- Name="pcre"
- >
<File
- RelativePath="..\pcre-7.4\config.h"
+ RelativePath="..\util\miniwebserver.h"
>
</File>
<File
- RelativePath="..\pcre-7.4\pcre.h"
+ RelativePath="..\util\mmap.h"
>
</File>
<File
- RelativePath="..\pcre-7.4\pcre_chartables.c"
+ RelativePath="..\util\sock.h"
>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
- RelativePath="..\pcre-7.4\pcre_compile.c"
+ RelativePath="..\util\unittest.h"
>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
- <File
- RelativePath="..\pcre-7.4\pcre_config.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_dfa_exec.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_exec.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_fullinfo.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_get.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_globals.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_info.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_maketables.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_newline.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_ord2utf8.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_refcount.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_scanner.cc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_stringpiece.cc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_study.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_tables.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_try_flipped.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_ucp_searchfuncs.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_valid_utf8.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_version.c"
+ <Filter
+ Name="cpp"
>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
+ <File
+ RelativePath="..\util\background.cpp"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
+ </File>
+ <File
+ RelativePath="..\util\md5.c"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcre_xclass.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\util\md5main.c"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="release_nojni|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\grid\message.cpp"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
+ </File>
+ <File
+ RelativePath="..\util\miniwebserver.cpp"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\pcre-7.4\pcreposix.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
+ </File>
+ <File
+ RelativePath="..\util\mmap.cpp"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
+ </File>
+ <File
+ RelativePath="..\util\sock.cpp"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
+ </File>
+ <File
+ RelativePath="..\util\util.cpp"
>
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- </File>
+ </File>
+ </Filter>
</Filter>
</Files>
<Globals>
diff --git a/db/instance.cpp b/db/instance.cpp index 6a6464ad73f..43fccf77a57 100644 --- a/db/instance.cpp +++ b/db/instance.cpp @@ -28,6 +28,7 @@ #include "security.h" #include "curop.h" #include "json.h" +#include "reccache.h" namespace mongo { @@ -51,6 +52,7 @@ namespace mongo { 7 = log a few reads, and all writes. */ int opLogging = 0; + int getOpLogging() { return opLogging; } @@ -62,7 +64,10 @@ namespace mongo { void closeAllSockets(); void flushOpLog() { - _oplog.flush(); + if( _oplog.f && _oplog.f->is_open() ) { + out() << "flushing op log and files" << endl; + _oplog.flush(); + } } int ctr = 0; @@ -586,17 +591,20 @@ namespace mongo { } DBDirectClient::AlwaysAuthorized DBDirectClient::Authorizer::always; + + void recCacheCloseAll(); /* not using log() herein in case we are called from segvhandler and we were already locked */ #undef exit void dbexit(int rc, const char *why) { - out() << "dbexit: " << why << "; flushing op log and files" << endl; + if( why && *why ) out() << "dbexit: " << why << endl; flushOpLog(); /* must do this before unmapping mem or you may get a seg fault */ closeAllSockets(); MemoryMappedFile::closeAllFiles(); + recCacheCloseAll(); out() << "dbexit: really exiting now" << endl; ::exit(rc); } diff --git a/db/namespace.cpp b/db/namespace.cpp index 519f1de9fab..5d0be13a97a 100644 --- a/db/namespace.cpp +++ b/db/namespace.cpp @@ -195,11 +195,12 @@ namespace mongo { cur.Null(); } else { - if ( r->nextDeleted.getOfs() == 0 ) { + /*this defensive check only made sense for the mmap storage engine: + if ( r->nextDeleted.getOfs() == 0 ) { problem() << "~~ Assertion - bad nextDeleted " << r->nextDeleted.toString() << " b:" << b << " chain:" << chain << ", fixing.\n"; r->nextDeleted.Null(); - } + }*/ cur = r->nextDeleted; prev = &r->nextDeleted; } @@ -3,6 +3,7 @@ #pragma once #include "reci.h" +#include "reccache.h" namespace mongo { @@ -16,6 +17,8 @@ public: static DiskLoc insert(const char *ns, const void *obuf, int len, bool god) { return theDataFileMgr.insert(ns, obuf, len, god); } + + static void modified(DiskLoc d) { } }; /* An in memory RecStoreInterface implementation @@ -47,6 +50,8 @@ public: return DiskLoc(INMEMFILE, b); #endif } + + static void modified(DiskLoc d) { } }; /* Glue btree to RecStoreInterface @@ -54,6 +59,7 @@ public: // pick your store for indexes by setting this typedef typedef MongoMemMapped_RecStore BtreeStore; +//typedef BasicCached_RecStore BtreeStore; //typedef InMem_RecStore BtreeStore; const int BucketSize = 8192; @@ -63,6 +69,12 @@ inline BtreeBucket* DiskLoc::btree() const { return (BtreeBucket*) BtreeStore::get(*this, BucketSize); } +inline BtreeBucket* DiskLoc::btreemod() const { + assert( fileNo != -1 ); + BtreeBucket *b = (BtreeBucket*) BtreeStore::get(*this, BucketSize); + BtreeStore::modified(*this); + return b; +} + } -#include "recstore.h" diff --git a/db/reccache.h b/db/reccache.h new file mode 100644 index 00000000000..7c0ea355088 --- /dev/null +++ b/db/reccache.h @@ -0,0 +1,121 @@ +// reccache.h
+
+#pragma once
+
+#include "reci.h"
+#include "recstore.h"
+
+namespace mongo {
+
+class RecCache {
+ struct Node {
+ Node() { dirty = false; newer = 0; }
+ char *data;
+ DiskLoc loc;
+ bool dirty;
+ Node *older, *newer;
+ };
+ unsigned recsize;
+ map<DiskLoc, Node*> m;
+ list<DiskLoc> dirtyl;
+ Node *newest, *oldest;
+ unsigned nnodes;
+public:
+ static BasicRecStore tempStore;
+ void writeDirty();
+ void ejectOld();
+private:
+ void writeIfDirty(Node *n);
+ void touch(Node* n) {
+ if( n == newest )
+ return;
+ if( n == oldest ) {
+ oldest = oldest->newer;
+ }
+ if( n->older )
+ n->older->newer = n->newer;
+ if( n->newer )
+ n->newer->older = n->older;
+ n->newer = 0;
+ n->older = newest;
+ newest = n;
+ }
+ Node* mkNode() {
+ Node *n = new Node();
+ n->data = (char *) calloc(recsize,1); // calloc is TEMP for testing. change to malloc
+ n->older = newest;
+ if( nnodes )
+ newest->newer = n;
+ else
+ oldest = n;
+ newest = n;
+ nnodes++;
+ return n;
+ }
+ fileofs fileOfs(DiskLoc d) {
+ // temp impl
+ return d.getOfs();
+ }
+public:
+ RecCache(unsigned sz) : recsize(sz) {
+ nnodes = 0;
+ newest = oldest = 0;
+ }
+
+ void dirty(DiskLoc d) {
+ map<DiskLoc, Node*>::iterator i = m.find(d);
+ if( i != m.end() ) {
+ Node *n = i->second;
+ if( !n->dirty ) {
+ n->dirty = true;
+ dirtyl.push_back(n->loc);
+ }
+ }
+ }
+
+ char* get(DiskLoc d, unsigned len) {
+ assert( d.a() == 9999 );
+ assert( len == recsize );
+ map<DiskLoc, Node*>::iterator i = m.find(d);
+ if( i != m.end() ) {
+ touch(i->second);
+ return i->second->data;
+ }
+
+ Node *n = mkNode();
+ n->loc = d;
+ tempStore.get(fileOfs(d), n->data, recsize); // could throw exception
+ m.insert( pair<DiskLoc, Node*>(d, n) );
+ return n->data;
+ }
+
+ DiskLoc insert(const char *ns, const void *obuf, int len, bool god) {
+ fileofs o = tempStore.insert((const char *) obuf, len);
+ assert( o <= 0x7fffffff );
+ Node *n = mkNode();
+ memcpy(n->data, obuf, len);
+ DiskLoc d(9999, (int) o);
+ n->loc = d;
+ m[d] = n;
+ return d;
+ }
+};
+
+class BasicCached_RecStore : public RecStoreInterface { +public: + static RecCache rc; + static char* get(DiskLoc d, unsigned len) { + return rc.get(d, len); + } + + static DiskLoc insert(const char *ns, const void *obuf, int len, bool god) { + return rc.insert(ns, obuf, len, god); + } + + static void modified(DiskLoc d) { + assert( d.a() == 9999 ); + rc.dirty(d); + } +}; +
+} /*namespace*/
diff --git a/db/reci.h b/db/reci.h index b0499dc049e..e220304da81 100644 --- a/db/reci.h +++ b/db/reci.h @@ -10,6 +10,8 @@ class RecStoreInterface { public: static char* get(DiskLoc d, unsigned len) { assert(false); return 0; } + static void modified(DiskLoc d) { assert(false); } + /* insert specified data as a record */ static DiskLoc insert(const char *ns, const void *obuf, int len, bool god) { assert(false); return DiskLoc(); } diff --git a/db/recstore.h b/db/recstore.h index bdb526ae58e..5a36a47e2a2 100644 --- a/db/recstore.h +++ b/db/recstore.h @@ -4,85 +4,67 @@ namespace mongo {
- using boost::uint32_t;
- using boost::uint64_t;
+using boost::uint32_t;
+using boost::uint64_t;
typedef uint64_t fileofs;
-struct RecStoreHeader {
- uint32_t version;
- uint32_t recsize;
- uint64_t leof; // logical eof, actual file might be prealloc'd further
- uint64_t firstDeleted; // 0 = no deleted recs
- uint32_t cleanShutdown; // = clean
- char reserved[8192-8-8-4-4]; // we want our records page-aligned in the file if they are a multiple of a page's size -- so we make this 8KB with that goal
- RecStoreHeader() {
- version = 65;
- recsize = 0;
- leof = sizeof(RecStoreHeader);
- firstDeleted = 0;
- cleanShutdown = 1;
- memset(reserved, 0, sizeof(reserved));
- }
-};
-
/* Current version supports only consistent record sizes within a store. */
-class RecStore {
+class BasicRecStore {
+ struct RecStoreHeader {
+ uint32_t version;
+ uint32_t recsize;
+ uint64_t leof; // logical eof, actual file might be prealloc'd further
+ uint64_t firstDeleted; // 0 = no deleted recs
+ uint32_t cleanShutdown; // = clean
+ char reserved[8192-8-8-4-4-4]; // we want our records page-aligned in the file if they are a multiple of a page's size -- so we make this 8KB with that goal
+ RecStoreHeader() {
+ version = 65;
+ recsize = 0;
+ leof = sizeof(RecStoreHeader);
+ firstDeleted = 0;
+ cleanShutdown = 1;
+ memset(reserved, 0, sizeof(reserved));
+ }
+ };
+
public:
- ~RecStore();
- RecStore(const char *fn, unsigned recsize);
+ ~BasicRecStore();
+ void init(const char *fn, unsigned recsize);
fileofs insert(const char *buf, unsigned len);
void update(fileofs o, const char *buf, unsigned len);
void remove(fileofs o, unsigned len);
+ void get(fileofs o, char *buf, unsigned len);
private:
+
void writeHeader();
fstream f;
fileofs len;
RecStoreHeader h; // h.reserved is wasteful here; fix later.
+ void write(fileofs ofs, const char *data, unsigned len) {
+ f.seekp((std::streamoff)ofs);
+ f.write(data, len);
+ massert("basicrecstore write io error", !f.bad());
+ }
+public:
+ void flush() { f.flush(); }
};
/* --- implementation --- */
-inline RecStore::~RecStore() {
+inline BasicRecStore::~BasicRecStore() {
h.cleanShutdown = 0;
- writeHeader();
-}
-
-inline
-RecStore::RecStore(const char *fn, unsigned recsize) :
- f(fn, ios::ate | ios::binary | ios::in | ios::out)
-{
- massert( "compile packing problem recstore?", sizeof(RecStoreHeader) == 512);
- uassert( string("couldn't open file:")+fn, f.is_open() );
- len = f.tellg();
- if( len == 0 ) {
- log() << "creating recstore file " << fn << '\n';
- h.recsize = recsize;
- len = sizeof(RecStoreHeader);
- f.seekp(0);
- f.write((const char *) &h, sizeof(RecStoreHeader));
- }
- else {
- f.seekg(0);
- f.read((char *) &h, sizeof(RecStoreHeader));
- massert(string("recstore recsize mismatch, file:")+fn, h.recsize == recsize);
- massert(string("bad recstore [1], file:")+fn, (h.leof-sizeof(RecStoreHeader)) % recsize == 0);
- massert(string("bad recstore [1], file:")+fn, h.leof <= len);
- if( h.cleanShutdown )
- log() << "warning: non-clean shutdown for file " << fn << '\n';
- h.cleanShutdown = 2;
+ if( f.is_open() )
writeHeader();
- }
}
-inline void RecStore::writeHeader() {
- f.seekp(0);
- f.write((const char *) &h, 28); // update header in file for new leof
- uassert("file io error in RecStore [1]", !f.bad());
+inline void BasicRecStore::writeHeader() {
+ write(0, (const char *) &h, 28); // update header in file for new leof
+ uassert("file io error in BasicRecStore [1]", !f.bad());
}
-inline fileofs RecStore::insert(const char *buf, unsigned reclen) {
+inline fileofs BasicRecStore::insert(const char *buf, unsigned reclen) {
if( h.firstDeleted ) {
uasserted("deleted not yet implemented recstoreinsert");
}
@@ -93,23 +75,29 @@ inline fileofs RecStore::insert(const char *buf, unsigned reclen) { // grow the file. we grow quite a bit to avoid excessive file system fragmentations
len += (len / 8) + h.recsize;
uassert( "recstore file too big for 32 bit", len <= 0x7fffffff || sizeof(std::streamoff) > 4 );
- f.seekp((std::streamoff)len);
- f.write("", 0);
+ write(len, "", 0);
}
writeHeader();
- f.seekp((std::streamoff)ofs);
- f.write(buf, reclen);
- uassert("file io error in RecStore [2]", !f.bad());
+ write(ofs, buf, reclen);
+ uassert("file io error in BasicRecStore [2]", !f.bad());
return ofs;
}
-inline void RecStore::update(fileofs o, const char *buf, unsigned len) {
+/* so far, it's ok to read or update a subset of a record */
+
+inline void BasicRecStore::update(fileofs o, const char *buf, unsigned len) {
+ assert(o <= h.leof && o >= sizeof(RecStoreHeader));
+ write(o, buf, len);
+}
+
+inline void BasicRecStore::get(fileofs o, char *buf, unsigned len) {
assert(o <= h.leof && o >= sizeof(RecStoreHeader));
f.seekp((std::streamoff)o);
- f.write(buf, len);
+ f.read(buf, len);
+ massert("basicrestore::get I/O error", !f.bad());
}
-inline void RecStore::remove(fileofs o, unsigned len) {
+inline void BasicRecStore::remove(fileofs o, unsigned len) {
uasserted("not yet implemented recstoreremove");
}
diff --git a/db/storage.cpp b/db/storage.cpp new file mode 100644 index 00000000000..82bc7dd8700 --- /dev/null +++ b/db/storage.cpp @@ -0,0 +1,108 @@ +// storage.cpp
+
+#include "stdafx.h"
+#include "pdfile.h"
+#include "reccache.h"
+#include "rec.h"
+#include "db.h"
+
+namespace mongo {
+
+BasicRecStore RecCache::tempStore; +RecCache BasicCached_RecStore::rc(BucketSize); +
+static void storeThread() {
+ while( 1 ) {
+ sleepsecs(1);
+ dblock lk;
+ BasicCached_RecStore::rc.writeDirty();
+ RecCache::tempStore.flush();
+ }
+}
+
+void recCacheCloseAll() {
+ BasicCached_RecStore::rc.writeDirty();
+ RecCache::tempStore.flush();
+}
+
+void BasicRecStore::init(const char *fn, unsigned recsize)
+{
+ massert( "compile packing problem recstore?", sizeof(RecStoreHeader) == 8192);
+ unsigned flags = ios::binary | ios::in | ios::out;
+ if( boost::filesystem::exists(fn) )
+ flags |= ios::ate;
+ else
+ flags |= ios::trunc;
+ f.open(fn, (ios_base::openmode) flags);
+ uassert( string("couldn't open file:")+fn, f.is_open() );
+ len = f.tellg();
+ if( len == 0 ) {
+ log() << "creating recstore file " << fn << '\n';
+ h.recsize = recsize;
+ len = sizeof(RecStoreHeader);
+ f.seekp(0);
+ f.write((const char *) &h, sizeof(RecStoreHeader));
+ }
+ else {
+ f.seekg(0);
+ f.read((char *) &h, sizeof(RecStoreHeader));
+ massert(string("recstore recsize mismatch, file:")+fn, h.recsize == recsize);
+ massert(string("bad recstore [1], file:")+fn, (h.leof-sizeof(RecStoreHeader)) % recsize == 0);
+ massert(string("bad recstore [2], file:")+fn, h.leof <= len);
+ if( h.cleanShutdown )
+ log() << "warning: non-clean shutdown for file " << fn << '\n';
+ h.cleanShutdown = 2;
+ writeHeader();
+ }
+ f.flush();
+ boost::thread t(storeThread);
+}
+
+inline void RecCache::writeIfDirty(Node *n) {
+ if( n->dirty ) {
+ n->dirty = false;
+ tempStore.update(fileOfs(n->loc), n->data, recsize);
+ }
+}
+
+void RecCache::writeDirty() {
+ try {
+ for( list<DiskLoc>::iterator i = dirtyl.begin(); i != dirtyl.end(); i++ ) {
+ map<DiskLoc, Node*>::iterator j = m.find(*i);
+ if( j != m.end() )
+ writeIfDirty(j->second);
+ }
+ }
+ catch(...) {
+ log() << "Problem: bad() in RecCache::writeDirty, file io error\n";
+ }
+ dirtyl.clear();
+}
+
+const unsigned LIMIT = 3; // 10000
+
+inline void RecCache::ejectOld() {
+ if( nnodes <= LIMIT )
+ return;
+ Node *n = oldest;
+ while( 1 ) {
+ if( nnodes <= LIMIT ) {
+ n->older = 0;
+ oldest = n;
+ break;
+ }
+ nnodes--;
+ Node *nxt = n->newer;
+ assert(n);
+ writeIfDirty(n);
+ m.erase(n->loc);
+ delete n;
+ n = nxt;
+ }
+}
+
+void dbunlocked() {
+ BasicCached_RecStore::rc.ejectOld();
+}
+
+}
diff --git a/db/storage.h b/db/storage.h index e28b01dfcd6..2fba2c7af21 100644 --- a/db/storage.h +++ b/db/storage.h @@ -37,19 +37,16 @@ namespace mongo { int fileNo; /* this will be volume, file #, etc. */ int ofs; public: - enum { NullOfs = -1, MaxFiles=4000 }; + enum { MaxFiles=4000, NullOfs = -1 }; int a() const { return fileNo; } + DiskLoc(int a, int b) : fileNo(a), ofs(b) { - assert(ofs!=0); - } - DiskLoc() { - fileNo = -1; - ofs = NullOfs; + //assert(ofs!=0); } - + DiskLoc() { Null(); } DiskLoc(const DiskLoc& l) { fileNo=l.fileNo; ofs=l.ofs; @@ -62,11 +59,12 @@ namespace mongo { } bool isNull() const { - return ofs == NullOfs; + return fileNo == -1; + // return ofs == NullOfs; } void Null() { fileNo = -1; - ofs = NullOfs; + ofs = 0; } void assertOk() { assert(!isNull()); @@ -119,7 +117,7 @@ namespace mongo { const DiskLoc& operator=(const DiskLoc& b) { fileNo=b.fileNo; ofs = b.ofs; - assert(ofs!=0); + //assert(ofs!=0); return *this; } int compare(const DiskLoc& b) const { @@ -141,6 +139,7 @@ namespace mongo { DeletedRecord* drec() const; Extent* ext() const; BtreeBucket* btree() const; + BtreeBucket* btreemod() const; // marks modified / dirty MongoDataFile& pdf() const; }; diff --git a/jstests/index_check1.js b/jstests/index_check1.js index b381967081c..b84419d7fd0 100644 --- a/jstests/index_check1.js +++ b/jstests/index_check1.js @@ -9,7 +9,11 @@ assert(db.system.namespaces.find({name:/somecollection/}).length() == 1, 2); db.somecollection.ensureIndex({a:1}); -assert(db.system.namespaces.find({name:/somecollection/}).length() == 2, 3); +var z = db.system.namespaces.find({name:/somecollection/}).length(); +assert( z >= 1 , 3 ); + +if( z == 1 ) + print("warning: z==1, should only happen with alternate storage engines"); db.somecollection.drop(); @@ -21,6 +25,7 @@ assert(db.system.namespaces.find({name:/somecollection/}).length() == 1, 5); db.somecollection.ensureIndex({a:1}); -assert(db.system.namespaces.find({name:/somecollection/}).length() == 2, 6); +var x = db.system.namespaces.find({name:/somecollection/}).length(); +assert( x == 2 || x == z, 6); assert(db.somecollection.validate().valid, 7); diff --git a/stdafx.cpp b/stdafx.cpp index 8ffbd9b370e..ade2d6281ef 100644 --- a/stdafx.cpp +++ b/stdafx.cpp @@ -64,9 +64,9 @@ namespace mongo { int uacount = 0; void uasserted(const char *msg) { if ( ++uacount < 100 ) - problem() << "User Assertion " << msg << endl; + log() << "User Assertion " << msg << endl; else - RARELY problem() << "User Assertion " << msg << endl; + RARELY log() << "User Assertion " << msg << endl; lastAssert[3].set(msg, getDbContext().c_str(), "", 0); raiseError(msg); throw UserAssertionException(msg); @@ -191,7 +191,11 @@ namespace mongo { /* dassert is 'debug assert' -- might want to turn off for production as these could be slow. */ +#if defined(_DEBUG) #define dassert assert +#else +#define dassert(x) +#endif } // namespace mongo |