summaryrefslogtreecommitdiff
path: root/dbtests
diff options
context:
space:
mode:
Diffstat (limited to 'dbtests')
-rw-r--r--dbtests/basictests.cpp160
-rw-r--r--dbtests/btreetests.cpp178
-rw-r--r--dbtests/clienttests.cpp12
-rw-r--r--dbtests/commandtests.cpp98
-rw-r--r--dbtests/cursortests.cpp173
-rw-r--r--dbtests/dbtests.cpp2
-rw-r--r--dbtests/dbtests.h1
-rw-r--r--dbtests/framework.cpp48
-rw-r--r--dbtests/framework.h25
-rw-r--r--dbtests/histogram_test.cpp94
-rw-r--r--dbtests/jsobjtests.cpp284
-rw-r--r--dbtests/jsontests.cpp96
-rw-r--r--dbtests/jstests.cpp96
-rw-r--r--dbtests/macrotests.cpp47
-rw-r--r--dbtests/matchertests.cpp11
-rw-r--r--dbtests/mockdbclient.h14
-rw-r--r--dbtests/namespacetests.cpp87
-rw-r--r--dbtests/pairingtests.cpp6
-rw-r--r--dbtests/pdfiletests.cpp10
-rw-r--r--dbtests/perf/perftest.cpp10
-rw-r--r--dbtests/queryoptimizertests.cpp785
-rw-r--r--dbtests/querytests.cpp83
-rw-r--r--dbtests/repltests.cpp36
-rw-r--r--dbtests/sharding.cpp2
-rw-r--r--dbtests/socktests.cpp3
-rw-r--r--dbtests/spin_lock_test.cpp115
-rw-r--r--dbtests/test.vcproj1030
-rw-r--r--dbtests/test.vcxproj441
-rwxr-xr-xdbtests/test.vcxproj.filters707
-rw-r--r--dbtests/threadedtests.cpp23
-rw-r--r--dbtests/updatetests.cpp54
31 files changed, 3494 insertions, 1237 deletions
diff --git a/dbtests/basictests.cpp b/dbtests/basictests.cpp
index 4c80cd4..342e982 100644
--- a/dbtests/basictests.cpp
+++ b/dbtests/basictests.cpp
@@ -17,11 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "dbtests.h"
#include "../util/base64.h"
#include "../util/array.h"
+#include "../util/text.h"
namespace BasicTests {
@@ -186,6 +187,7 @@ namespace BasicTests {
class sleeptest {
public:
+
void run(){
Timer t;
sleepsecs( 1 );
@@ -199,8 +201,45 @@ namespace BasicTests {
t.reset();
sleepmillis( 1727 );
ASSERT( t.millis() >= 1000 );
- ASSERT( t.millis() <= 2000 );
+ ASSERT( t.millis() <= 2500 );
+
+ {
+ int total = 1200;
+ int ms = 2;
+ t.reset();
+ for ( int i=0; i<(total/ms); i++ ){
+ sleepmillis( ms );
+ }
+ {
+ int x = t.millis();
+ if ( x < 1000 || x > 2500 ){
+ cout << "sleeptest x: " << x << endl;
+ ASSERT( x >= 1000 );
+ ASSERT( x <= 20000 );
+ }
+ }
+ }
+#ifdef __linux__
+ {
+ int total = 1200;
+ int micros = 100;
+ t.reset();
+ int numSleeps = 1000*(total/micros);
+ for ( int i=0; i<numSleeps; i++ ){
+ sleepmicros( micros );
+ }
+ {
+ int y = t.millis();
+ if ( y < 1000 || y > 2500 ){
+ cout << "sleeptest y: " << y << endl;
+ ASSERT( y >= 1000 );
+ ASSERT( y <= 100000 );
+ }
+ }
+ }
+#endif
+
}
};
@@ -220,7 +259,9 @@ namespace BasicTests {
}
void run(){
uassert( -1 , foo() , 1 );
- ASSERT_EQUALS( 0 , x );
+ if( x != 0 ) {
+ ASSERT_EQUALS( 0 , x );
+ }
try {
uassert( -1 , foo() , 0 );
}
@@ -268,7 +309,7 @@ namespace BasicTests {
{
ThreadSafeString bar;
bar = "eliot2";
- foo = bar;
+ foo = bar.toString();
}
ASSERT_EQUALS( "eliot2" , foo );
}
@@ -316,7 +357,111 @@ namespace BasicTests {
ASSERT_EQUALS( -1 , lexNumCmp( "a.0.b" , "a.1" ) );
}
};
+
+ class DatabaseValidNames {
+ public:
+ void run(){
+ ASSERT( Database::validDBName( "foo" ) );
+ ASSERT( ! Database::validDBName( "foo/bar" ) );
+ ASSERT( ! Database::validDBName( "foo.bar" ) );
+
+ ASSERT( nsDollarCheck( "asdads" ) );
+ ASSERT( ! nsDollarCheck( "asda$ds" ) );
+ ASSERT( nsDollarCheck( "local.oplog.$main" ) );
+ }
+ };
+ class PtrTests {
+ public:
+ void run(){
+ scoped_ptr<int> p1 (new int(1));
+ boost::shared_ptr<int> p2 (new int(2));
+ scoped_ptr<const int> p3 (new int(3));
+ boost::shared_ptr<const int> p4 (new int(4));
+
+ //non-const
+ ASSERT_EQUALS( p1.get() , ptr<int>(p1) );
+ ASSERT_EQUALS( p2.get() , ptr<int>(p2) );
+ ASSERT_EQUALS( p2.get() , ptr<int>(p2.get()) ); // T* constructor
+ ASSERT_EQUALS( p2.get() , ptr<int>(ptr<int>(p2)) ); // copy constructor
+ ASSERT_EQUALS( *p2 , *ptr<int>(p2));
+ ASSERT_EQUALS( p2.get() , ptr<boost::shared_ptr<int> >(&p2)->get() ); // operator->
+
+ //const
+ ASSERT_EQUALS( p1.get() , ptr<const int>(p1) );
+ ASSERT_EQUALS( p2.get() , ptr<const int>(p2) );
+ ASSERT_EQUALS( p2.get() , ptr<const int>(p2.get()) );
+ ASSERT_EQUALS( p3.get() , ptr<const int>(p3) );
+ ASSERT_EQUALS( p4.get() , ptr<const int>(p4) );
+ ASSERT_EQUALS( p4.get() , ptr<const int>(p4.get()) );
+ ASSERT_EQUALS( p2.get() , ptr<const int>(ptr<const int>(p2)) );
+ ASSERT_EQUALS( p2.get() , ptr<const int>(ptr<int>(p2)) ); // constizing copy constructor
+ ASSERT_EQUALS( *p2 , *ptr<int>(p2));
+ ASSERT_EQUALS( p2.get() , ptr<const boost::shared_ptr<int> >(&p2)->get() );
+
+ //bool context
+ ASSERT( ptr<int>(p1) );
+ ASSERT( !ptr<int>(NULL) );
+ ASSERT( !ptr<int>() );
+
+#if 0
+ // These shouldn't compile
+ ASSERT_EQUALS( p3.get() , ptr<int>(p3) );
+ ASSERT_EQUALS( p4.get() , ptr<int>(p4) );
+ ASSERT_EQUALS( p2.get() , ptr<int>(ptr<const int>(p2)) );
+#endif
+ }
+ };
+
+ struct StringSplitterTest {
+
+ void test( string s ){
+ vector<string> v = StringSplitter::split( s , "," );
+ ASSERT_EQUALS( s , StringSplitter::join( v , "," ) );
+ }
+
+ void run(){
+ test( "a" );
+ test( "a,b" );
+ test( "a,b,c" );
+ }
+ };
+
+ struct IsValidUTF8Test {
+// macros used to get valid line numbers
+#define good(s) ASSERT(isValidUTF8(s));
+#define bad(s) ASSERT(!isValidUTF8(s));
+
+ void run() {
+ good("A");
+ good("\xC2\xA2"); // cent: ¢
+ good("\xE2\x82\xAC"); // euro: €
+ good("\xF0\x9D\x90\x80"); // Blackboard A: 𝐀
+
+ //abrupt end
+ bad("\xC2");
+ bad("\xE2\x82");
+ bad("\xF0\x9D\x90");
+ bad("\xC2 ");
+ bad("\xE2\x82 ");
+ bad("\xF0\x9D\x90 ");
+
+ //too long
+ bad("\xF8\x80\x80\x80\x80");
+ bad("\xFC\x80\x80\x80\x80\x80");
+ bad("\xFE\x80\x80\x80\x80\x80\x80");
+ bad("\xFF\x80\x80\x80\x80\x80\x80\x80");
+
+ bad("\xF5\x80\x80\x80"); // U+140000 > U+10FFFF
+ bad("\x80"); //cant start with continuation byte
+ bad("\xC0\x80"); // 2-byte version of ASCII NUL
+#undef good
+#undef bad
+ }
+ };
+
+
+
class All : public Suite {
public:
All() : Suite( "basic" ){
@@ -336,6 +481,13 @@ namespace BasicTests {
add< ArrayTests::basic1 >();
add< LexNumCmp >();
+
+ add< DatabaseValidNames >();
+
+ add< PtrTests >();
+
+ add< StringSplitterTest >();
+ add< IsValidUTF8Test >();
}
} myall;
diff --git a/dbtests/btreetests.cpp b/dbtests/btreetests.cpp
index 390071f..a90a097 100644
--- a/dbtests/btreetests.cpp
+++ b/dbtests/btreetests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/db.h"
#include "../db/btree.h"
@@ -26,47 +26,47 @@
namespace BtreeTests {
- class Base {
+ const char* ns() {
+ return "unittests.btreetests";
+ }
+
+ class Ensure {
+ public:
+ Ensure() {
+ _c.ensureIndex( ns(), BSON( "a" << 1 ), false, "testIndex" );
+ }
+ ~Ensure() {
+ _c.dropIndexes( ns() );
+ }
+ private:
+ DBDirectClient _c;
+ };
+
+ class Base : public Ensure {
public:
Base() :
- _context( ns() ) {
-
+ _context( ns() ) {
{
bool f = false;
assert( f = true );
massert( 10402 , "assert is misdefined", f);
}
- BSONObjBuilder builder;
- builder.append( "ns", ns() );
- builder.append( "name", "testIndex" );
- BSONObj bobj = builder.done();
- idx_.info =
- theDataFileMgr.insert( ns(), bobj.objdata(), bobj.objsize() );
- idx_.head = BtreeBucket::addBucket( idx_ );
- }
- ~Base() {
- // FIXME cleanup all btree buckets.
- theDataFileMgr.deleteRecord( ns(), idx_.info.rec(), idx_.info );
- ASSERT( theDataFileMgr.findAll( ns() )->eof() );
}
protected:
- BtreeBucket* bt() const {
- return idx_.head.btree();
+ BtreeBucket* bt() {
+ return id().head.btree();
}
- DiskLoc dl() const {
- return idx_.head;
+ DiskLoc dl() {
+ return id().head;
}
IndexDetails& id() {
- return idx_;
- }
- static const char* ns() {
- return "unittests.btreetests";
+ return nsdetails( ns() )->idx( 1 );
}
// dummy, valid record loc
static DiskLoc recordLoc() {
return DiskLoc( 0, 2 );
}
- void checkValid( int nKeys ) const {
+ void checkValid( int nKeys ) {
ASSERT( bt() );
ASSERT( bt()->isHead() );
bt()->assertValid( order(), true );
@@ -76,7 +76,7 @@ namespace BtreeTests {
bt()->dumpTree( dl(), order() );
}
void insert( BSONObj &key ) {
- bt()->bt_insert( dl(), recordLoc(), key, order(), true, id(), true );
+ bt()->bt_insert( dl(), recordLoc(), key, Ordering::make(order()), true, id(), true );
}
void unindex( BSONObj &key ) {
bt()->unindex( dl(), id(), key, recordLoc() );
@@ -93,18 +93,17 @@ namespace BtreeTests {
int pos;
bool found;
DiskLoc location =
- bt()->locate( id(), dl(), key, order(), pos, found, recordLoc(), direction );
+ bt()->locate( id(), dl(), key, Ordering::make(order()), pos, found, recordLoc(), direction );
ASSERT_EQUALS( expectedFound, found );
ASSERT( location == expectedLocation );
ASSERT_EQUALS( expectedPos, pos );
}
- BSONObj order() const {
- return idx_.keyPattern();
+ BSONObj order() {
+ return id().keyPattern();
}
private:
dblock lk_;
Client::Context _context;
- IndexDetails idx_;
};
class Create : public Base {
@@ -251,6 +250,122 @@ namespace BtreeTests {
Base::insert( k );
}
};
+
+ class ReuseUnused : public Base {
+ public:
+ void run() {
+ for ( int i = 0; i < 10; ++i ) {
+ insert( i );
+ }
+ BSONObj root = key( 'p' );
+ unindex( root );
+ Base::insert( root );
+ locate( root, 0, true, dl(), 1 );
+ }
+ private:
+ BSONObj key( char c ) {
+ return simpleKey( c, 800 );
+ }
+ void insert( int i ) {
+ BSONObj k = key( 'b' + 2 * i );
+ Base::insert( k );
+ }
+ };
+
+ class PackUnused : public Base {
+ public:
+ void run() {
+ for ( long long i = 0; i < 1000000; i += 1000 ) {
+ insert( i );
+ }
+ string orig, after;
+ {
+ stringstream ss;
+ bt()->shape( ss );
+ orig = ss.str();
+ }
+ vector< string > toDel;
+ vector< string > other;
+ BSONObjBuilder start;
+ start.appendMinKey( "a" );
+ BSONObjBuilder end;
+ end.appendMaxKey( "a" );
+ auto_ptr< BtreeCursor > c( new BtreeCursor( nsdetails( ns() ), 1, id(), start.done(), end.done(), false, 1 ) );
+ while( c->ok() ) {
+ if ( !c->currKeyNode().prevChildBucket.isNull() ) {
+ toDel.push_back( c->currKey().firstElement().valuestr() );
+ } else {
+ other.push_back( c->currKey().firstElement().valuestr() );
+ }
+ c->advance();
+ }
+ ASSERT( toDel.size() > 0 );
+ for( vector< string >::const_iterator i = toDel.begin(); i != toDel.end(); ++i ) {
+ BSONObj o = BSON( "a" << *i );
+ unindex( o );
+ }
+ ASSERT( other.size() > 0 );
+ for( vector< string >::const_iterator i = other.begin(); i != other.end(); ++i ) {
+ BSONObj o = BSON( "a" << *i );
+ unindex( o );
+ }
+
+ int unused = 0;
+ ASSERT_EQUALS( 0, bt()->fullValidate( dl(), order(), &unused ) );
+
+ for ( long long i = 50000; i < 50100; ++i ) {
+ insert( i );
+ }
+
+ int unused2 = 0;
+ ASSERT_EQUALS( 100, bt()->fullValidate( dl(), order(), &unused2 ) );
+
+ ASSERT( unused2 < unused );
+ }
+ protected:
+ void insert( long long n ) {
+ string val( 800, ' ' );
+ for( int i = 0; i < 800; i += 8 ) {
+ for( int j = 0; j < 8; ++j ) {
+ // probably we won't get > 56 bits
+ unsigned char v = 0x80 | ( n >> ( ( 8 - j - 1 ) * 7 ) & 0x000000000000007f );
+ val[ i + j ] = v;
+ }
+ }
+ BSONObj k = BSON( "a" << val );
+ Base::insert( k );
+ }
+ };
+
+ class DontDropReferenceKey : public PackUnused {
+ public:
+ void run() {
+ // with 80 root node is full
+ for ( long long i = 0; i < 80; i += 1 ) {
+ insert( i );
+ }
+
+ BSONObjBuilder start;
+ start.appendMinKey( "a" );
+ BSONObjBuilder end;
+ end.appendMaxKey( "a" );
+ BSONObj l = bt()->keyNode( 0 ).key;
+ string toInsert;
+ auto_ptr< BtreeCursor > c( new BtreeCursor( nsdetails( ns() ), 1, id(), start.done(), end.done(), false, 1 ) );
+ while( c->ok() ) {
+ if ( c->currKey().woCompare( l ) > 0 ) {
+ toInsert = c->currKey().firstElement().valuestr();
+ break;
+ }
+ c->advance();
+ }
+ // too much work to try to make this happen through inserts and deletes
+ const_cast< DiskLoc& >( bt()->keyNode( 1 ).prevChildBucket ) = DiskLoc();
+ const_cast< DiskLoc& >( bt()->keyNode( 1 ).recordLoc ).GETOFS() |= 1; // make unused
+ BSONObj k = BSON( "a" << toInsert );
+ Base::insert( k );
+ }
+ };
class All : public Suite {
public:
@@ -265,6 +380,9 @@ namespace BtreeTests {
add< MissingLocate >();
add< MissingLocateMultiBucket >();
add< SERVER983 >();
+ add< ReuseUnused >();
+ add< PackUnused >();
+ add< DontDropReferenceKey >();
}
} myall;
}
diff --git a/dbtests/clienttests.cpp b/dbtests/clienttests.cpp
index 6735a40..58287e9 100644
--- a/dbtests/clienttests.cpp
+++ b/dbtests/clienttests.cpp
@@ -16,7 +16,7 @@
// client.cpp
-#include "stdafx.h"
+#include "pch.h"
#include "../client/dbclient.h"
#include "dbtests.h"
#include "../db/concurrency.h"
@@ -119,12 +119,17 @@ namespace ClientTests {
for( int i = 0; i < 10; ++i )
db.insert( ns(), BSON( "i" << i ) );
auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) );
+
BSONObj o = c->next();
ASSERT( c->more() );
+ ASSERT_EQUALS( 9 , c->objsLeftInBatch() );
ASSERT( c->moreInCurrentBatch() );
+
c->putBack( o );
ASSERT( c->more() );
+ ASSERT_EQUALS( 10, c->objsLeftInBatch() );
ASSERT( c->moreInCurrentBatch() );
+
o = c->next();
BSONObj o2 = c->next();
BSONObj o3 = c->next();
@@ -136,9 +141,12 @@ namespace ClientTests {
ASSERT_EQUALS( i, o[ "i" ].number() );
}
ASSERT( !c->more() );
+ ASSERT_EQUALS( 0, c->objsLeftInBatch() );
ASSERT( !c->moreInCurrentBatch() );
+
c->putBack( o );
ASSERT( c->more() );
+ ASSERT_EQUALS( 1, c->objsLeftInBatch() );
ASSERT( c->moreInCurrentBatch() );
ASSERT_EQUALS( 1, c->itcount() );
}
@@ -153,7 +161,7 @@ namespace ClientTests {
ASSERT( db.runCommand( "unittests", BSON( "collstats" << "clienttests.create" ), info ) );
}
};
-
+
class All : public Suite {
public:
All() : Suite( "client" ){
diff --git a/dbtests/commandtests.cpp b/dbtests/commandtests.cpp
new file mode 100644
index 0000000..fa0014d
--- /dev/null
+++ b/dbtests/commandtests.cpp
@@ -0,0 +1,98 @@
+/**
+ * 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 "../client/dbclient.h"
+#include "dbtests.h"
+#include "../db/concurrency.h"
+
+using namespace mongo;
+
+namespace CommandTests {
+ // one namespace per command
+ namespace FileMD5{
+ struct Base {
+ Base(){
+ db.dropCollection(ns());
+ db.ensureIndex(ns(), BSON( "files_id" << 1 << "n" << 1 ));
+ }
+
+ const char* ns() { return "test.fs.chunks"; }
+
+ DBDirectClient db;
+ };
+ struct Type0 : Base {
+ void run(){
+ {
+ BSONObjBuilder b;
+ b.genOID();
+ b.append("files_id", 0);
+ b.append("n", 0);
+ b.appendBinData("data", 6, BinDataGeneral, "hello ");
+ db.insert(ns(), b.obj());
+ }
+ {
+ BSONObjBuilder b;
+ b.genOID();
+ b.append("files_id", 0);
+ b.append("n", 1);
+ b.appendBinData("data", 5, BinDataGeneral, "world");
+ db.insert(ns(), b.obj());
+ }
+
+ BSONObj result;
+ ASSERT( db.runCommand("test", BSON("filemd5" << 0), result) );
+ ASSERT_EQUALS( string("5eb63bbbe01eeed093cb22bb8f5acdc3") , result["md5"].valuestr() );
+ }
+ };
+ struct Type2 : Base{
+ void run(){
+ {
+ BSONObjBuilder b;
+ b.genOID();
+ b.append("files_id", 0);
+ b.append("n", 0);
+ b.appendBinDataArrayDeprecated("data", "hello ", 6);
+ db.insert(ns(), b.obj());
+ }
+ {
+ BSONObjBuilder b;
+ b.genOID();
+ b.append("files_id", 0);
+ b.append("n", 1);
+ b.appendBinDataArrayDeprecated("data", "world", 5);
+ db.insert(ns(), b.obj());
+ }
+
+ BSONObj result;
+ ASSERT( db.runCommand("test", BSON("filemd5" << 0), result) );
+ ASSERT_EQUALS( string("5eb63bbbe01eeed093cb22bb8f5acdc3") , result["md5"].valuestr() );
+ }
+ };
+ }
+
+ class All : public Suite {
+ public:
+ All() : Suite( "commands" ){
+ }
+
+ void setupTests(){
+ add< FileMD5::Type0 >();
+ add< FileMD5::Type2 >();
+ }
+
+ } all;
+}
diff --git a/dbtests/cursortests.cpp b/dbtests/cursortests.cpp
index f14c5fa..954c8b0 100644
--- a/dbtests/cursortests.cpp
+++ b/dbtests/cursortests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/db.h"
#include "../db/clientcursor.h"
#include "../db/instance.h"
@@ -28,7 +28,29 @@ namespace CursorTests {
namespace BtreeCursorTests {
- class MultiRange {
+ // The ranges expressed in these tests are impossible given our query
+ // syntax, so going to do them a hacky way.
+
+ class Base {
+ protected:
+ FieldRangeVector *vec( int *vals, int len, int direction = 1 ) {
+ FieldRangeSet s( "", BSON( "a" << 1 ) );
+ for( int i = 0; i < len; i += 2 ) {
+ _objs.push_back( BSON( "a" << BSON( "$gte" << vals[ i ] << "$lte" << vals[ i + 1 ] ) ) );
+ FieldRangeSet s2( "", _objs.back() );
+ if ( i == 0 ) {
+ s.range( "a" ) = s2.range( "a" );
+ } else {
+ s.range( "a" ) |= s2.range( "a" );
+ }
+ }
+ return new FieldRangeVector( s, BSON( "a" << 1 ), direction );
+ }
+ private:
+ vector< BSONObj > _objs;
+ };
+
+ class MultiRange : public Base {
public:
void run() {
dblock lk;
@@ -39,11 +61,10 @@ namespace CursorTests {
c.insert( ns, BSON( "a" << i ) );
ASSERT( c.ensureIndex( ns, BSON( "a" << 1 ) ) );
}
- BoundList b;
- b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 1 ), BSON( "" << 2 ) ) );
- b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 4 ), BSON( "" << 6 ) ) );
+ int v[] = { 1, 2, 4, 6 };
+ boost::shared_ptr< FieldRangeVector > frv( vec( v, 4 ) );
Client::Context ctx( ns );
- BtreeCursor c( nsdetails( ns ), 1, nsdetails( ns )->idx(1), b, 1 );
+ BtreeCursor c( nsdetails( ns ), 1, nsdetails( ns )->idx(1), frv, 1 );
ASSERT_EQUALS( "BtreeCursor a_1 multi", c.toString() );
double expected[] = { 1, 2, 4, 5, 6 };
for( int i = 0; i < 5; ++i ) {
@@ -55,7 +76,7 @@ namespace CursorTests {
}
};
- class MultiRangeGap {
+ class MultiRangeGap : public Base {
public:
void run() {
dblock lk;
@@ -68,12 +89,10 @@ namespace CursorTests {
c.insert( ns, BSON( "a" << i ) );
ASSERT( c.ensureIndex( ns, BSON( "a" << 1 ) ) );
}
- BoundList b;
- b.push_back( pair< BSONObj, BSONObj >( BSON( "" << -50 ), BSON( "" << 2 ) ) );
- b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 40 ), BSON( "" << 60 ) ) );
- b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 109 ), BSON( "" << 200 ) ) );
+ int v[] = { -50, 2, 40, 60, 109, 200 };
+ boost::shared_ptr< FieldRangeVector > frv( vec( v, 6 ) );
Client::Context ctx( ns );
- BtreeCursor c( nsdetails( ns ), 1, nsdetails( ns )->idx(1), b, 1 );
+ BtreeCursor c( nsdetails( ns ), 1, nsdetails( ns )->idx(1), frv, 1 );
ASSERT_EQUALS( "BtreeCursor a_1 multi", c.toString() );
double expected[] = { 0, 1, 2, 109 };
for( int i = 0; i < 4; ++i ) {
@@ -85,7 +104,7 @@ namespace CursorTests {
}
};
- class MultiRangeReverse {
+ class MultiRangeReverse : public Base {
public:
void run() {
dblock lk;
@@ -96,11 +115,10 @@ namespace CursorTests {
c.insert( ns, BSON( "a" << i ) );
ASSERT( c.ensureIndex( ns, BSON( "a" << 1 ) ) );
}
- BoundList b;
- b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 6 ), BSON( "" << 4 ) ) );
- b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 2 ), BSON( "" << 1 ) ) );
+ int v[] = { 1, 2, 4, 6 };
+ boost::shared_ptr< FieldRangeVector > frv( vec( v, 4, -1 ) );
Client::Context ctx( ns );
- BtreeCursor c( nsdetails( ns ), 1, nsdetails( ns )->idx(1), b, -1 );
+ BtreeCursor c( nsdetails( ns ), 1, nsdetails( ns )->idx(1), frv, -1 );
ASSERT_EQUALS( "BtreeCursor a_1 reverse multi", c.toString() );
double expected[] = { 6, 5, 4, 2, 1 };
for( int i = 0; i < 5; ++i ) {
@@ -112,6 +130,122 @@ namespace CursorTests {
}
};
+ class Base2 {
+ public:
+ virtual ~Base2() { _c.dropCollection( ns() ); }
+ protected:
+ static const char *ns() { return "unittests.cursortests.Base2"; }
+ DBDirectClient _c;
+ virtual BSONObj idx() const = 0;
+ virtual int direction() const { return 1; }
+ void insert( const BSONObj &o ) {
+ _objs.push_back( o );
+ _c.insert( ns(), o );
+ }
+ void check( const BSONObj &spec ) {
+ _c.ensureIndex( ns(), idx() );
+ Client::Context ctx( ns() );
+ FieldRangeSet frs( ns(), spec );
+ boost::shared_ptr< FieldRangeVector > frv( new FieldRangeVector( frs, idx(), direction() ) );
+ BtreeCursor c( nsdetails( ns() ), 1, nsdetails( ns() )->idx( 1 ), frv, direction() );
+ Matcher m( spec );
+ int count = 0;
+ while( c.ok() ) {
+ ASSERT( m.matches( c.current() ) );
+ c.advance();
+ ++count;
+ }
+ int expectedCount = 0;
+ for( vector< BSONObj >::const_iterator i = _objs.begin(); i != _objs.end(); ++i ) {
+ if ( m.matches( *i ) ) {
+ ++expectedCount;
+ }
+ }
+ ASSERT_EQUALS( expectedCount, count );
+ }
+ private:
+ dblock _lk;
+ vector< BSONObj > _objs;
+ };
+
+ class EqEq : public Base2 {
+ public:
+ void run() {
+ insert( BSON( "a" << 4 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 4 ) );
+ insert( BSON( "a" << 5 << "b" << 4 ) );
+ check( BSON( "a" << 4 << "b" << 5 ) );
+ }
+ virtual BSONObj idx() const { return BSON( "a" << 1 << "b" << 1 ); }
+ };
+
+ class EqRange : public Base2 {
+ public:
+ void run() {
+ insert( BSON( "a" << 3 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 0 ) );
+ insert( BSON( "a" << 4 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 6 ) );
+ insert( BSON( "a" << 4 << "b" << 6 ) );
+ insert( BSON( "a" << 4 << "b" << 10 ) );
+ insert( BSON( "a" << 4 << "b" << 11 ) );
+ insert( BSON( "a" << 5 << "b" << 5 ) );
+ check( BSON( "a" << 4 << "b" << BSON( "$gte" << 1 << "$lte" << 10 ) ) );
+ }
+ virtual BSONObj idx() const { return BSON( "a" << 1 << "b" << 1 ); }
+ };
+
+ class EqIn : public Base2 {
+ public:
+ void run() {
+ insert( BSON( "a" << 3 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 0 ) );
+ insert( BSON( "a" << 4 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 6 ) );
+ insert( BSON( "a" << 4 << "b" << 6 ) );
+ insert( BSON( "a" << 4 << "b" << 10 ) );
+ insert( BSON( "a" << 4 << "b" << 11 ) );
+ insert( BSON( "a" << 5 << "b" << 5 ) );
+ check( BSON( "a" << 4 << "b" << BSON( "$in" << BSON_ARRAY( 5 << 6 << 11 ) ) ) );
+ }
+ virtual BSONObj idx() const { return BSON( "a" << 1 << "b" << 1 ); }
+ };
+
+ class RangeEq : public Base2 {
+ public:
+ void run() {
+ insert( BSON( "a" << 0 << "b" << 4 ) );
+ insert( BSON( "a" << 1 << "b" << 4 ) );
+ insert( BSON( "a" << 4 << "b" << 3 ) );
+ insert( BSON( "a" << 5 << "b" << 4 ) );
+ insert( BSON( "a" << 7 << "b" << 4 ) );
+ insert( BSON( "a" << 4 << "b" << 4 ) );
+ insert( BSON( "a" << 9 << "b" << 6 ) );
+ insert( BSON( "a" << 11 << "b" << 1 ) );
+ insert( BSON( "a" << 11 << "b" << 4 ) );
+ check( BSON( "a" << BSON( "$gte" << 1 << "$lte" << 10 ) << "b" << 4 ) );
+ }
+ virtual BSONObj idx() const { return BSON( "a" << 1 << "b" << 1 ); }
+ };
+
+ class RangeIn : public Base2 {
+ public:
+ void run() {
+ insert( BSON( "a" << 0 << "b" << 4 ) );
+ insert( BSON( "a" << 1 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 3 ) );
+ insert( BSON( "a" << 5 << "b" << 4 ) );
+ insert( BSON( "a" << 7 << "b" << 5 ) );
+ insert( BSON( "a" << 4 << "b" << 4 ) );
+ insert( BSON( "a" << 9 << "b" << 6 ) );
+ insert( BSON( "a" << 11 << "b" << 1 ) );
+ insert( BSON( "a" << 11 << "b" << 4 ) );
+ check( BSON( "a" << BSON( "$gte" << 1 << "$lte" << 10 ) << "b" << BSON( "$in" << BSON_ARRAY( 4 << 6 ) ) ) );
+ }
+ virtual BSONObj idx() const { return BSON( "a" << 1 << "b" << 1 ); }
+ };
+
} // namespace BtreeCursorTests
class All : public Suite {
@@ -122,6 +256,11 @@ namespace CursorTests {
add< BtreeCursorTests::MultiRange >();
add< BtreeCursorTests::MultiRangeGap >();
add< BtreeCursorTests::MultiRangeReverse >();
+ add< BtreeCursorTests::EqEq >();
+ add< BtreeCursorTests::EqRange >();
+ add< BtreeCursorTests::EqIn >();
+ add< BtreeCursorTests::RangeEq >();
+ add< BtreeCursorTests::RangeIn >();
}
} myall;
} // namespace CursorTests
diff --git a/dbtests/dbtests.cpp b/dbtests/dbtests.cpp
index 4b81ea9..195a1d1 100644
--- a/dbtests/dbtests.cpp
+++ b/dbtests/dbtests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "dbtests.h"
diff --git a/dbtests/dbtests.h b/dbtests/dbtests.h
index 3184a05..dbaeea1 100644
--- a/dbtests/dbtests.h
+++ b/dbtests/dbtests.h
@@ -21,4 +21,5 @@
using namespace mongo;
using namespace mongo::regression;
+using boost::shared_ptr;
diff --git a/dbtests/framework.cpp b/dbtests/framework.cpp
index 0566aa8..e624211 100644
--- a/dbtests/framework.cpp
+++ b/dbtests/framework.cpp
@@ -16,11 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
+#include "../util/version.h"
#include <boost/program_options.hpp>
#undef assert
-#define assert xassert
+#define assert MONGO_assert
#include "framework.h"
#include "../util/file_allocator.h"
@@ -53,7 +54,7 @@ namespace mongo {
ss << result;
for ( list<string>::iterator i=_messages.begin(); i!=_messages.end(); i++ ){
- ss << "\t" << *i << "\n";
+ ss << "\t" << *i << '\n';
}
return ss.str();
@@ -76,7 +77,9 @@ namespace mongo {
Result * Result::cur = 0;
- Result * Suite::run(){
+ Result * Suite::run( const string& filter ){
+ tlogLevel = -1;
+
log(1) << "\t about to setupTests" << endl;
setupTests();
log(1) << "\t done setupTests" << endl;
@@ -89,9 +92,13 @@ namespace mongo {
for ( list<TestCase*>::iterator i=_tests.begin(); i!=_tests.end(); i++ ){
TestCase * tc = *i;
+ if ( filter.size() && tc->getName().find( filter ) == string::npos ){
+ log(1) << "\t skipping test: " << tc->getName() << " because doesn't match filter" << endl;
+ continue;
+ }
r->_tests++;
-
+
bool passes = false;
log(1) << "\t going to run test: " << tc->getName() << endl;
@@ -154,10 +161,11 @@ namespace mongo {
"directory will be overwritten if it already exists")
("debug", "run tests with verbose output")
("list,l", "list available test suites")
+ ("filter,f" , po::value<string>() , "string substring filter on test name" )
("verbose,v", "verbose")
("seed", po::value<unsigned long long>(&seed), "random number seed")
;
-
+
hidden_options.add_options()
("suites", po::value< vector<string> >(), "test suites to run")
;
@@ -236,7 +244,13 @@ namespace mongo {
if (params.count("suites")) {
suites = params["suites"].as< vector<string> >();
}
- int ret = run(suites);
+
+ string filter = "";
+ if ( params.count( "filter" ) ){
+ filter = params["filter"].as<string>();
+ }
+
+ int ret = run(suites,filter);
#if !defined(_WIN32) && !defined(__sunos__)
flock( lockFile, LOCK_UN );
@@ -247,7 +261,7 @@ namespace mongo {
return ret;
}
- int Suite::run( vector<string> suites ){
+ int Suite::run( vector<string> suites , const string& filter ){
for ( unsigned int i = 0; i < suites.size(); i++ ) {
if ( _suites->find( suites[i] ) == _suites->end() ) {
cout << "invalid test [" << suites[i] << "], use --list to see valid names" << endl;
@@ -269,7 +283,7 @@ namespace mongo {
assert( s );
log() << "going to run suite: " << name << endl;
- results.push_back( s->run() );
+ results.push_back( s->run( filter ) );
}
Logstream::get().flush();
@@ -329,22 +343,6 @@ namespace mongo {
assert(0);
}
- string demangleName( const type_info& typeinfo ){
-#ifdef _WIN32
- return typeinfo.name();
-#else
- int status;
-
- char * niceName = abi::__cxa_demangle(typeinfo.name(), 0, 0, &status);
- if ( ! niceName )
- return typeinfo.name();
-
- string s = niceName;
- free(niceName);
- return s;
-#endif
- }
-
MyAssertionException * MyAsserts::getBase(){
MyAssertionException * e = new MyAssertionException();
e->ss << _file << ":" << _line << " " << _aexp << " != " << _bexp << " ";
diff --git a/dbtests/framework.h b/dbtests/framework.h
index 710b880..bec14a2 100644
--- a/dbtests/framework.h
+++ b/dbtests/framework.h
@@ -21,7 +21,7 @@
simple portable regression system
*/
-#include "../stdafx.h"
+#include "../pch.h"
#define ASSERT_EXCEPTION(a,b) \
try { \
@@ -34,6 +34,8 @@
#define ASSERT_EQUALS(a,b) (mongo::regression::MyAsserts( #a , #b , __FILE__ , __LINE__ ) ).ae( (a) , (b) )
+#define ASSERT_NOT_EQUALS(a,b) (mongo::regression::MyAsserts( #a , #b , __FILE__ , __LINE__ ) ).nae( (a) , (b) )
+
#define ASSERT(x) (void)( (!(!(x))) ? mongo::regression::assert_pass() : mongo::regression::assert_fail( #x , __FILE__ , __LINE__ ) )
#define FAIL(x) mongo::regression::fail( #x , __FILE__ , __LINE__ )
@@ -45,8 +47,6 @@ namespace mongo {
class Result;
- string demangleName( const type_info& typeinfo );
-
class TestCase {
public:
virtual ~TestCase(){}
@@ -112,9 +112,9 @@ namespace mongo {
_tests.push_back( new TestHolder1<T,A>(a) );
}
- Result * run();
+ Result * run( const string& filter );
- static int run( vector<string> suites );
+ static int run( vector<string> suites , const string& filter );
static int run( int argc , char ** argv , string default_dbpath );
@@ -166,6 +166,21 @@ namespace mongo {
throw e;
}
+ template<typename A,typename B>
+ void nae( A a , B b ){
+ _gotAssert();
+ if ( a != b )
+ return;
+
+ printLocation();
+
+ MyAssertionException * e = getBase();
+ e->ss << a << " == " << b << endl;
+ log() << e->ss.str() << endl;
+ throw e;
+ }
+
+
void printLocation();
private:
diff --git a/dbtests/histogram_test.cpp b/dbtests/histogram_test.cpp
new file mode 100644
index 0000000..5a8970d
--- /dev/null
+++ b/dbtests/histogram_test.cpp
@@ -0,0 +1,94 @@
+// histogramtests.cpp : histogram.{h,cpp} unit tests
+
+/**
+ * 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 "dbtests.h"
+#include "../util/histogram.h"
+
+namespace mongo {
+
+ using mongo::Histogram;
+
+ class BoundariesInit{
+ public:
+ void run(){
+ Histogram::Options opts;
+ opts.numBuckets = 3;
+ opts.bucketSize = 10;
+ Histogram h( opts );
+
+ ASSERT_EQUALS( h.getBucketsNum(), 3u );
+
+ ASSERT_EQUALS( h.getCount( 0 ), 0u );
+ ASSERT_EQUALS( h.getCount( 1 ), 0u );
+ ASSERT_EQUALS( h.getCount( 2 ), 0u );
+
+ ASSERT_EQUALS( h.getBoundary( 0 ), 10u );
+ ASSERT_EQUALS( h.getBoundary( 1 ), 20u );
+ ASSERT_EQUALS( h.getBoundary( 2 ), numeric_limits<uint32_t>::max() );
+ }
+ };
+
+ class BoundariesExponential{
+ public:
+ void run(){
+ Histogram::Options opts;
+ opts.numBuckets = 4;
+ opts.bucketSize = 125;
+ opts.exponential = true;
+ Histogram h( opts );
+
+ ASSERT_EQUALS( h.getBoundary( 0 ), 125u );
+ ASSERT_EQUALS( h.getBoundary( 1 ), 250u );
+ ASSERT_EQUALS( h.getBoundary( 2 ), 500u );
+ ASSERT_EQUALS( h.getBoundary( 3 ), numeric_limits<uint32_t>::max() );
+ }
+ };
+
+ class BoundariesFind{
+ public:
+ void run(){
+ Histogram::Options opts;
+ opts.numBuckets = 3;
+ opts.bucketSize = 10;
+ Histogram h( opts );
+
+ h.insert( 10 ); // end of first bucket
+ h.insert( 15 ); // second bucket
+ h.insert( 18 ); // second bucket
+
+ ASSERT_EQUALS( h.getCount( 0 ), 1u );
+ ASSERT_EQUALS( h.getCount( 1 ), 2u );
+ ASSERT_EQUALS( h.getCount( 2 ), 0u );
+ }
+ };
+
+ class HistogramSuite : public Suite {
+ public:
+ HistogramSuite() : Suite( "histogram" ){}
+
+ void setupTests(){
+ add< BoundariesInit >();
+ add< BoundariesExponential >();
+ add< BoundariesFind >();
+ // TODO: complete the test suite
+ }
+ } histogramSuite;
+
+} // anonymous namespace
diff --git a/dbtests/jsobjtests.cpp b/dbtests/jsobjtests.cpp
index e470e60..c89ef06 100644
--- a/dbtests/jsobjtests.cpp
+++ b/dbtests/jsobjtests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/jsobj.h"
#include "../db/jsobjmanipulator.h"
#include "../db/json.h"
@@ -25,13 +25,14 @@
#include "../db/extsort.h"
#include "dbtests.h"
+#include "../util/mongoutils/checksum.h"
namespace JsobjTests {
class BufBuilderBasic {
public:
void run() {
BufBuilder b( 0 );
- b.append( "foo" );
+ b.appendStr( "foo" );
ASSERT_EQUALS( 4, b.len() );
ASSERT( strcmp( "foo", b.buf() ) == 0 );
}
@@ -223,6 +224,9 @@ namespace JsobjTests {
BSONElementManipulator( o.firstElement() ).initTimestamp();
test = OpTime( o.firstElement().date() );
ASSERT( before < test && test < after );
+
+ OpTime x(123,456);
+ ASSERT_EQUALS( 528280977864LL , x.asLL() );
}
};
@@ -266,7 +270,7 @@ namespace JsobjTests {
bb << "b" << 2;
BSONObj obj = bb.obj();
- ASSERT(obj.objsize() == 4+(1+2+4)+(1+2+4)+1);
+ ASSERT_EQUALS(obj.objsize() , 4+(1+2+4)+(1+2+4)+1);
ASSERT(obj.valid());
ASSERT(obj.hasField("a"));
ASSERT(obj.hasField("b"));
@@ -300,7 +304,7 @@ namespace JsobjTests {
ASSERT(tmp.hasField("a"));
ASSERT(!tmp.hasField("b"));
ASSERT(tmp == BSON("a" << 1));
-
+
//force a realloc
BSONArrayBuilder arr;
for (int i=0; i < 10000; i++){
@@ -311,7 +315,6 @@ namespace JsobjTests {
ASSERT(obj.valid());
ASSERT(obj.hasField("a"));
ASSERT(obj.hasField("b"));
- ASSERT(obj.objdata() != tmp.objdata());
}
}
};
@@ -377,6 +380,38 @@ namespace JsobjTests {
}
};
+
+ class ToStringArray {
+ public:
+ void run() {
+ string spec = "{ a: [ \"a\", \"b\" ] }";
+ ASSERT_EQUALS( spec, fromjson( spec ).toString() );
+ }
+ };
+
+ class NullString {
+ public:
+ void run() {
+ BSONObjBuilder b;
+ b.append("a", "a\0b", 4);
+ b.append("b", string("a\0b", 3));
+ b.appendAs(b.asTempObj()["a"], "c");
+ BSONObj o = b.obj();
+
+ stringstream ss;
+ ss << 'a' << '\0' << 'b';
+
+ ASSERT_EQUALS(o["a"].valuestrsize(), 3+1);
+ ASSERT_EQUALS(o["a"].str(), ss.str());
+
+ ASSERT_EQUALS(o["b"].valuestrsize(), 3+1);
+ ASSERT_EQUALS(o["b"].str(), ss.str());
+
+ ASSERT_EQUALS(o["c"].valuestrsize(), 3+1);
+ ASSERT_EQUALS(o["c"].str(), ss.str());
+ }
+
+ };
namespace Validation {
@@ -631,7 +666,7 @@ namespace JsobjTests {
"\"seven\": [ \"a\", \"bb\", \"ccc\", 5 ],"
"\"eight\": Dbref( \"rrr\", \"01234567890123456789aaaa\" ),"
"\"_id\": ObjectId( \"deadbeefdeadbeefdeadbeef\" ),"
- "\"nine\": { \"$binary\": \"abc=\", \"$type\": \"02\" },"
+ "\"nine\": { \"$binary\": \"abc=\", \"$type\": \"00\" },"
"\"ten\": Date( 44 ), \"eleven\": /foooooo/i }" );
fuzz( b );
b.valid();
@@ -721,8 +756,50 @@ namespace JsobjTests {
ASSERT( a.woCompare( c ) < 0 );
}
};
+
+ class ToDate {
+ public:
+ void run(){
+ OID oid;
+
+ {
+ time_t before = ::time(0);
+ oid.init();
+ time_t after = ::time(0);
+ ASSERT( oid.asTimeT() >= before );
+ ASSERT( oid.asTimeT() <= after );
+ }
+
+ {
+ Date_t before = jsTime();
+ sleepsecs(1);
+ oid.init();
+ Date_t after = jsTime();
+ ASSERT( oid.asDateT() >= before );
+ ASSERT( oid.asDateT() <= after );
+ }
+ }
+ };
+
+ class FromDate {
+ public:
+ void run(){
+ OID min, oid, max;
+ Date_t now = jsTime();
+ oid.init(); // slight chance this has different time. If its a problem, can change.
+ min.init(now);
+ max.init(now, true);
+
+ ASSERT_EQUALS( (unsigned)oid.asTimeT() , now/1000 );
+ ASSERT_EQUALS( (unsigned)min.asTimeT() , now/1000 );
+ ASSERT_EQUALS( (unsigned)max.asTimeT() , now/1000 );
+ ASSERT( BSON("" << min).woCompare( BSON("" << oid) ) < 0 );
+ ASSERT( BSON("" << max).woCompare( BSON("" << oid) )> 0 );
+ }
+ };
} // namespace OIDTests
+
namespace ValueStreamTests {
class LabelBase {
@@ -795,6 +872,19 @@ namespace JsobjTests {
<< "x" << "p" );
}
};
+ class LabelishOr : public LabelBase {
+ BSONObj expected() {
+ return BSON( "$or" << BSON_ARRAY(
+ BSON("a" << BSON( "$gt" << 1 << "$lte" << "x" ))
+ << BSON("b" << BSON( "$ne" << 1 << "$ne" << "f" << "$ne" << 22.3 ))
+ << BSON("x" << "p" )));
+ }
+ BSONObj actual() {
+ return OR( BSON( "a" << GT << 1 << LTE << "x"),
+ BSON( "b" << NE << 1 << NE << "f" << NE << 22.3),
+ BSON( "x" << "p" ) );
+ }
+ };
class Unallowed {
public:
@@ -1154,9 +1244,9 @@ namespace JsobjTests {
auto_ptr<BSONObjExternalSorter::Iterator> i = sorter.iterator();
while( i->more() ) {
BSONObjExternalSorter::Data d = i->next();
- cout << d.second.toString() << endl;
+ /*cout << d.second.toString() << endl;
cout << d.first.objsize() << endl;
- cout<<"SORTER next:" << d.first.toString() << endl;
+ cout<<"SORTER next:" << d.first.toString() << endl;*/
}
}
};
@@ -1420,6 +1510,166 @@ namespace JsobjTests {
}
};
+ class EmbeddedNumbers {
+ public:
+ void run(){
+ BSONObj x = BSON( "a" << BSON( "b" << 1 ) );
+ BSONObj y = BSON( "a" << BSON( "b" << 1.0 ) );
+ ASSERT_EQUALS( x , y );
+ ASSERT_EQUALS( 0 , x.woCompare( y ) );
+ }
+ };
+
+ class BuilderPartialItearte {
+ public:
+ void run(){
+ {
+ BSONObjBuilder b;
+ b.append( "x" , 1 );
+ b.append( "y" , 2 );
+
+ BSONObjIterator i = b.iterator();
+ ASSERT( i.more() );
+ ASSERT_EQUALS( 1 , i.next().numberInt() );
+ ASSERT( i.more() );
+ ASSERT_EQUALS( 2 , i.next().numberInt() );
+ ASSERT( ! i.more() );
+
+ b.append( "z" , 3 );
+
+ i = b.iterator();
+ ASSERT( i.more() );
+ ASSERT_EQUALS( 1 , i.next().numberInt() );
+ ASSERT( i.more() );
+ ASSERT_EQUALS( 2 , i.next().numberInt() );
+ ASSERT( i.more() );
+ ASSERT_EQUALS( 3 , i.next().numberInt() );
+ ASSERT( ! i.more() );
+
+ ASSERT_EQUALS( BSON( "x" << 1 << "y" << 2 << "z" << 3 ) , b.obj() );
+ }
+
+ }
+ };
+
+ class BSONFieldTests {
+ public:
+ void run(){
+ {
+ BSONField<int> x("x");
+ BSONObj o = BSON( x << 5 );
+ ASSERT_EQUALS( BSON( "x" << 5 ) , o );
+ }
+
+ {
+ BSONField<int> x("x");
+ BSONObj o = BSON( x.make(5) );
+ ASSERT_EQUALS( BSON( "x" << 5 ) , o );
+ }
+
+ {
+ BSONField<int> x("x");
+ BSONObj o = BSON( x(5) );
+ ASSERT_EQUALS( BSON( "x" << 5 ) , o );
+
+ o = BSON( x.gt(5) );
+ ASSERT_EQUALS( BSON( "x" << BSON( "$gt" << 5 ) ) , o );
+ }
+
+ }
+ };
+
+ class BSONForEachTest {
+ public:
+ void run(){
+ BSONObj obj = BSON("a" << 1 << "a" << 2 << "a" << 3);
+
+ int count = 0;
+ BSONForEach(e, obj){
+ ASSERT_EQUALS( e.fieldName() , string("a") );
+ count += e.Int();
+ }
+
+ ASSERT_EQUALS( count , 1+2+3 );
+ }
+ };
+
+ class StringDataTest {
+ public:
+ void run(){
+ StringData a( string( "aaa" ) );
+ ASSERT_EQUALS( 3u , a.size() );
+
+ StringData b( string( "bbb" ).c_str() );
+ ASSERT_EQUALS( 3u , b.size() );
+
+ StringData c( "ccc", StringData::LiteralTag() );
+ ASSERT_EQUALS( 3u , c.size() );
+
+ // TODO update test when second parm takes StringData too
+ BSONObjBuilder builder;
+ builder.append( c, "value");
+ ASSERT_EQUALS( builder.obj() , BSON( c.data() << "value" ) );
+
+ }
+ };
+
+ class CompareOps {
+ public:
+ void run(){
+
+ BSONObj a = BSON("a"<<1);
+ BSONObj b = BSON("a"<<1);
+ BSONObj c = BSON("a"<<2);
+ BSONObj d = BSON("a"<<3);
+ BSONObj e = BSON("a"<<4);
+ BSONObj f = BSON("a"<<4);
+
+ ASSERT( ! ( a < b ) );
+ ASSERT( a <= b );
+ ASSERT( a < c );
+
+ ASSERT( f > d );
+ ASSERT( f >= e );
+ ASSERT( ! ( f > e ) );
+ }
+ };
+
+ class HashingTest {
+ public:
+ void run(){
+ int N = 100000;
+ BSONObj x = BSON( "name" << "eliot was here"
+ << "x" << 5
+ << "asdasdasdas" << "asldkasldjasldjasldjlasjdlasjdlasdasdasdasdasdasdasd" );
+
+ {
+ Timer t;
+ for ( int i=0; i<N; i++ )
+ x.md5();
+ int millis = t.millis();
+ cout << "md5 : " << millis << endl;
+ }
+
+ {
+ Timer t;
+ for ( int i=0; i<N; i++ )
+ x.toString();
+ int millis = t.millis();
+ cout << "toString : " << millis << endl;
+ }
+
+ {
+ Timer t;
+ for ( int i=0; i<N; i++ )
+ checksum( x.objdata() , x.objsize() );
+ int millis = t.millis();
+ cout << "checksum : " << millis << endl;
+ }
+
+ }
+ };
+
class All : public Suite {
public:
All() : Suite( "jsobj" ){
@@ -1442,6 +1692,8 @@ namespace JsobjTests {
add< BSONObjTests::AsTempObj >();
add< BSONObjTests::AppendIntOrLL >();
add< BSONObjTests::AppendNumber >();
+ add< BSONObjTests::ToStringArray >();
+ add< BSONObjTests::NullString >();
add< BSONObjTests::Validation::BadType >();
add< BSONObjTests::Validation::EooBeforeEnd >();
add< BSONObjTests::Validation::Undefined >();
@@ -1478,12 +1730,21 @@ namespace JsobjTests {
add< OIDTests::initParse1 >();
add< OIDTests::append >();
add< OIDTests::increasing >();
+ add< OIDTests::ToDate >();
+ add< OIDTests::FromDate >();
add< ValueStreamTests::LabelBasic >();
add< ValueStreamTests::LabelShares >();
add< ValueStreamTests::LabelDouble >();
add< ValueStreamTests::LabelDoubleShares >();
add< ValueStreamTests::LabelSize >();
add< ValueStreamTests::LabelMulti >();
+ add< ValueStreamTests::LabelishOr >();
+ add< ValueStreamTests::Unallowed >();
+ add< ValueStreamTests::ElementAppend >();
+ add< SubObjectBuilder >();
+ add< DateBuilder >();
+ add< DateNowBuilder >();
+ add< TimeTBuilder >();
add< ValueStreamTests::Unallowed >();
add< ValueStreamTests::ElementAppend >();
add< SubObjectBuilder >();
@@ -1510,6 +1771,13 @@ namespace JsobjTests {
add< checkForStorageTests >();
add< InvalidIDFind >();
add< ElementSetTest >();
+ add< EmbeddedNumbers >();
+ add< BuilderPartialItearte >();
+ add< BSONFieldTests >();
+ add< BSONForEachTest >();
+ add< StringDataTest >();
+ add< CompareOps >();
+ add< HashingTest >();
}
} myall;
diff --git a/dbtests/jsontests.cpp b/dbtests/jsontests.cpp
index aa6b1a2..990558e 100644
--- a/dbtests/jsontests.cpp
+++ b/dbtests/jsontests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/jsobj.h"
#include "../db/json.h"
@@ -248,18 +248,21 @@ namespace JsonTests {
z[ 1 ] = 'b';
z[ 2 ] = 'c';
BSONObjBuilder b;
- b.appendBinData( "a", 3, ByteArray, z );
- ASSERT_EQUALS( "{ \"a\" : { \"$binary\" : \"YWJj\", \"$type\" : \"02\" } }",
- b.done().jsonString( Strict ) );
+ b.appendBinData( "a", 3, BinDataGeneral, z );
+
+ string o = b.done().jsonString( Strict );
+
+ ASSERT_EQUALS( "{ \"a\" : { \"$binary\" : \"YWJj\", \"$type\" : \"00\" } }",
+ o );
BSONObjBuilder c;
- c.appendBinData( "a", 2, ByteArray, z );
- ASSERT_EQUALS( "{ \"a\" : { \"$binary\" : \"YWI=\", \"$type\" : \"02\" } }",
+ c.appendBinData( "a", 2, BinDataGeneral, z );
+ ASSERT_EQUALS( "{ \"a\" : { \"$binary\" : \"YWI=\", \"$type\" : \"00\" } }",
c.done().jsonString( Strict ) );
BSONObjBuilder d;
- d.appendBinData( "a", 1, ByteArray, z );
- ASSERT_EQUALS( "{ \"a\" : { \"$binary\" : \"YQ==\", \"$type\" : \"02\" } }",
+ d.appendBinData( "a", 1, BinDataGeneral, z );
+ ASSERT_EQUALS( "{ \"a\" : { \"$binary\" : \"YQ==\", \"$type\" : \"00\" } }",
d.done().jsonString( Strict ) );
}
};
@@ -333,7 +336,7 @@ namespace JsonTests {
ASSERT_EQUALS( "{ \"x\" : function(){ return 1; } }" , o.jsonString() );
}
};
-
+
class TimestampTests {
public:
void run(){
@@ -344,7 +347,49 @@ namespace JsonTests {
}
};
+ class NullString {
+ public:
+ void run(){
+ BSONObjBuilder b;
+ b.append( "x" , "a\0b" , 4 );
+ BSONObj o = b.obj();
+ ASSERT_EQUALS( "{ \"x\" : \"a\\u0000b\" }" , o.jsonString() );
+ }
+ };
+ class AllTypes {
+ public:
+ void run(){
+ OID oid;
+ oid.init();
+
+ BSONObjBuilder b;
+ b.appendMinKey( "a" );
+ b.append( "b" , 5.5 );
+ b.append( "c" , "abc" );
+ b.append( "e" , BSON( "x" << 1 ) );
+ b.append( "f" , BSON_ARRAY( 1 << 2 << 3 ) );
+ b.appendBinData( "g" , 5 , bdtCustom , (const char*)this );
+ b.appendUndefined( "h" );
+ b.append( "i" , oid );
+ b.appendBool( "j" , 1 );
+ b.appendDate( "k" , 123 );
+ b.appendNull( "l" );
+ b.appendRegex( "m" , "a" );
+ b.appendDBRef( "n" , "foo" , oid );
+ b.appendCode( "o" , "function(){}" );
+ b.appendSymbol( "p" , "foo" );
+ b.appendCodeWScope( "q" , "function(){}" , BSON("x" << 1 ) );
+ b.append( "r" , (int)5 );
+ b.appendTimestamp( "s" , 123123123123123LL );
+ b.append( "t" , 12321312312LL );
+ b.appendMaxKey( "u" );
+
+ BSONObj o = b.obj();
+ cout << o.jsonString() << endl;
+ }
+ };
+
} // namespace JsonStringTests
namespace FromJsonTests {
@@ -739,11 +784,11 @@ namespace JsonTests {
z[ 1 ] = 'b';
z[ 2 ] = 'c';
BSONObjBuilder b;
- b.appendBinData( "a", 3, ByteArray, z );
+ b.appendBinData( "a", 3, BinDataGeneral, z );
return b.obj();
}
virtual string json() const {
- return "{ \"a\" : { \"$binary\" : \"YWJj\", \"$type\" : \"02\" } }";
+ return "{ \"a\" : { \"$binary\" : \"YWJj\", \"$type\" : \"00\" } }";
}
};
@@ -753,11 +798,11 @@ namespace JsonTests {
z[ 0 ] = 'a';
z[ 1 ] = 'b';
BSONObjBuilder b;
- b.appendBinData( "a", 2, ByteArray, z );
+ b.appendBinData( "a", 2, BinDataGeneral, z );
return b.obj();
}
virtual string json() const {
- return "{ \"a\" : { \"$binary\" : \"YWI=\", \"$type\" : \"02\" } }";
+ return "{ \"a\" : { \"$binary\" : \"YWI=\", \"$type\" : \"00\" } }";
}
};
@@ -766,11 +811,11 @@ namespace JsonTests {
char z[ 1 ];
z[ 0 ] = 'a';
BSONObjBuilder b;
- b.appendBinData( "a", 1, ByteArray, z );
+ b.appendBinData( "a", 1, BinDataGeneral, z );
return b.obj();
}
virtual string json() const {
- return "{ \"a\" : { \"$binary\" : \"YQ==\", \"$type\" : \"02\" } }";
+ return "{ \"a\" : { \"$binary\" : \"YQ==\", \"$type\" : \"00\" } }";
}
};
@@ -784,11 +829,11 @@ namespace JsonTests {
0x5D, 0xB7, 0xE3, 0x9E, 0xBB, 0xF3, 0xDF, 0xBF
};
BSONObjBuilder b;
- b.appendBinData( "a", 48, ByteArray, z );
+ b.appendBinData( "a", 48, BinDataGeneral, z );
return b.obj();
}
virtual string json() const {
- return "{ \"a\" : { \"$binary\" : \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", \"$type\" : \"02\" } }";
+ return "{ \"a\" : { \"$binary\" : \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", \"$type\" : \"00\" } }";
}
};
@@ -1021,7 +1066,17 @@ namespace JsonTests {
return "{ \"time.valid\" : { $gt : new Date(1257829200000) , $lt : new Date( 1257829200100 ) } }";
}
};
-
+
+ class NullString : public Base {
+ virtual BSONObj bson() const {
+ BSONObjBuilder b;
+ b.append( "x" , "a\0b" , 4 );
+ return b.obj();
+ }
+ virtual string json() const {
+ return "{ \"x\" : \"a\\u0000b\" }";
+ }
+ };
} // namespace FromJsonTests
@@ -1059,7 +1114,9 @@ namespace JsonTests {
add< JsonStringTests::RegexManyOptions >();
add< JsonStringTests::CodeTests >();
add< JsonStringTests::TimestampTests >();
-
+ add< JsonStringTests::NullString >();
+ add< JsonStringTests::AllTypes >();
+
add< FromJsonTests::Empty >();
add< FromJsonTests::EmptyWithSpace >();
add< FromJsonTests::SingleString >();
@@ -1110,6 +1167,7 @@ namespace JsonTests {
add< FromJsonTests::EmbeddedDatesFormat1 >();
add< FromJsonTests::EmbeddedDatesFormat2 >();
add< FromJsonTests::EmbeddedDatesFormat3 >();
+ add< FromJsonTests::NullString >();
}
} myall;
diff --git a/dbtests/jstests.cpp b/dbtests/jstests.cpp
index 454dcdc..81b9673 100644
--- a/dbtests/jstests.cpp
+++ b/dbtests/jstests.cpp
@@ -17,10 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/instance.h"
-#include "../stdafx.h"
+#include "../pch.h"
#include "../scripting/engine.h"
#include "dbtests.h"
@@ -531,12 +531,17 @@ namespace JSTests {
ASSERT( s->exec( "printjson( a ); b = {b:a.a}", "foo", false, true, false ) );
out = s->getObject( "b" );
ASSERT_EQUALS( mongo::NumberLong, out.firstElement().type() );
- ASSERT_EQUALS( val, out.firstElement().numberLong() );
+ if( val != out.firstElement().numberLong() ) {
+ cout << val << endl;
+ cout << out.firstElement().numberLong() << endl;
+ cout << out.toString() << endl;
+ ASSERT_EQUALS( val, out.firstElement().numberLong() );
+ }
ASSERT( s->exec( "c = {c:a.a.toString()}", "foo", false, true, false ) );
out = s->getObject( "c" );
stringstream ss;
- ss << val;
+ ss << "NumberLong( \"" << val << "\" )";
ASSERT_EQUALS( ss.str(), out.firstElement().valuestr() );
ASSERT( s->exec( "d = {d:a.a.toNumber()}", "foo", false, true, false ) );
@@ -627,7 +632,7 @@ namespace JSTests {
private:
void check( const BSONObj &one, const BSONObj &two ) {
if ( one.woCompare( two ) != 0 ) {
- static string fail = string( "Assertion failure expected " ) + string( one ) + ", got " + string( two );
+ static string fail = string( "Assertion failure expected " ) + one.toString() + ", got " + two.toString();
FAIL( fail.c_str() );
}
}
@@ -652,6 +657,37 @@ namespace JSTests {
}
static const char *ns() { return "unittest.jstests.longutf8string"; }
};
+
+ class InvalidUTF8Check {
+ public:
+ void run(){
+ if( !globalScriptEngine->utf8Ok() )
+ return;
+
+ auto_ptr<Scope> s;
+ s.reset( globalScriptEngine->newScope() );
+
+ BSONObj b;
+ {
+ char crap[5];
+
+ crap[0] = (char) 128;
+ crap[1] = 17;
+ crap[2] = (char) 128;
+ crap[3] = 17;
+ crap[4] = 0;
+
+ BSONObjBuilder bb;
+ bb.append( "x" , crap );
+ b = bb.obj();
+ }
+
+ //cout << "ELIOT: " << b.jsonString() << endl;
+ s->setThis( &b );
+ // its ok if this is handled by js, just can't create a c++ exception
+ s->invoke( "x=this.x.length;" , BSONObj() );
+ }
+ };
class CodeTests {
public:
@@ -701,7 +737,8 @@ namespace JSTests {
{
BSONObj fromA = client.findOne( _a , BSONObj() );
- cout << "Froma : " << fromA << endl;
+ assert( fromA.valid() );
+ //cout << "Froma : " << fromA << endl;
BSONObjBuilder b;
b.append( "b" , 18 );
b.appendDBRef( "c" , "dbref.a" , fromA["_id"].__oid() );
@@ -771,7 +808,7 @@ namespace JSTests {
{
BSONObjBuilder b;
b.append( "a" , 7 );
- b.appendBinData( "b" , 12 , ByteArray , foo );
+ b.appendBinData( "b" , 12 , BinDataGeneral , foo );
in = b.obj();
s->setObject( "x" , in );
}
@@ -788,11 +825,11 @@ namespace JSTests {
// check that BinData js class is utilized
s->invokeSafe( "q = x.b.toString();", BSONObj() );
stringstream expected;
- expected << "BinData( type: " << ByteArray << ", base64: \"" << base64 << "\" )";
+ expected << "BinData(" << BinDataGeneral << ",\"" << base64 << "\")";
ASSERT_EQUALS( expected.str(), s->getString( "q" ) );
stringstream scriptBuilder;
- scriptBuilder << "z = { c : new BinData( " << ByteArray << ", \"" << base64 << "\" ) };";
+ scriptBuilder << "z = { c : new BinData( " << BinDataGeneral << ", \"" << base64 << "\" ) };";
string script = scriptBuilder.str();
s->invokeSafe( script.c_str(), BSONObj() );
out = s->getObject( "z" );
@@ -842,7 +879,34 @@ namespace JSTests {
s->invoke( f , empty );
ASSERT_EQUALS( 11 , s->getNumber( "return" ) );
}
- cout << "speed1: " << ( n / t.millis() ) << " ops/ms" << endl;
+ //cout << "speed1: " << ( n / t.millis() ) << " ops/ms" << endl;
+ }
+ };
+
+ class ScopeOut {
+ public:
+ void run(){
+ auto_ptr<Scope> s;
+ s.reset( globalScriptEngine->newScope() );
+
+ s->invokeSafe( "x = 5;" , BSONObj() );
+ {
+ BSONObjBuilder b;
+ s->append( b , "z" , "x" );
+ ASSERT_EQUALS( BSON( "z" << 5 ) , b.obj() );
+ }
+
+ s->invokeSafe( "x = function(){ return 17; }" , BSONObj() );
+ BSONObj temp;
+ {
+ BSONObjBuilder b;
+ s->append( b , "z" , "x" );
+ temp = b.obj();
+ s->setThis( &temp );
+ }
+
+ s->invokeSafe( "foo = this.z();" , BSONObj() );
+ ASSERT_EQUALS( 17 , s->getNumber( "foo" ) );
}
};
@@ -857,7 +921,7 @@ namespace JSTests {
add< ResetScope >();
add< FalseTests >();
add< SimpleFunctions >();
-
+
add< ObjectMapping >();
add< ObjectDecoding >();
add< JSOIDTests >();
@@ -867,10 +931,8 @@ namespace JSTests {
add< SpecialDBTypes >();
add< TypeConservation >();
add< NumberLong >();
-
+
add< WeirdObjects >();
- add< Utf8Check >();
- add< LongUtf8String >();
add< CodeTests >();
add< DBRefTest >();
add< InformalDBRef >();
@@ -879,6 +941,12 @@ namespace JSTests {
add< VarTests >();
add< Speed1 >();
+
+ add< InvalidUTF8Check >();
+ add< Utf8Check >();
+ add< LongUtf8String >();
+
+ add< ScopeOut >();
}
} myall;
diff --git a/dbtests/macrotests.cpp b/dbtests/macrotests.cpp
new file mode 100644
index 0000000..f547c85
--- /dev/null
+++ b/dbtests/macrotests.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2010 10gen Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#undef MONGO_EXPOSE_MACROS
+
+#include "../client/dbclient.h"
+
+#ifdef malloc
+# error malloc defined 0
+#endif
+
+#ifdef assert
+# error assert defined 1
+#endif
+
+#include "../client/parallel.h" //uses assert
+
+#ifdef assert
+# error assert defined 2
+#endif
+
+#include "../client/redef_macros.h"
+
+#ifndef assert
+# error assert not defined 3
+#endif
+
+#include "../client/undef_macros.h"
+
+#ifdef assert
+# error assert defined 3
+#endif
+
+
diff --git a/dbtests/matchertests.cpp b/dbtests/matchertests.cpp
index e71988e..696c924 100644
--- a/dbtests/matchertests.cpp
+++ b/dbtests/matchertests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/matcher.h"
#include "../db/json.h"
@@ -96,6 +96,14 @@ namespace MatcherTests {
}
};
+ class MixedNumericEmbedded {
+ public:
+ void run(){
+ Matcher m( BSON( "a" << BSON( "x" << 1 ) ) );
+ ASSERT( m.matches( BSON( "a" << BSON( "x" << 1 ) ) ) );
+ ASSERT( m.matches( BSON( "a" << BSON( "x" << 1.0 ) ) ) );
+ }
+ };
class Size {
public:
@@ -121,6 +129,7 @@ namespace MatcherTests {
add< MixedNumericGt >();
add< MixedNumericIN >();
add< Size >();
+ add< MixedNumericEmbedded >();
}
} dball;
diff --git a/dbtests/mockdbclient.h b/dbtests/mockdbclient.h
index 26f6250..9119075 100644
--- a/dbtests/mockdbclient.h
+++ b/dbtests/mockdbclient.h
@@ -20,16 +20,21 @@
#include "../client/dbclient.h"
#include "../db/commands.h"
+#include "../db/replpair.h"
class MockDBClientConnection : public DBClientConnection {
public:
MockDBClientConnection() : connect_() {}
virtual
- BSONObj findOne(const string &ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) {
+ BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) {
return one_;
}
virtual
- bool connect(const string &serverHostname, string& errmsg) {
+ bool connect(const char * serverHostname, string& errmsg) {
+ return connect_;
+ }
+ virtual
+ bool connect(const HostAndPort& , string& errmsg) {
return connect_;
}
virtual
@@ -62,11 +67,12 @@ public:
rp_( rp ),
cc_( cc ) {
}
- virtual BSONObj findOne(const string &ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) {
+ virtual BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) {
+ BSONObj c = query.obj.copy();
if ( cc_ ) cc_->beforeCommand();
SetGlobalReplPair s( rp_ );
BSONObjBuilder result;
- result.append( "ok", Command::runAgainstRegistered( "admin.$cmd", query.obj, result ) ? 1.0 : 0.0 );
+ result.append( "ok", Command::runAgainstRegistered( "admin.$cmd", c, result ) ? 1.0 : 0.0 );
if ( cc_ ) cc_->afterCommand();
return result.obj();
}
diff --git a/dbtests/namespacetests.cpp b/dbtests/namespacetests.cpp
index 205c5d2..ca051fe 100644
--- a/dbtests/namespacetests.cpp
+++ b/dbtests/namespacetests.cpp
@@ -18,7 +18,7 @@
*/
// Where IndexDetails defined.
-#include "stdafx.h"
+#include "pch.h"
#include "../db/namespace.h"
#include "../db/db.h"
@@ -548,13 +548,13 @@ namespace NamespaceTests {
keys.clear();
id().getKeysFromObject( fromjson( "{a:1,b:null}" ), keys );
- cout << "YO : " << *(keys.begin()) << endl;
+ //cout << "YO : " << *(keys.begin()) << endl;
checkSize(1, keys );
keys.clear();
id().getKeysFromObject( fromjson( "{a:1,b:[]}" ), keys );
checkSize(1, keys );
- cout << "YO : " << *(keys.begin()) << endl;
+ //cout << "YO : " << *(keys.begin()) << endl;
ASSERT_EQUALS( NumberInt , keys.begin()->firstElement().type() );
keys.clear();
}
@@ -591,7 +591,7 @@ namespace NamespaceTests {
ASSERT( userCreateNS( ns(), fromjson( spec() ), err, false ) );
}
virtual string spec() const {
- return "{\"capped\":true,\"size\":512}";
+ return "{\"capped\":true,\"size\":512,\"$nExtents\":1}";
}
int nRecords() const {
int count = 0;
@@ -675,6 +675,7 @@ namespace NamespaceTests {
void run() {
create();
ASSERT_EQUALS( 2, nExtents() );
+
BSONObj b = bigObj();
DiskLoc l[ 8 ];
@@ -699,13 +700,78 @@ namespace NamespaceTests {
}
};
+ /* test NamespaceDetails::cappedTruncateAfter(const char *ns, DiskLoc loc)
+ */
+ class TruncateCapped : public Base {
+ virtual string spec() const {
+ return "{\"capped\":true,\"size\":512,\"$nExtents\":2}";
+ }
+ void pass(int p) {
+ create();
+ ASSERT_EQUALS( 2, nExtents() );
+
+ BSONObj b = bigObj();
+
+ DiskLoc l[ 8 ];
+ for ( int i = 0; i < 8; ++i ) {
+ l[ i ] = theDataFileMgr.insert( ns(), b.objdata(), b.objsize() );
+ ASSERT( !l[ i ].isNull() );
+ ASSERT_EQUALS( i < 2 ? i + 1 : 3 + i % 2, nRecords() );
+ if ( i > 3 )
+ ASSERT( l[ i ] == l[ i - 4 ] );
+ }
+
+ NamespaceDetails *nsd = nsdetails(ns());
+
+ DiskLoc last, first;
+ {
+ ReverseCappedCursor c(nsd);
+ last = c.currLoc();
+ ASSERT( !last.isNull() );
+ }
+ {
+ ForwardCappedCursor c(nsd);
+ first = c.currLoc();
+ ASSERT( !first.isNull() );
+ ASSERT( first != last ) ;
+ }
+
+ DiskLoc d = l[6];
+ long long n = nsd->nrecords;
+ nsd->cappedTruncateAfter(ns(), d, false);
+ ASSERT_EQUALS( nsd->nrecords , n-1 );
+
+ {
+ ForwardCappedCursor c(nsd);
+ ASSERT( first == c.currLoc() );
+ }
+ {
+ ReverseCappedCursor c(nsd);
+ ASSERT( last != c.currLoc() ); // old last should be deleted
+ ASSERT( !last.isNull() );
+ }
+
+ // Too big
+ BSONObjBuilder bob;
+ bob.append( "a", string( 787, 'a' ) );
+ BSONObj bigger = bob.done();
+ ASSERT( theDataFileMgr.insert( ns(), bigger.objdata(), bigger.objsize() ).isNull() );
+ ASSERT_EQUALS( 0, nRecords() );
+ }
+ public:
+ void run() {
+// log() << "******** NOT RUNNING TruncateCapped test yet ************" << endl;
+ pass(0);
+ }
+ };
+
class Migrate : public Base {
public:
void run() {
create();
- nsd()->deletedList[ 2 ] = nsd()->deletedList[ 0 ].drec()->nextDeleted.drec()->nextDeleted;
- nsd()->deletedList[ 0 ].drec()->nextDeleted.drec()->nextDeleted = DiskLoc();
- nsd()->deletedList[ 1 ].Null();
+ nsd()->deletedList[ 2 ] = nsd()->cappedListOfAllDeletedRecords().drec()->nextDeleted.drec()->nextDeleted;
+ nsd()->cappedListOfAllDeletedRecords().drec()->nextDeleted.drec()->nextDeleted = DiskLoc();
+ nsd()->cappedLastDelRecLastExtent().Null();
NamespaceDetails *d = nsd();
zero( &d->capExtent );
zero( &d->capFirstNewRecord );
@@ -716,9 +782,9 @@ namespace NamespaceTests {
ASSERT( nsd()->capExtent.getOfs() != 0 );
ASSERT( !nsd()->capFirstNewRecord.isValid() );
int nDeleted = 0;
- for ( DiskLoc i = nsd()->deletedList[ 0 ]; !i.isNull(); i = i.drec()->nextDeleted, ++nDeleted );
+ for ( DiskLoc i = nsd()->cappedListOfAllDeletedRecords(); !i.isNull(); i = i.drec()->nextDeleted, ++nDeleted );
ASSERT_EQUALS( 10, nDeleted );
- ASSERT( nsd()->deletedList[ 1 ].isNull() );
+ ASSERT( nsd()->cappedLastDelRecLastExtent().isNull() );
}
private:
static void zero( DiskLoc *d ) {
@@ -741,7 +807,7 @@ namespace NamespaceTests {
// private:
// virtual string spec() const {
// // NOTE 256 added to size in _userCreateNS()
- // long long big = MongoDataFile::maxSize() - MDFHeader::headerSize();
+ // long long big = MongoDataFile::maxSize() - DataFileHeader::HeaderSize;
// stringstream ss;
// ss << "{\"capped\":true,\"size\":" << big << "}";
// return ss.str();
@@ -788,6 +854,7 @@ namespace NamespaceTests {
add< NamespaceDetailsTests::SingleAlloc >();
add< NamespaceDetailsTests::Realloc >();
add< NamespaceDetailsTests::TwoExtent >();
+ add< NamespaceDetailsTests::TruncateCapped >();
add< NamespaceDetailsTests::Migrate >();
// add< NamespaceDetailsTests::BigCollection >();
add< NamespaceDetailsTests::Size >();
diff --git a/dbtests/pairingtests.cpp b/dbtests/pairingtests.cpp
index e832310..68d4c0e 100644
--- a/dbtests/pairingtests.cpp
+++ b/dbtests/pairingtests.cpp
@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
-#include "../db/replset.h"
+#include "pch.h"
+#include "../db/replpair.h"
#include "dbtests.h"
#include "mockdbclient.h"
#include "../db/cmdline.h"
@@ -195,7 +195,7 @@ namespace PairingTests {
TestableReplPair rp3( true, fromjson( "{ok:0}" ) );
rp3.arbitrate();
- ASSERT( rp3.state == ReplPair::State_Confused );
+ ASSERT_EQUALS( rp3.state , ReplPair::State_Confused );
TestableReplPair rp4( true, fromjson( "{ok:1,you_are:1}" ) );
rp4.arbitrate();
diff --git a/dbtests/pdfiletests.cpp b/dbtests/pdfiletests.cpp
index fbacf8b..7e92783 100644
--- a/dbtests/pdfiletests.cpp
+++ b/dbtests/pdfiletests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/pdfile.h"
#include "../db/db.h"
@@ -46,13 +46,13 @@ namespace PdfileTests {
ASSERT( userCreateNS( ns(), fromjson( spec.str() ), err, false ) );
prepare();
int j = 0;
- for ( auto_ptr< Cursor > i = theDataFileMgr.findAll( ns() );
+ for ( boost::shared_ptr<Cursor> i = theDataFileMgr.findAll( ns() );
i->ok(); i->advance(), ++j )
ASSERT_EQUALS( j, i->current().firstElement().number() );
ASSERT_EQUALS( count(), j );
j = count() - 1;
- for ( auto_ptr< Cursor > i =
+ for ( boost::shared_ptr<Cursor> i =
findTableScan( ns(), fromjson( "{\"$natural\":-1}" ) );
i->ok(); i->advance(), --j )
ASSERT_EQUALS( j, i->current().firstElement().number() );
@@ -73,7 +73,7 @@ namespace PdfileTests {
Extent *e = ext.ext();
int ofs;
if ( e->lastRecord.isNull() )
- ofs = ext.getOfs() + ( e->extentData - (char *)e );
+ ofs = ext.getOfs() + ( e->_extentData - (char *)e );
else
ofs = e->lastRecord.getOfs() + e->lastRecord.rec()->lengthWithHeaders;
DiskLoc dl( ext.a(), ofs );
@@ -296,7 +296,7 @@ namespace PdfileTests {
b.appendTimestamp( "a" );
BSONObj o = b.done();
ASSERT( 0 == o.getField( "a" ).date() );
- theDataFileMgr.insert( ns(), o );
+ theDataFileMgr.insertWithObjMod( ns(), o );
ASSERT( 0 != o.getField( "a" ).date() );
}
};
diff --git a/dbtests/perf/perftest.cpp b/dbtests/perf/perftest.cpp
index 02b2fad..f86a1c3 100644
--- a/dbtests/perf/perftest.cpp
+++ b/dbtests/perf/perftest.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../../client/dbclient.h"
#include "../../db/instance.h"
@@ -42,7 +42,7 @@ DBClientBase *client_;
// (ie allocation) work for another test.
template< class T >
string testDb( T *t = 0 ) {
- string name = mongo::regression::demangleName( typeid( T ) );
+ string name = mongo::demangleName( typeid( T ) );
// Make filesystem safe.
for( string::iterator i = name.begin(); i != name.end(); ++i )
if ( *i == ':' )
@@ -629,7 +629,7 @@ namespace Plan {
}
void run() {
for( int i = 0; i < 10000; ++i )
- QueryPlanSet s( ns_.c_str(), BSONObj(), BSONObj(), &hintElt_ );
+ MultiPlanScanner s( ns_.c_str(), BSONObj(), BSONObj(), &hintElt_ );
}
string ns_;
auto_ptr< dblock > lk_;
@@ -650,7 +650,7 @@ namespace Plan {
void run() {
Client::Context ctx( ns_ );
for( int i = 0; i < 10000; ++i )
- QueryPlanSet s( ns_.c_str(), BSONObj(), BSON( "a" << 1 ) );
+ MultiPlanScanner s( ns_.c_str(), BSONObj(), BSON( "a" << 1 ) );
}
string ns_;
auto_ptr< dblock > lk_;
@@ -669,7 +669,7 @@ namespace Plan {
void run() {
Client::Context ctx( ns_.c_str() );
for( int i = 0; i < 10000; ++i )
- QueryPlanSet s( ns_.c_str(), BSON( "a" << 1 ), BSONObj() );
+ MultiPlanScanner s( ns_.c_str(), BSON( "a" << 1 ), BSONObj() );
}
string ns_;
auto_ptr< dblock > lk_;
diff --git a/dbtests/queryoptimizertests.cpp b/dbtests/queryoptimizertests.cpp
index d757f1a..f5d1155 100644
--- a/dbtests/queryoptimizertests.cpp
+++ b/dbtests/queryoptimizertests.cpp
@@ -17,22 +17,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/queryoptimizer.h"
-
#include "../db/db.h"
#include "../db/dbhelpers.h"
#include "../db/instance.h"
#include "../db/query.h"
-
#include "dbtests.h"
namespace mongo {
extern BSONObj id_obj;
- auto_ptr< QueryResult > runQuery(Message& m, QueryMessage& q ){
+ void runQuery(Message& m, QueryMessage& q, Message &response ){
CurOp op( &(cc()) );
op.ensureStarted();
- return runQuery( m , q , op );
+ runQuery( m , q , op, response );
+ }
+ void runQuery(Message& m, QueryMessage& q ){
+ Message response;
+ runQuery( m, q, response );
}
} // namespace mongo
@@ -43,7 +45,7 @@ namespace QueryOptimizerTests {
public:
virtual ~Base() {}
void run() {
- FieldRangeSet s( "ns", query() );
+ const FieldRangeSet s( "ns", query() );
checkElt( lower(), s.range( "a" ).min() );
checkElt( upper(), s.range( "a" ).max() );
ASSERT_EQUALS( lowerInclusive(), s.range( "a" ).minInclusive() );
@@ -57,9 +59,8 @@ namespace QueryOptimizerTests {
virtual bool upperInclusive() { return true; }
static void checkElt( BSONElement expected, BSONElement actual ) {
if ( expected.woCompare( actual, false ) ) {
- stringstream ss;
- ss << "expected: " << expected << ", got: " << actual;
- FAIL( ss.str() );
+ log() << "expected: " << expected << ", got: " << actual;
+ ASSERT( false );
}
}
};
@@ -130,7 +131,7 @@ namespace QueryOptimizerTests {
class TwoGt : public Gt {
virtual BSONObj query() { return BSON( "a" << GT << 0 << GT << 1 ); }
};
-
+
class EqGte : public Eq {
virtual BSONObj query() { return BSON( "a" << 1 << "a" << GTE << 1 ); }
};
@@ -146,10 +147,10 @@ namespace QueryOptimizerTests {
struct RegexBase : Base {
void run() { //need to only look at first interval
FieldRangeSet s( "ns", query() );
- checkElt( lower(), s.range( "a" ).intervals()[0].lower_.bound_ );
- checkElt( upper(), s.range( "a" ).intervals()[0].upper_.bound_ );
- ASSERT_EQUALS( lowerInclusive(), s.range( "a" ).intervals()[0].lower_.inclusive_ );
- ASSERT_EQUALS( upperInclusive(), s.range( "a" ).intervals()[0].upper_.inclusive_ );
+ checkElt( lower(), s.range( "a" ).intervals()[0]._lower._bound );
+ checkElt( upper(), s.range( "a" ).intervals()[0]._upper._bound );
+ ASSERT_EQUALS( lowerInclusive(), s.range( "a" ).intervals()[0]._lower._inclusive );
+ ASSERT_EQUALS( upperInclusive(), s.range( "a" ).intervals()[0]._upper._inclusive );
}
};
@@ -325,14 +326,374 @@ namespace QueryOptimizerTests {
vector< FieldInterval >::const_iterator j = intervals.begin();
double expected[] = { 3, 5, 9 };
for( int i = 0; i < 3; ++i, ++j ) {
- ASSERT_EQUALS( expected[ i ], j->lower_.bound_.number() );
- ASSERT( j->lower_.inclusive_ );
- ASSERT( j->lower_ == j->upper_ );
+ ASSERT_EQUALS( expected[ i ], j->_lower._bound.number() );
+ ASSERT( j->_lower._inclusive );
+ ASSERT( j->_lower == j->_upper );
}
ASSERT( j == intervals.end() );
}
};
+ class DiffBase {
+ public:
+ virtual ~DiffBase() {}
+ void run() {
+ FieldRangeSet frs( "", fromjson( obj().toString() ) );
+ FieldRange ret = frs.range( "a" );
+ ret -= frs.range( "b" );
+ check( ret );
+ }
+ protected:
+ void check( const FieldRange &fr ) {
+ vector< FieldInterval > fi = fr.intervals();
+ ASSERT_EQUALS( len(), fi.size() );
+ int i = 0;
+ for( vector< FieldInterval >::const_iterator j = fi.begin(); j != fi.end(); ++j ) {
+ ASSERT_EQUALS( nums()[ i ], j->_lower._bound.numberInt() );
+ ASSERT_EQUALS( incs()[ i ], j->_lower._inclusive );
+ ++i;
+ ASSERT_EQUALS( nums()[ i ], j->_upper._bound.numberInt() );
+ ASSERT_EQUALS( incs()[ i ], j->_upper._inclusive );
+ ++i;
+ }
+ }
+ virtual unsigned len() const = 0;
+ virtual const int *nums() const = 0;
+ virtual const bool *incs() const = 0;
+ virtual BSONObj obj() const = 0;
+ };
+
+ class TwoRangeBase : public DiffBase {
+ public:
+ TwoRangeBase( string obj, int low, int high, bool lowI, bool highI )
+ : _obj( obj ) {
+ _n[ 0 ] = low;
+ _n[ 1 ] = high;
+ _b[ 0 ] = lowI;
+ _b[ 1 ] = highI;
+ }
+ private:
+ virtual unsigned len() const { return 1; }
+ virtual const int *nums() const { return _n; }
+ virtual const bool *incs() const { return _b; }
+ virtual BSONObj obj() const { return fromjson( _obj ); }
+ string _obj;
+ int _n[ 2 ];
+ bool _b[ 2 ];
+ };
+
+ struct Diff1 : public TwoRangeBase {
+ Diff1() : TwoRangeBase( "{a:{$gt:1,$lt:2},b:{$gt:3,$lt:4}}", 1, 2, false, false ) {}
+ };
+
+ struct Diff2 : public TwoRangeBase {
+ Diff2() : TwoRangeBase( "{a:{$gt:1,$lt:2},b:{$gt:2,$lt:4}}", 1, 2, false, false ) {}
+ };
+
+ struct Diff3 : public TwoRangeBase {
+ Diff3() : TwoRangeBase( "{a:{$gt:1,$lte:2},b:{$gt:2,$lt:4}}", 1, 2, false, true ) {}
+ };
+
+ struct Diff4 : public TwoRangeBase {
+ Diff4() : TwoRangeBase( "{a:{$gt:1,$lt:2},b:{$gte:2,$lt:4}}", 1, 2, false, false) {}
+ };
+
+ struct Diff5 : public TwoRangeBase {
+ Diff5() : TwoRangeBase( "{a:{$gt:1,$lte:2},b:{$gte:2,$lt:4}}", 1, 2, false, false) {}
+ };
+
+ struct Diff6 : public TwoRangeBase {
+ Diff6() : TwoRangeBase( "{a:{$gt:1,$lte:3},b:{$gte:2,$lt:4}}", 1, 2, false, false) {}
+ };
+
+ struct Diff7 : public TwoRangeBase {
+ Diff7() : TwoRangeBase( "{a:{$gt:1,$lte:3},b:{$gt:2,$lt:4}}", 1, 2, false, true) {}
+ };
+
+ struct Diff8 : public TwoRangeBase {
+ Diff8() : TwoRangeBase( "{a:{$gt:1,$lt:4},b:{$gt:2,$lt:4}}", 1, 2, false, true) {}
+ };
+
+ struct Diff9 : public TwoRangeBase {
+ Diff9() : TwoRangeBase( "{a:{$gt:1,$lt:4},b:{$gt:2,$lte:4}}", 1, 2, false, true) {}
+ };
+
+ struct Diff10 : public TwoRangeBase {
+ Diff10() : TwoRangeBase( "{a:{$gt:1,$lte:4},b:{$gt:2,$lte:4}}", 1, 2, false, true) {}
+ };
+
+ struct Diff11 : public TwoRangeBase {
+ Diff11() : TwoRangeBase( "{a:{$gt:1,$lte:4},b:{$gt:2,$lt:4}}", 1, 4, false, true) {}
+ };
+
+ struct Diff12 : public TwoRangeBase {
+ Diff12() : TwoRangeBase( "{a:{$gt:1,$lt:5},b:{$gt:2,$lt:4}}", 1, 5, false, false) {}
+ };
+
+ struct Diff13 : public TwoRangeBase {
+ Diff13() : TwoRangeBase( "{a:{$gt:1,$lt:5},b:{$gt:1,$lt:4}}", 4, 5, true, false) {}
+ };
+
+ struct Diff14 : public TwoRangeBase {
+ Diff14() : TwoRangeBase( "{a:{$gte:1,$lt:5},b:{$gt:1,$lt:4}}", 1, 5, true, false) {}
+ };
+
+ struct Diff15 : public TwoRangeBase {
+ Diff15() : TwoRangeBase( "{a:{$gt:1,$lt:5},b:{$gte:1,$lt:4}}", 4, 5, true, false) {}
+ };
+
+ struct Diff16 : public TwoRangeBase {
+ Diff16() : TwoRangeBase( "{a:{$gte:1,$lt:5},b:{$gte:1,$lt:4}}", 4, 5, true, false) {}
+ };
+
+ struct Diff17 : public TwoRangeBase {
+ Diff17() : TwoRangeBase( "{a:{$gt:1,$lt:5},b:{$gt:0,$lt:4}}", 4, 5, true, false) {}
+ };
+
+ struct Diff18 : public TwoRangeBase {
+ Diff18() : TwoRangeBase( "{a:{$gt:1,$lt:5},b:{$gt:0,$lte:4}}", 4, 5, false, false) {}
+ };
+
+ struct Diff19 : public TwoRangeBase {
+ Diff19() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:{$gte:0,$lte:1}}", 1, 5, false, true) {}
+ };
+
+ struct Diff20 : public TwoRangeBase {
+ Diff20() : TwoRangeBase( "{a:{$gt:1,$lte:5},b:{$gte:0,$lte:1}}", 1, 5, false, true) {}
+ };
+
+ struct Diff21 : public TwoRangeBase {
+ Diff21() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:{$gte:0,$lt:1}}", 1, 5, true, true) {}
+ };
+
+ struct Diff22 : public TwoRangeBase {
+ Diff22() : TwoRangeBase( "{a:{$gt:1,$lte:5},b:{$gte:0,$lt:1}}", 1, 5, false, true) {}
+ };
+
+ struct Diff23 : public TwoRangeBase {
+ Diff23() : TwoRangeBase( "{a:{$gt:1,$lte:5},b:{$gte:0,$lt:0.5}}", 1, 5, false, true) {}
+ };
+
+ struct Diff24 : public TwoRangeBase {
+ Diff24() : TwoRangeBase( "{a:{$gt:1,$lte:5},b:0}", 1, 5, false, true) {}
+ };
+
+ struct Diff25 : public TwoRangeBase {
+ Diff25() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:0}", 1, 5, true, true) {}
+ };
+
+ struct Diff26 : public TwoRangeBase {
+ Diff26() : TwoRangeBase( "{a:{$gt:1,$lte:5},b:1}", 1, 5, false, true) {}
+ };
+
+ struct Diff27 : public TwoRangeBase {
+ Diff27() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:1}", 1, 5, false, true) {}
+ };
+
+ struct Diff28 : public TwoRangeBase {
+ Diff28() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:3}", 1, 5, true, true) {}
+ };
+
+ struct Diff29 : public TwoRangeBase {
+ Diff29() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:5}", 1, 5, true, false) {}
+ };
+
+ struct Diff30 : public TwoRangeBase {
+ Diff30() : TwoRangeBase( "{a:{$gte:1,$lt:5},b:5}", 1, 5, true, false) {}
+ };
+
+ struct Diff31 : public TwoRangeBase {
+ Diff31() : TwoRangeBase( "{a:{$gte:1,$lt:5},b:6}", 1, 5, true, false) {}
+ };
+
+ struct Diff32 : public TwoRangeBase {
+ Diff32() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:6}", 1, 5, true, true) {}
+ };
+
+ class EmptyBase : public DiffBase {
+ public:
+ EmptyBase( string obj )
+ : _obj( obj ) {}
+ private:
+ virtual unsigned len() const { return 0; }
+ virtual const int *nums() const { return 0; }
+ virtual const bool *incs() const { return 0; }
+ virtual BSONObj obj() const { return fromjson( _obj ); }
+ string _obj;
+ };
+
+ struct Diff33 : public EmptyBase {
+ Diff33() : EmptyBase( "{a:{$gte:1,$lte:5},b:{$gt:0,$lt:6}}" ) {}
+ };
+
+ struct Diff34 : public EmptyBase {
+ Diff34() : EmptyBase( "{a:{$gte:1,$lte:5},b:{$gte:1,$lt:6}}" ) {}
+ };
+
+ struct Diff35 : public EmptyBase {
+ Diff35() : EmptyBase( "{a:{$gt:1,$lte:5},b:{$gte:1,$lt:6}}" ) {}
+ };
+
+ struct Diff36 : public EmptyBase {
+ Diff36() : EmptyBase( "{a:{$gt:1,$lte:5},b:{$gt:1,$lt:6}}" ) {}
+ };
+
+ struct Diff37 : public TwoRangeBase {
+ Diff37() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:{$gt:1,$lt:6}}", 1, 1, true, true ) {}
+ };
+
+ struct Diff38 : public EmptyBase {
+ Diff38() : EmptyBase( "{a:{$gt:1,$lt:5},b:{$gt:0,$lt:5}}" ) {}
+ };
+
+ struct Diff39 : public EmptyBase {
+ Diff39() : EmptyBase( "{a:{$gt:1,$lt:5},b:{$gt:0,$lte:5}}" ) {}
+ };
+
+ struct Diff40 : public EmptyBase {
+ Diff40() : EmptyBase( "{a:{$gt:1,$lte:5},b:{$gt:0,$lte:5}}" ) {}
+ };
+
+ struct Diff41 : public TwoRangeBase {
+ Diff41() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:{$gt:0,$lt:5}}", 5, 5, true, true ) {}
+ };
+
+ struct Diff42 : public EmptyBase {
+ Diff42() : EmptyBase( "{a:{$gt:1,$lt:5},b:{$gt:1,$lt:5}}" ) {}
+ };
+
+ struct Diff43 : public EmptyBase {
+ Diff43() : EmptyBase( "{a:{$gt:1,$lt:5},b:{$gt:1,$lte:5}}" ) {}
+ };
+
+ struct Diff44 : public EmptyBase {
+ Diff44() : EmptyBase( "{a:{$gt:1,$lt:5},b:{$gte:1,$lt:5}}" ) {}
+ };
+
+ struct Diff45 : public EmptyBase {
+ Diff45() : EmptyBase( "{a:{$gt:1,$lt:5},b:{$gte:1,$lte:5}}" ) {}
+ };
+
+ struct Diff46 : public TwoRangeBase {
+ Diff46() : TwoRangeBase( "{a:{$gt:1,$lte:5},b:{$gt:1,$lt:5}}", 5, 5, true, true ) {}
+ };
+
+ struct Diff47 : public EmptyBase {
+ Diff47() : EmptyBase( "{a:{$gt:1,$lte:5},b:{$gt:1,$lte:5}}" ) {}
+ };
+
+ struct Diff48 : public TwoRangeBase {
+ Diff48() : TwoRangeBase( "{a:{$gt:1,$lte:5},b:{$gte:1,$lt:5}}", 5, 5, true, true ) {}
+ };
+
+ struct Diff49 : public EmptyBase {
+ Diff49() : EmptyBase( "{a:{$gt:1,$lte:5},b:{$gte:1,$lte:5}}" ) {}
+ };
+
+ struct Diff50 : public TwoRangeBase {
+ Diff50() : TwoRangeBase( "{a:{$gte:1,$lt:5},b:{$gt:1,$lt:5}}", 1, 1, true, true ) {}
+ };
+
+ struct Diff51 : public TwoRangeBase {
+ Diff51() : TwoRangeBase( "{a:{$gte:1,$lt:5},b:{$gt:1,$lte:5}}", 1, 1, true, true ) {}
+ };
+
+ struct Diff52 : public EmptyBase {
+ Diff52() : EmptyBase( "{a:{$gte:1,$lt:5},b:{$gte:1,$lt:5}}" ) {}
+ };
+
+ struct Diff53 : public EmptyBase {
+ Diff53() : EmptyBase( "{a:{$gte:1,$lt:5},b:{$gte:1,$lte:5}}" ) {}
+ };
+
+ struct Diff54 : public TwoRangeBase {
+ Diff54() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:{$gt:1,$lt:5}}", 1, 5, true, true ) {}
+ };
+
+ struct Diff55 : public TwoRangeBase {
+ Diff55() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:{$gt:1,$lte:5}}", 1, 1, true, true ) {}
+ };
+
+ struct Diff56 : public TwoRangeBase {
+ Diff56() : TwoRangeBase( "{a:{$gte:1,$lte:5},b:{$gte:1,$lt:5}}", 5, 5, true, true ) {}
+ };
+
+ struct Diff57 : public EmptyBase {
+ Diff57() : EmptyBase( "{a:{$gte:1,$lte:5},b:{$gte:1,$lte:5}}" ) {}
+ };
+
+ struct Diff58 : public TwoRangeBase {
+ Diff58() : TwoRangeBase( "{a:1,b:{$gt:1,$lt:5}}", 1, 1, true, true ) {}
+ };
+
+ struct Diff59 : public EmptyBase {
+ Diff59() : EmptyBase( "{a:1,b:{$gte:1,$lt:5}}" ) {}
+ };
+
+ struct Diff60 : public EmptyBase {
+ Diff60() : EmptyBase( "{a:2,b:{$gte:1,$lt:5}}" ) {}
+ };
+
+ struct Diff61 : public EmptyBase {
+ Diff61() : EmptyBase( "{a:5,b:{$gte:1,$lte:5}}" ) {}
+ };
+
+ struct Diff62 : public TwoRangeBase {
+ Diff62() : TwoRangeBase( "{a:5,b:{$gt:1,$lt:5}}", 5, 5, true, true ) {}
+ };
+
+ struct Diff63 : public EmptyBase {
+ Diff63() : EmptyBase( "{a:5,b:5}" ) {}
+ };
+
+ class DiffMulti1 : public DiffBase {
+ public:
+ void run() {
+ FieldRangeSet frs( "", fromjson( "{a:{$gt:1,$lt:9},b:{$gt:0,$lt:2},c:3,d:{$gt:4,$lt:5},e:{$gt:7,$lt:10}}" ) );
+ FieldRange ret = frs.range( "a" );
+ FieldRange other = frs.range( "b" );
+ other |= frs.range( "c" );
+ other |= frs.range( "d" );
+ other |= frs.range( "e" );
+ ret -= other;
+ check( ret );
+ }
+ protected:
+ virtual unsigned len() const { return 1; }
+ virtual const int *nums() const { static int n[] = { 2, 7 }; return n; }
+ virtual const bool *incs() const { static bool b[] = { true, true }; return b; }
+ virtual BSONObj obj() const { return BSONObj(); }
+ };
+
+ class DiffMulti2 : public DiffBase {
+ public:
+ void run() {
+ FieldRangeSet frs( "", fromjson( "{a:{$gt:1,$lt:9},b:{$gt:0,$lt:2},c:3,d:{$gt:4,$lt:5},e:{$gt:7,$lt:10}}" ) );
+ FieldRange mask = frs.range( "a" );
+ FieldRange ret = frs.range( "b" );
+ ret |= frs.range( "c" );
+ ret |= frs.range( "d" );
+ ret |= frs.range( "e" );
+ ret -= mask;
+ check( ret );
+ }
+ protected:
+ virtual unsigned len() const { return 2; }
+ virtual const int *nums() const { static int n[] = { 0, 1, 9, 10 }; return n; }
+ virtual const bool *incs() const { static bool b[] = { false, true, true, false }; return b; }
+ virtual BSONObj obj() const { return BSONObj(); }
+ };
+
+ class SetIntersect {
+ public:
+ void run() {
+ FieldRangeSet frs1( "", fromjson( "{b:{$in:[5,6]},c:7,d:{$in:[8,9]}}" ) );
+ FieldRangeSet frs2( "", fromjson( "{a:1,b:5,c:{$in:[7,8]},d:{$in:[8,9]},e:10}" ) );
+ frs1 &= frs2;
+ ASSERT_EQUALS( fromjson( "{a:1,b:5,c:7,d:{$gte:8,$lte:9},e:10}" ), frs1.simplifiedQuery( BSONObj() ) );
+ }
+ };
+
} // namespace FieldRangeTests
namespace QueryPlanTests {
@@ -369,12 +730,10 @@ namespace QueryOptimizerTests {
return nsd()->idxNo( *index(key) );
}
BSONObj startKey( const QueryPlan &p ) const {
- BoundList bl = p.indexBounds();
- return bl[ 0 ].first.getOwned();
+ return p.frv()->startKey();
}
BSONObj endKey( const QueryPlan &p ) const {
- BoundList bl = p.indexBounds();
- return bl[ bl.size() - 1 ].second.getOwned();
+ return p.frv()->endKey();
}
private:
dblock lk_;
@@ -393,7 +752,7 @@ namespace QueryOptimizerTests {
class NoIndex : public Base {
public:
void run() {
- QueryPlan p( nsd(), -1, FBS( BSONObj() ), BSONObj() );
+ QueryPlan p( nsd(), -1, FBS( BSONObj() ), BSONObj(), BSONObj() );
ASSERT( !p.optimal() );
ASSERT( !p.scanAndOrderRequired() );
ASSERT( !p.exactKeyMatch() );
@@ -410,13 +769,13 @@ namespace QueryOptimizerTests {
b2.appendMaxKey( "" );
BSONObj end = b2.obj();
- QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 ) );
ASSERT( !p.scanAndOrderRequired() );
ASSERT( !startKey( p ).woCompare( start ) );
ASSERT( !endKey( p ).woCompare( end ) );
- QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 << "b" << 1 ) );
+ QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 << "b" << 1 ) );
ASSERT( !p2.scanAndOrderRequired() );
- QueryPlan p3( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSON( "b" << 1 ) );
+ QueryPlan p3( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "b" << 1 ) );
ASSERT( p3.scanAndOrderRequired() );
ASSERT( !startKey( p3 ).woCompare( start ) );
ASSERT( !endKey( p3 ).woCompare( end ) );
@@ -426,7 +785,7 @@ namespace QueryOptimizerTests {
class MoreIndexThanNeeded : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 ) );
ASSERT( !p.scanAndOrderRequired() );
}
};
@@ -434,13 +793,13 @@ namespace QueryOptimizerTests {
class IndexSigns : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << -1 ) , FBS( BSONObj() ), BSON( "a" << 1 << "b" << -1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << -1 ) , FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 << "b" << -1 ) );
ASSERT( !p.scanAndOrderRequired() );
ASSERT_EQUALS( 1, p.direction() );
- QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 << "b" << -1 ) );
+ QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 << "b" << -1 ) );
ASSERT( p2.scanAndOrderRequired() );
ASSERT_EQUALS( 0, p2.direction() );
- QueryPlan p3( nsd(), indexno( id_obj ), FBS( BSONObj() ), BSON( "_id" << 1 ) );
+ QueryPlan p3( nsd(), indexno( id_obj ), FBS( BSONObj() ), BSONObj(), BSON( "_id" << 1 ) );
ASSERT( !p3.scanAndOrderRequired() );
ASSERT_EQUALS( 1, p3.direction() );
}
@@ -457,15 +816,15 @@ namespace QueryOptimizerTests {
b2.appendMaxKey( "" );
b2.appendMinKey( "" );
BSONObj end = b2.obj();
- QueryPlan p( nsd(), INDEXNO( "a" << -1 << "b" << 1 ),FBS( BSONObj() ), BSON( "a" << 1 << "b" << -1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << -1 << "b" << 1 ),FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 << "b" << -1 ) );
ASSERT( !p.scanAndOrderRequired() );
ASSERT_EQUALS( -1, p.direction() );
ASSERT( !startKey( p ).woCompare( start ) );
ASSERT( !endKey( p ).woCompare( end ) );
- QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSON( "a" << -1 << "b" << -1 ) );
+ QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << -1 << "b" << -1 ) );
ASSERT( !p2.scanAndOrderRequired() );
ASSERT_EQUALS( -1, p2.direction() );
- QueryPlan p3( nsd(), INDEXNO( "a" << 1 << "b" << -1 ), FBS( BSONObj() ), BSON( "a" << -1 << "b" << -1 ) );
+ QueryPlan p3( nsd(), INDEXNO( "a" << 1 << "b" << -1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << -1 << "b" << -1 ) );
ASSERT( p3.scanAndOrderRequired() );
ASSERT_EQUALS( 0, p3.direction() );
}
@@ -482,11 +841,11 @@ namespace QueryOptimizerTests {
b2.append( "", 3 );
b2.appendMaxKey( "" );
BSONObj end = b2.obj();
- QueryPlan p( nsd(), INDEXNO( "a" << -1 << "b" << 1 ), FBS( BSON( "a" << 3 ) ), BSONObj() );
+ QueryPlan p( nsd(), INDEXNO( "a" << -1 << "b" << 1 ), FBS( BSON( "a" << 3 ) ), BSON( "a" << 3 ), BSONObj() );
ASSERT( !p.scanAndOrderRequired() );
ASSERT( !startKey( p ).woCompare( start ) );
ASSERT( !endKey( p ).woCompare( end ) );
- QueryPlan p2( nsd(), INDEXNO( "a" << -1 << "b" << 1 ), FBS( BSON( "a" << 3 ) ), BSONObj() );
+ QueryPlan p2( nsd(), INDEXNO( "a" << -1 << "b" << 1 ), FBS( BSON( "a" << 3 ) ), BSON( "a" << 3 ), BSONObj() );
ASSERT( !p2.scanAndOrderRequired() );
ASSERT( !startKey( p ).woCompare( start ) );
ASSERT( !endKey( p ).woCompare( end ) );
@@ -496,11 +855,11 @@ namespace QueryOptimizerTests {
class EqualWithOrder : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 4 ) ), BSON( "b" << 1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 4 ) ), BSON( "a" << 4 ), BSON( "b" << 1 ) );
ASSERT( !p.scanAndOrderRequired() );
- QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "b" << 4 ) ), BSON( "a" << 1 << "c" << 1 ) );
+ QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "b" << 4 ) ), BSON( "b" << 4 ), BSON( "a" << 1 << "c" << 1 ) );
ASSERT( !p2.scanAndOrderRequired() );
- QueryPlan p3( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 4 ) ), BSON( "a" << 1 << "c" << 1 ) );
+ QueryPlan p3( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 4 ) ), BSON( "b" << 4 ), BSON( "a" << 1 << "c" << 1 ) );
ASSERT( p3.scanAndOrderRequired() );
}
};
@@ -508,23 +867,23 @@ namespace QueryOptimizerTests {
class Optimal : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 ) );
ASSERT( p.optimal() );
- QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 ) );
+ QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 ) );
ASSERT( p2.optimal() );
- QueryPlan p3( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 ) ), BSON( "a" << 1 ) );
+ QueryPlan p3( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 ) ), BSON( "a" << 1 ), BSON( "a" << 1 ) );
ASSERT( p3.optimal() );
- QueryPlan p4( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 ) ), BSON( "a" << 1 ) );
+ QueryPlan p4( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 ) ), BSON( "b" << 1 ), BSON( "a" << 1 ) );
ASSERT( !p4.optimal() );
- QueryPlan p5( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 ) ), BSON( "b" << 1 ) );
+ QueryPlan p5( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 ) ), BSON( "a" << 1 ), BSON( "b" << 1 ) );
ASSERT( p5.optimal() );
- QueryPlan p6( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 ) ), BSON( "b" << 1 ) );
+ QueryPlan p6( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 ) ), BSON( "b" << 1 ), BSON( "b" << 1 ) );
ASSERT( !p6.optimal() );
- QueryPlan p7( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 << "b" << 1 ) ), BSON( "a" << 1 ) );
+ QueryPlan p7( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 << "b" << 1 ) ), BSON( "a" << 1 << "b" << 1 ), BSON( "a" << 1 ) );
ASSERT( p7.optimal() );
- QueryPlan p8( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 << "b" << LT << 1 ) ), BSON( "a" << 1 ) );
+ QueryPlan p8( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << 1 << "b" << LT << 1 ) ), BSON( "a" << 1 << "b" << LT << 1 ), BSON( "a" << 1 ) );
ASSERT( p8.optimal() );
- QueryPlan p9( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << 1 << "b" << LT << 1 ) ), BSON( "a" << 1 ) );
+ QueryPlan p9( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << 1 << "b" << LT << 1 ) ), BSON( "a" << 1 << "b" << LT << 1 ), BSON( "a" << 1 ) );
ASSERT( p9.optimal() );
}
};
@@ -532,13 +891,13 @@ namespace QueryOptimizerTests {
class MoreOptimal : public Base {
public:
void run() {
- QueryPlan p10( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << 1 ) ), BSONObj() );
+ QueryPlan p10( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << 1 ) ), BSON( "a" << 1 ), BSONObj() );
ASSERT( p10.optimal() );
- QueryPlan p11( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << 1 << "b" << LT << 1 ) ), BSONObj() );
+ QueryPlan p11( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << 1 << "b" << LT << 1 ) ), BSON( "a" << 1 << "b" << LT << 1 ), BSONObj() );
ASSERT( p11.optimal() );
- QueryPlan p12( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << LT << 1 ) ), BSONObj() );
+ QueryPlan p12( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << LT << 1 ) ), BSON( "a" << LT << 1 ), BSONObj() );
ASSERT( p12.optimal() );
- QueryPlan p13( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << LT << 1 ) ), BSON( "a" << 1 ) );
+ QueryPlan p13( nsd(), INDEXNO( "a" << 1 << "b" << 1 << "c" << 1 ), FBS( BSON( "a" << LT << 1 ) ), BSON( "a" << LT << 1 ), BSON( "a" << 1 ) );
ASSERT( p13.optimal() );
}
};
@@ -546,23 +905,23 @@ namespace QueryOptimizerTests {
class KeyMatch : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 ) );
ASSERT( !p.exactKeyMatch() );
- QueryPlan p2( nsd(), INDEXNO( "b" << 1 << "a" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 ) );
+ QueryPlan p2( nsd(), INDEXNO( "b" << 1 << "a" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 ) );
ASSERT( !p2.exactKeyMatch() );
- QueryPlan p3( nsd(), INDEXNO( "b" << 1 << "a" << 1 ), FBS( BSON( "b" << "z" ) ), BSON( "a" << 1 ) );
+ QueryPlan p3( nsd(), INDEXNO( "b" << 1 << "a" << 1 ), FBS( BSON( "b" << "z" ) ), BSON( "b" << "z" ), BSON( "a" << 1 ) );
ASSERT( !p3.exactKeyMatch() );
- QueryPlan p4( nsd(), INDEXNO( "b" << 1 << "a" << 1 << "c" << 1 ), FBS( BSON( "c" << "y" << "b" << "z" ) ), BSON( "a" << 1 ) );
+ QueryPlan p4( nsd(), INDEXNO( "b" << 1 << "a" << 1 << "c" << 1 ), FBS( BSON( "c" << "y" << "b" << "z" ) ), BSON( "c" << "y" << "b" << "z" ), BSON( "a" << 1 ) );
ASSERT( !p4.exactKeyMatch() );
- QueryPlan p5( nsd(), INDEXNO( "b" << 1 << "a" << 1 << "c" << 1 ), FBS( BSON( "c" << "y" << "b" << "z" ) ), BSONObj() );
+ QueryPlan p5( nsd(), INDEXNO( "b" << 1 << "a" << 1 << "c" << 1 ), FBS( BSON( "c" << "y" << "b" << "z" ) ), BSON( "c" << "y" << "b" << "z" ), BSONObj() );
ASSERT( !p5.exactKeyMatch() );
- QueryPlan p6( nsd(), INDEXNO( "b" << 1 << "a" << 1 << "c" << 1 ), FBS( BSON( "c" << LT << "y" << "b" << GT << "z" ) ), BSONObj() );
+ QueryPlan p6( nsd(), INDEXNO( "b" << 1 << "a" << 1 << "c" << 1 ), FBS( BSON( "c" << LT << "y" << "b" << GT << "z" ) ), BSON( "c" << LT << "y" << "b" << GT << "z" ), BSONObj() );
ASSERT( !p6.exactKeyMatch() );
- QueryPlan p7( nsd(), INDEXNO( "b" << 1 ), FBS( BSONObj() ), BSON( "a" << 1 ) );
+ QueryPlan p7( nsd(), INDEXNO( "b" << 1 ), FBS( BSONObj() ), BSONObj(), BSON( "a" << 1 ) );
ASSERT( !p7.exactKeyMatch() );
- QueryPlan p8( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << "y" << "a" << "z" ) ), BSONObj() );
+ QueryPlan p8( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << "y" << "a" << "z" ) ), BSON( "b" << "y" << "a" << "z" ), BSONObj() );
ASSERT( p8.exactKeyMatch() );
- QueryPlan p9( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << "z" ) ), BSON( "a" << 1 ) );
+ QueryPlan p9( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << "z" ) ), BSON( "a" << "z" ), BSON( "a" << 1 ) );
ASSERT( p9.exactKeyMatch() );
}
};
@@ -570,7 +929,7 @@ namespace QueryOptimizerTests {
class MoreKeyMatch : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << "r" << "b" << NE << "q" ) ), BSON( "a" << 1 ) );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << "r" << "b" << NE << "q" ) ), BSON( "a" << "r" << "b" << NE << "q" ), BSON( "a" << 1 ) );
ASSERT( !p.exactKeyMatch() );
}
};
@@ -578,17 +937,18 @@ namespace QueryOptimizerTests {
class ExactKeyQueryTypes : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << "b" ) ), BSONObj() );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << "b" ) ), BSON( "a" << "b" ), BSONObj() );
ASSERT( p.exactKeyMatch() );
- QueryPlan p2( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << 4 ) ), BSONObj() );
+ QueryPlan p2( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << 4 ) ), BSON( "a" << 4 ), BSONObj() );
ASSERT( !p2.exactKeyMatch() );
- QueryPlan p3( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << BSON( "c" << "d" ) ) ), BSONObj() );
+ QueryPlan p3( nsd(), INDEXNO( "a" << 1 ), FBS( BSON( "a" << BSON( "c" << "d" ) ) ), BSON( "a" << BSON( "c" << "d" ) ), BSONObj() );
ASSERT( !p3.exactKeyMatch() );
BSONObjBuilder b;
b.appendRegex( "a", "^ddd" );
- QueryPlan p4( nsd(), INDEXNO( "a" << 1 ), FBS( b.obj() ), BSONObj() );
+ BSONObj q = b.obj();
+ QueryPlan p4( nsd(), INDEXNO( "a" << 1 ), FBS( q ), q, BSONObj() );
ASSERT( !p4.exactKeyMatch() );
- QueryPlan p5( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << "z" << "b" << 4 ) ), BSONObj() );
+ QueryPlan p5( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "a" << "z" << "b" << 4 ) ), BSON( "a" << "z" << "b" << 4 ), BSONObj() );
ASSERT( !p5.exactKeyMatch() );
}
};
@@ -596,17 +956,17 @@ namespace QueryOptimizerTests {
class Unhelpful : public Base {
public:
void run() {
- QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 ) ), BSONObj() );
+ QueryPlan p( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 ) ), BSON( "b" << 1 ), BSONObj() );
ASSERT( !p.range( "a" ).nontrivial() );
ASSERT( p.unhelpful() );
- QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 << "c" << 1 ) ), BSON( "a" << 1 ) );
+ QueryPlan p2( nsd(), INDEXNO( "a" << 1 << "b" << 1 ), FBS( BSON( "b" << 1 << "c" << 1 ) ), BSON( "b" << 1 << "c" << 1 ), BSON( "a" << 1 ) );
ASSERT( !p2.scanAndOrderRequired() );
ASSERT( !p2.range( "a" ).nontrivial() );
ASSERT( !p2.unhelpful() );
- QueryPlan p3( nsd(), INDEXNO( "b" << 1 ), FBS( BSON( "b" << 1 << "c" << 1 ) ), BSONObj() );
+ QueryPlan p3( nsd(), INDEXNO( "b" << 1 ), FBS( BSON( "b" << 1 << "c" << 1 ) ), BSON( "b" << 1 << "c" << 1 ), BSONObj() );
ASSERT( p3.range( "b" ).nontrivial() );
ASSERT( !p3.unhelpful() );
- QueryPlan p4( nsd(), INDEXNO( "b" << 1 << "c" << 1 ), FBS( BSON( "c" << 1 << "d" << 1 ) ), BSONObj() );
+ QueryPlan p4( nsd(), INDEXNO( "b" << 1 << "c" << 1 ), FBS( BSON( "c" << 1 << "d" << 1 ) ), BSON( "c" << 1 << "d" << 1 ), BSONObj() );
ASSERT( !p4.range( "b" ).nontrivial() );
ASSERT( p4.unhelpful() );
}
@@ -621,7 +981,7 @@ namespace QueryOptimizerTests {
string err;
userCreateNS( ns(), BSONObj(), err, false );
}
- ~Base() {
+ virtual ~Base() {
if ( !nsd() )
return;
NamespaceDetailsTransient::_get( ns() ).clearQueryCache();
@@ -632,10 +992,10 @@ namespace QueryOptimizerTests {
// see query.h for the protocol we are using here.
BufBuilder b;
int opts = queryOptions;
- b.append(opts);
- b.append(ns.c_str());
- b.append(nToSkip);
- b.append(nToReturn);
+ b.appendNum(opts);
+ b.appendStr(ns);
+ b.appendNum(nToSkip);
+ b.appendNum(nToReturn);
query.appendSelfToBufBuilder(b);
if ( fieldsToReturn )
fieldsToReturn->appendSelfToBufBuilder(b);
@@ -652,7 +1012,8 @@ namespace QueryOptimizerTests {
class NoIndexes : public Base {
public:
void run() {
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
ASSERT_EQUALS( 1, s.nPlans() );
}
};
@@ -662,7 +1023,8 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "b_2" );
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSONObj() );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSONObj() );
ASSERT_EQUALS( 1, s.nPlans() );
}
};
@@ -672,7 +1034,8 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
ASSERT_EQUALS( 3, s.nPlans() );
}
};
@@ -682,7 +1045,8 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
- QueryPlanSet s( ns(), BSONObj(), BSONObj() );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSONObj() ) );
+ QueryPlanSet s( ns(), frs, BSONObj(), BSONObj() );
ASSERT_EQUALS( 1, s.nPlans() );
}
};
@@ -694,7 +1058,8 @@ namespace QueryOptimizerTests {
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
BSONObj b = BSON( "hint" << BSON( "a" << 1 ) );
BSONElement e = b.firstElement();
- QueryPlanSet s( ns(), BSON( "a" << 1 ), BSON( "b" << 1 ), &e );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 1 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 1 ), BSON( "b" << 1 ), &e );
ASSERT_EQUALS( 1, s.nPlans() );
}
};
@@ -706,7 +1071,8 @@ namespace QueryOptimizerTests {
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
BSONObj b = BSON( "hint" << "a_1" );
BSONElement e = b.firstElement();
- QueryPlanSet s( ns(), BSON( "a" << 1 ), BSON( "b" << 1 ), &e );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 1 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 1 ), BSON( "b" << 1 ), &e );
ASSERT_EQUALS( 1, s.nPlans() );
}
};
@@ -718,7 +1084,8 @@ namespace QueryOptimizerTests {
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
BSONObj b = BSON( "hint" << BSON( "$natural" << 1 ) );
BSONElement e = b.firstElement();
- QueryPlanSet s( ns(), BSON( "a" << 1 ), BSON( "b" << 1 ), &e );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 1 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 1 ), BSON( "b" << 1 ), &e );
ASSERT_EQUALS( 1, s.nPlans() );
}
};
@@ -728,7 +1095,8 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "b_2" );
- QueryPlanSet s( ns(), BSON( "a" << 1 ), BSON( "$natural" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 1 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 1 ), BSON( "$natural" << 1 ) );
ASSERT_EQUALS( 1, s.nPlans() );
}
};
@@ -738,7 +1106,8 @@ namespace QueryOptimizerTests {
void run() {
BSONObj b = BSON( "hint" << "a_1" );
BSONElement e = b.firstElement();
- ASSERT_EXCEPTION( QueryPlanSet s( ns(), BSON( "a" << 1 ), BSON( "b" << 1 ), &e ),
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 1 ) ) );
+ ASSERT_EXCEPTION( QueryPlanSet s( ns(), frs, BSON( "a" << 1 ), BSON( "b" << 1 ), &e ),
AssertionException );
}
};
@@ -753,11 +1122,11 @@ namespace QueryOptimizerTests {
BSONObj one = BSON( "a" << 1 );
BSONObj fourA = BSON( "a" << 4 );
BSONObj fourB = BSON( "a" << 4 );
- theDataFileMgr.insert( ns(), one );
+ theDataFileMgr.insertWithObjMod( ns(), one );
ASSERT_EQUALS( 0, runCount( ns(), BSON( "query" << BSON( "a" << 4 ) ), err ) );
- theDataFileMgr.insert( ns(), fourA );
+ theDataFileMgr.insertWithObjMod( ns(), fourA );
ASSERT_EQUALS( 1, runCount( ns(), BSON( "query" << BSON( "a" << 4 ) ), err ) );
- theDataFileMgr.insert( ns(), fourB );
+ theDataFileMgr.insertWithObjMod( ns(), fourB );
ASSERT_EQUALS( 2, runCount( ns(), BSON( "query" << BSON( "a" << 4 ) ), err ) );
ASSERT_EQUALS( 3, runCount( ns(), BSON( "query" << BSONObj() ), err ) );
ASSERT_EQUALS( 3, runCount( ns(), BSON( "query" << BSON( "a" << GT << 0 ) ), err ) );
@@ -770,15 +1139,20 @@ namespace QueryOptimizerTests {
class QueryMissingNs : public Base {
public:
+ QueryMissingNs() { log() << "querymissingns starts" << endl; }
+ ~QueryMissingNs() {
+ log() << "end QueryMissingNs" << endl;
+ }
void run() {
Message m;
assembleRequest( "unittests.missingNS", BSONObj(), 0, 0, 0, 0, m );
- stringstream ss;
-
DbMessage d(m);
QueryMessage q(d);
- ASSERT_EQUALS( 0, runQuery( m, q)->nReturned );
+ Message ret;
+ runQuery( m, q, ret );
+ ASSERT_EQUALS( 0, ((QueryResult*)ret.header())->nReturned );
}
+
};
class UnhelpfulIndex : public Base {
@@ -786,7 +1160,8 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
- QueryPlanSet s( ns(), BSON( "a" << 1 << "c" << 2 ), BSONObj() );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 1 << "c" << 2 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 1 << "c" << 2 ), BSONObj() );
ASSERT_EQUALS( 2, s.nPlans() );
}
};
@@ -796,21 +1171,22 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
ASSERT_EQUALS( 3, s.nPlans() );
bool threw = false;
auto_ptr< TestOp > t( new TestOp( true, threw ) );
boost::shared_ptr< TestOp > done = s.runOp( *t );
ASSERT( threw );
ASSERT( done->complete() );
- ASSERT( done->exceptionMessage().empty() );
+ ASSERT( done->exception().empty() );
ASSERT( !done->error() );
}
private:
class TestOp : public QueryOp {
public:
TestOp( bool iThrow, bool &threw ) : iThrow_( iThrow ), threw_( threw ), i_(), youThrow_( false ) {}
- virtual void init() {}
+ virtual void _init() {}
virtual void next() {
if ( iThrow_ )
threw_ = true;
@@ -818,7 +1194,7 @@ namespace QueryOptimizerTests {
if ( ++i_ > 10 )
setComplete();
}
- virtual QueryOp *clone() const {
+ virtual QueryOp *_createChild() const {
QueryOp *op = new TestOp( youThrow_, threw_ );
youThrow_ = !youThrow_;
return op;
@@ -837,22 +1213,23 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
ASSERT_EQUALS( 3, s.nPlans() );
auto_ptr< TestOp > t( new TestOp() );
boost::shared_ptr< TestOp > done = s.runOp( *t );
ASSERT( !done->complete() );
- ASSERT_EQUALS( "throw", done->exceptionMessage() );
+ ASSERT_EQUALS( "throw", done->exception().msg );
ASSERT( done->error() );
}
private:
class TestOp : public QueryOp {
public:
- virtual void init() {}
+ virtual void _init() {}
virtual void next() {
massert( 10409 , "throw", false );
}
- virtual QueryOp *clone() const {
+ virtual QueryOp *_createChild() const {
return new TestOp();
}
virtual bool mayRecordPlan() const { return true; }
@@ -883,19 +1260,22 @@ namespace QueryOptimizerTests {
}
nPlans( 3 );
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
NoRecordTestOp original;
s.runOp( original );
nPlans( 3 );
BSONObj hint = fromjson( "{hint:{$natural:1}}" );
BSONElement hintElt = hint.firstElement();
- QueryPlanSet s2( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ), &hintElt );
+ auto_ptr< FieldRangeSet > frs2( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s2( ns(), frs2, BSON( "a" << 4 ), BSON( "b" << 1 ), &hintElt );
TestOp newOriginal;
s2.runOp( newOriginal );
nPlans( 3 );
- QueryPlanSet s3( ns(), BSON( "a" << 4 ), BSON( "b" << 1 << "c" << 1 ) );
+ auto_ptr< FieldRangeSet > frs3( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s3( ns(), frs3, BSON( "a" << 4 ), BSON( "b" << 1 << "c" << 1 ) );
TestOp newerOriginal;
s3.runOp( newerOriginal );
nPlans( 3 );
@@ -905,28 +1285,30 @@ namespace QueryOptimizerTests {
}
private:
void nPlans( int n ) {
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
ASSERT_EQUALS( n, s.nPlans() );
}
void runQuery() {
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
TestOp original;
s.runOp( original );
}
class TestOp : public QueryOp {
public:
- virtual void init() {}
+ virtual void _init() {}
virtual void next() {
setComplete();
}
- virtual QueryOp *clone() const {
+ virtual QueryOp *_createChild() const {
return new TestOp();
}
virtual bool mayRecordPlan() const { return true; }
};
class NoRecordTestOp : public TestOp {
virtual bool mayRecordPlan() const { return false; }
- virtual QueryOp *clone() const { return new NoRecordTestOp(); }
+ virtual QueryOp *_createChild() const { return new NoRecordTestOp(); }
};
};
@@ -935,26 +1317,28 @@ namespace QueryOptimizerTests {
void run() {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
- QueryPlanSet s( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s( ns(), frs, BSON( "a" << 4 ), BSON( "b" << 1 ) );
ScanOnlyTestOp op;
s.runOp( op );
ASSERT( fromjson( "{$natural:1}" ).woCompare( NamespaceDetailsTransient::_get( ns() ).indexForPattern( s.fbs().pattern( BSON( "b" << 1 ) ) ) ) == 0 );
ASSERT_EQUALS( 1, NamespaceDetailsTransient::_get( ns() ).nScannedForPattern( s.fbs().pattern( BSON( "b" << 1 ) ) ) );
- QueryPlanSet s2( ns(), BSON( "a" << 4 ), BSON( "b" << 1 ) );
+ auto_ptr< FieldRangeSet > frs2( new FieldRangeSet( ns(), BSON( "a" << 4 ) ) );
+ QueryPlanSet s2( ns(), frs2, BSON( "a" << 4 ), BSON( "b" << 1 ) );
TestOp op2;
ASSERT( s2.runOp( op2 )->complete() );
}
private:
class TestOp : public QueryOp {
public:
- virtual void init() {}
+ virtual void _init() {}
virtual void next() {
if ( qp().indexKey().firstElement().fieldName() == string( "$natural" ) )
massert( 10410 , "throw", false );
setComplete();
}
- virtual QueryOp *clone() const {
+ virtual QueryOp *_createChild() const {
return new TestOp();
}
virtual bool mayRecordPlan() const { return true; }
@@ -965,7 +1349,7 @@ namespace QueryOptimizerTests {
setComplete();
massert( 10411 , "throw", false );
}
- virtual QueryOp *clone() const {
+ virtual QueryOp *_createChild() const {
return new ScanOnlyTestOp();
}
};
@@ -975,7 +1359,7 @@ namespace QueryOptimizerTests {
public:
void run() {
BSONObj one = BSON( "a" << 1 );
- theDataFileMgr.insert( ns(), one );
+ theDataFileMgr.insertWithObjMod( ns(), one );
BSONObj result;
ASSERT( Helpers::findOne( ns(), BSON( "a" << 1 ), result ) );
ASSERT_EXCEPTION( Helpers::findOne( ns(), BSON( "a" << 1 ), result, true ), AssertionException );
@@ -990,10 +1374,10 @@ namespace QueryOptimizerTests {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
for( int i = 0; i < 200; ++i ) {
BSONObj two = BSON( "a" << 2 );
- theDataFileMgr.insert( ns(), two );
+ theDataFileMgr.insertWithObjMod( ns(), two );
}
BSONObj one = BSON( "a" << 1 );
- theDataFileMgr.insert( ns(), one );
+ theDataFileMgr.insertWithObjMod( ns(), one );
deleteObjects( ns(), BSON( "a" << 1 ), false );
ASSERT( BSON( "a" << 1 ).woCompare( NamespaceDetailsTransient::_get( ns() ).indexForPattern( FieldRangeSet( ns(), BSON( "a" << 1 ) ).pattern() ) ) == 0 );
ASSERT_EQUALS( 2, NamespaceDetailsTransient::_get( ns() ).nScannedForPattern( FieldRangeSet( ns(), BSON( "a" << 1 ) ).pattern() ) );
@@ -1007,11 +1391,11 @@ namespace QueryOptimizerTests {
BSONObj one = BSON( "_id" << 3 << "a" << 1 );
BSONObj two = BSON( "_id" << 2 << "a" << 1 );
BSONObj three = BSON( "_id" << 1 << "a" << -1 );
- theDataFileMgr.insert( ns(), one );
- theDataFileMgr.insert( ns(), two );
- theDataFileMgr.insert( ns(), three );
+ theDataFileMgr.insertWithObjMod( ns(), one );
+ theDataFileMgr.insertWithObjMod( ns(), two );
+ theDataFileMgr.insertWithObjMod( ns(), three );
deleteObjects( ns(), BSON( "_id" << GT << 0 << "a" << GT << 0 ), true );
- for( auto_ptr< Cursor > c = theDataFileMgr.findAll( ns() ); c->ok(); c->advance() )
+ for( boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( ns() ); c->ok(); c->advance() )
ASSERT( 3 != c->current().getIntField( "_id" ) );
}
};
@@ -1023,11 +1407,11 @@ namespace QueryOptimizerTests {
BSONObj one = BSON( "a" << 2 << "_id" << 0 );
BSONObj two = BSON( "a" << 1 << "_id" << 1 );
BSONObj three = BSON( "a" << 0 << "_id" << 2 );
- theDataFileMgr.insert( ns(), one );
- theDataFileMgr.insert( ns(), two );
- theDataFileMgr.insert( ns(), three );
+ theDataFileMgr.insertWithObjMod( ns(), one );
+ theDataFileMgr.insertWithObjMod( ns(), two );
+ theDataFileMgr.insertWithObjMod( ns(), three );
deleteObjects( ns(), BSON( "a" << GTE << 0 << "_id" << GT << 0 ), true );
- for( auto_ptr< Cursor > c = theDataFileMgr.findAll( ns() ); c->ok(); c->advance() )
+ for( boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( ns() ); c->ok(); c->advance() )
ASSERT( 2 != c->current().getIntField( "_id" ) );
}
};
@@ -1039,7 +1423,7 @@ namespace QueryOptimizerTests {
for( int i = 0; i < 100; ++i ) {
for( int j = 0; j < 2; ++j ) {
BSONObj temp = BSON( "a" << 100 - i - 1 << "b" << i );
- theDataFileMgr.insert( ns(), temp );
+ theDataFileMgr.insertWithObjMod( ns(), temp );
}
}
Message m;
@@ -1071,13 +1455,14 @@ namespace QueryOptimizerTests {
Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
for( int i = 0; i < 10; ++i ) {
BSONObj temp = BSON( "a" << i );
- theDataFileMgr.insert( ns(), temp );
+ theDataFileMgr.insertWithObjMod( ns(), temp );
}
BSONObj hint = fromjson( "{$hint:{a:1}}" );
BSONElement hintElt = hint.firstElement();
- QueryPlanSet s( ns(), fromjson( "{a:{$in:[2,3,6,9,11]}}" ), BSONObj(), &hintElt );
- QueryPlan qp( nsd(), 1, s.fbs(), BSONObj() );
- auto_ptr< Cursor > c = qp.newCursor();
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), fromjson( "{a:{$in:[2,3,6,9,11]}}" ) ) );
+ QueryPlanSet s( ns(), frs, fromjson( "{a:{$in:[2,3,6,9,11]}}" ), BSONObj(), &hintElt );
+ QueryPlan qp( nsd(), 1, s.fbs(), fromjson( "{a:{$in:[2,3,6,9,11]}}" ), BSONObj() );
+ boost::shared_ptr<Cursor> c = qp.newCursor();
double expected[] = { 2, 3, 6, 9 };
for( int i = 0; i < 4; ++i, c->advance() ) {
ASSERT_EQUALS( expected[ i ], c->current().getField( "a" ).number() );
@@ -1086,9 +1471,10 @@ namespace QueryOptimizerTests {
// now check reverse
{
- QueryPlanSet s( ns(), fromjson( "{a:{$in:[2,3,6,9,11]}}" ), BSON( "a" << -1 ), &hintElt );
- QueryPlan qp( nsd(), 1, s.fbs(), BSON( "a" << -1 ) );
- auto_ptr< Cursor > c = qp.newCursor();
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), fromjson( "{a:{$in:[2,3,6,9,11]}}" ) ) );
+ QueryPlanSet s( ns(), frs, fromjson( "{a:{$in:[2,3,6,9,11]}}" ), BSON( "a" << -1 ), &hintElt );
+ QueryPlan qp( nsd(), 1, s.fbs(), fromjson( "{a:{$in:[2,3,6,9,11]}}" ), BSON( "a" << -1 ) );
+ boost::shared_ptr<Cursor> c = qp.newCursor();
double expected[] = { 9, 6, 3, 2 };
for( int i = 0; i < 4; ++i, c->advance() ) {
ASSERT_EQUALS( expected[ i ], c->current().getField( "a" ).number() );
@@ -1104,15 +1490,17 @@ namespace QueryOptimizerTests {
Helpers::ensureIndex( ns(), BSON( "a" << 1 << "b" << 1 ), false, "a_1_b_1" );
for( int i = 0; i < 10; ++i ) {
BSONObj temp = BSON( "a" << 5 << "b" << i );
- theDataFileMgr.insert( ns(), temp );
+ theDataFileMgr.insertWithObjMod( ns(), temp );
}
BSONObj hint = fromjson( "{$hint:{a:1,b:1}}" );
BSONElement hintElt = hint.firstElement();
- QueryPlanSet s( ns(), fromjson( "{a:5,b:{$in:[2,3,6,9,11]}}" ), BSONObj(), &hintElt );
- QueryPlan qp( nsd(), 1, s.fbs(), BSONObj() );
- auto_ptr< Cursor > c = qp.newCursor();
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), fromjson( "{a:5,b:{$in:[2,3,6,9,11]}}" ) ) );
+ QueryPlan qp( nsd(), 1, *frs, fromjson( "{a:5,b:{$in:[2,3,6,9,11]}}" ), BSONObj() );
+ boost::shared_ptr<Cursor> c = qp.newCursor();
double expected[] = { 2, 3, 6, 9 };
+ ASSERT( c->ok() );
for( int i = 0; i < 4; ++i, c->advance() ) {
+ ASSERT( c->ok() );
ASSERT_EQUALS( expected[ i ], c->current().getField( "b" ).number() );
}
ASSERT( !c->ok() );
@@ -1125,15 +1513,16 @@ namespace QueryOptimizerTests {
Helpers::ensureIndex( ns(), BSON( "a" << 1 << "b" << 1 ), false, "a_1_b_1" );
for( int i = 0; i < 10; ++i ) {
BSONObj temp = BSON( "a" << 5 << "b" << i );
- theDataFileMgr.insert( ns(), temp );
+ theDataFileMgr.insertWithObjMod( ns(), temp );
}
BSONObj hint = fromjson( "{$hint:{a:1,b:1}}" );
BSONElement hintElt = hint.firstElement();
- QueryPlanSet s( ns(), fromjson( "{a:{$gte:5},b:{$in:[2,3,6,9,11]}}" ), BSONObj(), &hintElt );
- QueryPlan qp( nsd(), 1, s.fbs(), BSONObj() );
- auto_ptr< Cursor > c = qp.newCursor();
- for( int i = 2; i < 10; ++i, c->advance() ) {
- ASSERT_EQUALS( i, c->current().getField( "b" ).number() );
+ auto_ptr< FieldRangeSet > frs( new FieldRangeSet( ns(), fromjson( "{a:{$gte:5},b:{$in:[2,3,6,9,11]}}" ) ) );
+ QueryPlan qp( nsd(), 1, *frs, fromjson( "{a:{$gte:5},b:{$in:[2,3,6,9,11]}}" ), BSONObj() );
+ boost::shared_ptr<Cursor> c = qp.newCursor();
+ int matches[] = { 2, 3, 6, 9 };
+ for( int i = 0; i < 4; ++i, c->advance() ) {
+ ASSERT_EQUALS( matches[ i ], c->current().getField( "b" ).number() );
}
ASSERT( !c->ok() );
}
@@ -1141,6 +1530,55 @@ namespace QueryOptimizerTests {
} // namespace QueryPlanSetTests
+ class Base {
+ public:
+ Base() : _ctx( ns() ) {
+ string err;
+ userCreateNS( ns(), BSONObj(), err, false );
+ }
+ ~Base() {
+ if ( !nsd() )
+ return;
+ string s( ns() );
+ dropNS( s );
+ }
+ protected:
+ static const char *ns() { return "unittests.BaseTests"; }
+ static NamespaceDetails *nsd() { return nsdetails( ns() ); }
+ private:
+ dblock lk_;
+ Client::Context _ctx;
+ };
+
+ class BestGuess : public Base {
+ public:
+ void run() {
+ Helpers::ensureIndex( ns(), BSON( "a" << 1 ), false, "a_1" );
+ Helpers::ensureIndex( ns(), BSON( "b" << 1 ), false, "b_1" );
+ BSONObj temp = BSON( "a" << 1 );
+ theDataFileMgr.insertWithObjMod( ns(), temp );
+ temp = BSON( "b" << 1 );
+ theDataFileMgr.insertWithObjMod( ns(), temp );
+
+ boost::shared_ptr< Cursor > c = bestGuessCursor( ns(), BSON( "b" << 1 ), BSON( "a" << 1 ) );
+ ASSERT_EQUALS( string( "a" ), c->indexKeyPattern().firstElement().fieldName() );
+ c = bestGuessCursor( ns(), BSON( "a" << 1 ), BSON( "b" << 1 ) );
+ ASSERT_EQUALS( string( "b" ), c->indexKeyPattern().firstElement().fieldName() );
+ boost::shared_ptr< MultiCursor > m = dynamic_pointer_cast< MultiCursor >( bestGuessCursor( ns(), fromjson( "{b:1,$or:[{z:1}]}" ), BSON( "a" << 1 ) ) );
+ ASSERT_EQUALS( string( "a" ), m->sub_c()->indexKeyPattern().firstElement().fieldName() );
+ m = dynamic_pointer_cast< MultiCursor >( bestGuessCursor( ns(), fromjson( "{a:1,$or:[{y:1}]}" ), BSON( "b" << 1 ) ) );
+ ASSERT_EQUALS( string( "b" ), m->sub_c()->indexKeyPattern().firstElement().fieldName() );
+
+ FieldRangeSet frs( "ns", BSON( "a" << 1 ) );
+ {
+ scoped_lock lk(NamespaceDetailsTransient::_qcMutex);
+ NamespaceDetailsTransient::get_inlock( ns() ).registerIndexForPattern( frs.pattern( BSON( "b" << 1 ) ), BSON( "a" << 1 ), 0 );
+ }
+ m = dynamic_pointer_cast< MultiCursor >( bestGuessCursor( ns(), fromjson( "{a:1,$or:[{y:1}]}" ), BSON( "b" << 1 ) ) );
+ ASSERT_EQUALS( string( "b" ), m->sub_c()->indexKeyPattern().firstElement().fieldName() );
+ }
+ };
+
class All : public Suite {
public:
All() : Suite( "queryoptimizer" ){}
@@ -1169,6 +1607,72 @@ namespace QueryOptimizerTests {
add< FieldRangeTests::InLowerBound >();
add< FieldRangeTests::InUpperBound >();
add< FieldRangeTests::MultiBound >();
+ add< FieldRangeTests::Diff1 >();
+ add< FieldRangeTests::Diff2 >();
+ add< FieldRangeTests::Diff3 >();
+ add< FieldRangeTests::Diff4 >();
+ add< FieldRangeTests::Diff5 >();
+ add< FieldRangeTests::Diff6 >();
+ add< FieldRangeTests::Diff7 >();
+ add< FieldRangeTests::Diff8 >();
+ add< FieldRangeTests::Diff9 >();
+ add< FieldRangeTests::Diff10 >();
+ add< FieldRangeTests::Diff11 >();
+ add< FieldRangeTests::Diff12 >();
+ add< FieldRangeTests::Diff13 >();
+ add< FieldRangeTests::Diff14 >();
+ add< FieldRangeTests::Diff15 >();
+ add< FieldRangeTests::Diff16 >();
+ add< FieldRangeTests::Diff17 >();
+ add< FieldRangeTests::Diff18 >();
+ add< FieldRangeTests::Diff19 >();
+ add< FieldRangeTests::Diff20 >();
+ add< FieldRangeTests::Diff21 >();
+ add< FieldRangeTests::Diff22 >();
+ add< FieldRangeTests::Diff23 >();
+ add< FieldRangeTests::Diff24 >();
+ add< FieldRangeTests::Diff25 >();
+ add< FieldRangeTests::Diff26 >();
+ add< FieldRangeTests::Diff27 >();
+ add< FieldRangeTests::Diff28 >();
+ add< FieldRangeTests::Diff29 >();
+ add< FieldRangeTests::Diff30 >();
+ add< FieldRangeTests::Diff31 >();
+ add< FieldRangeTests::Diff32 >();
+ add< FieldRangeTests::Diff33 >();
+ add< FieldRangeTests::Diff34 >();
+ add< FieldRangeTests::Diff35 >();
+ add< FieldRangeTests::Diff36 >();
+ add< FieldRangeTests::Diff37 >();
+ add< FieldRangeTests::Diff38 >();
+ add< FieldRangeTests::Diff39 >();
+ add< FieldRangeTests::Diff40 >();
+ add< FieldRangeTests::Diff41 >();
+ add< FieldRangeTests::Diff42 >();
+ add< FieldRangeTests::Diff43 >();
+ add< FieldRangeTests::Diff44 >();
+ add< FieldRangeTests::Diff45 >();
+ add< FieldRangeTests::Diff46 >();
+ add< FieldRangeTests::Diff47 >();
+ add< FieldRangeTests::Diff48 >();
+ add< FieldRangeTests::Diff49 >();
+ add< FieldRangeTests::Diff50 >();
+ add< FieldRangeTests::Diff51 >();
+ add< FieldRangeTests::Diff52 >();
+ add< FieldRangeTests::Diff53 >();
+ add< FieldRangeTests::Diff54 >();
+ add< FieldRangeTests::Diff55 >();
+ add< FieldRangeTests::Diff56 >();
+ add< FieldRangeTests::Diff57 >();
+ add< FieldRangeTests::Diff58 >();
+ add< FieldRangeTests::Diff59 >();
+ add< FieldRangeTests::Diff60 >();
+ add< FieldRangeTests::Diff61 >();
+ add< FieldRangeTests::Diff62 >();
+ add< FieldRangeTests::Diff63 >();
+ add< FieldRangeTests::DiffMulti1 >();
+ add< FieldRangeTests::DiffMulti2 >();
+ add< FieldRangeTests::SetIntersect >();
add< QueryPlanTests::NoIndex >();
add< QueryPlanTests::SimpleOrder >();
add< QueryPlanTests::MoreIndexThanNeeded >();
@@ -1206,6 +1710,7 @@ namespace QueryOptimizerTests {
add< QueryPlanSetTests::InQueryIntervals >();
add< QueryPlanSetTests::EqualityThenIn >();
add< QueryPlanSetTests::NotEqualityThenIn >();
+ add< BestGuess >();
}
} myall;
diff --git a/dbtests/querytests.cpp b/dbtests/querytests.cpp
index 24b71c4..31e1879 100644
--- a/dbtests/querytests.cpp
+++ b/dbtests/querytests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/query.h"
#include "../db/db.h"
@@ -42,7 +42,7 @@ namespace QueryTests {
}
~Base() {
try {
- auto_ptr< Cursor > c = theDataFileMgr.findAll( ns() );
+ boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( ns() );
vector< DiskLoc > toDelete;
for(; c->ok(); c->advance() )
toDelete.push_back( c->currLoc() );
@@ -58,7 +58,7 @@ namespace QueryTests {
}
static void addIndex( const BSONObj &key ) {
BSONObjBuilder b;
- b.append( "name", "index" );
+ b.append( "name", key.firstElement().fieldName() );
b.append( "ns", ns() );
b.append( "key", key );
BSONObj o = b.done();
@@ -129,6 +129,19 @@ namespace QueryTests {
ASSERT_EQUALS( 1, runCount( ns(), cmd, err ) );
}
};
+
+ class FindOne : public Base {
+ public:
+ void run() {
+ addIndex( BSON( "b" << 1 ) );
+ addIndex( BSON( "c" << 1 ) );
+ insert( BSON( "b" << 2 << "_id" << 0 ) );
+ insert( BSON( "c" << 3 << "_id" << 1 ) );
+ BSONObj ret;
+ ASSERT( Helpers::findOne( ns(), fromjson( "{$or:[{b:2},{c:3}]}" ), ret, true ) );
+ ASSERT_EQUALS( string( "b" ), ret.firstElement().fieldName() );
+ }
+ };
class ClientBase {
public:
@@ -476,6 +489,20 @@ namespace QueryTests {
}
};
+ class EmbeddedNumericTypes : public ClientBase {
+ public:
+ ~EmbeddedNumericTypes() {
+ client().dropCollection( "unittests.querytests.NumericEmbedded" );
+ }
+ void run() {
+ const char *ns = "unittests.querytests.NumericEmbedded";
+ client().insert( ns, BSON( "a" << BSON ( "b" << 1 ) ) );
+ ASSERT( ! client().findOne( ns, BSON( "a" << BSON ( "b" << 1.0 ) ) ).isEmpty() );
+ client().ensureIndex( ns , BSON( "a" << 1 ) );
+ ASSERT( ! client().findOne( ns, BSON( "a" << BSON ( "b" << 1.0 ) ) ).isEmpty() );
+ }
+ };
+
class AutoResetIndexCache : public ClientBase {
public:
~AutoResetIndexCache() {
@@ -736,7 +763,8 @@ namespace QueryTests {
auto_ptr< DBClientCursor > cursor = client().query( ns, Query().sort( "7" ) );
while ( cursor->more() ){
BSONObj o = cursor->next();
- cout << " foo " << o << endl;
+ assert( o.valid() );
+ //cout << " foo " << o << endl;
}
}
@@ -1059,6 +1087,45 @@ namespace QueryTests {
};
};
+ namespace queryobjecttests {
+ class names1 {
+ public:
+ void run(){
+ ASSERT_EQUALS( BSON( "x" << 1 ) , QUERY( "query" << BSON( "x" << 1 ) ).getFilter() );
+ ASSERT_EQUALS( BSON( "x" << 1 ) , QUERY( "$query" << BSON( "x" << 1 ) ).getFilter() );
+ }
+
+ };
+ }
+
+ class OrderingTest {
+ public:
+ void run(){
+ {
+ Ordering o = Ordering::make( BSON( "a" << 1 << "b" << -1 << "c" << 1 ) );
+ ASSERT_EQUALS( 1 , o.get(0) );
+ ASSERT_EQUALS( -1 , o.get(1) );
+ ASSERT_EQUALS( 1 , o.get(2) );
+
+ ASSERT( ! o.descending( 1 ) );
+ ASSERT( o.descending( 1 << 1 ) );
+ ASSERT( ! o.descending( 1 << 2 ) );
+ }
+
+ {
+ Ordering o = Ordering::make( BSON( "a.d" << 1 << "a" << 1 << "e" << -1 ) );
+ ASSERT_EQUALS( 1 , o.get(0) );
+ ASSERT_EQUALS( 1 , o.get(1) );
+ ASSERT_EQUALS( -1 , o.get(2) );
+
+ ASSERT( ! o.descending( 1 ) );
+ ASSERT( ! o.descending( 1 << 1 ) );
+ ASSERT( o.descending( 1 << 2 ) );
+ }
+
+ }
+ };
+
class All : public Suite {
public:
All() : Suite( "query" ) {
@@ -1070,6 +1137,7 @@ namespace QueryTests {
add< CountFields >();
add< CountQueryFields >();
add< CountIndexedRegex >();
+ add< FindOne >();
add< BoundedKey >();
add< GetMore >();
add< PositiveLimit >();
@@ -1086,6 +1154,7 @@ namespace QueryTests {
add< EmptyFieldSpec >();
add< MultiNe >();
add< EmbeddedNe >();
+ add< EmbeddedNumericTypes >();
add< AutoResetIndexCache >();
add< UniqueIndex >();
add< UniqueIndexPreexistingData >();
@@ -1107,8 +1176,12 @@ namespace QueryTests {
add< FindingStart >();
add< FindingStartPartiallyFull >();
add< WhatsMyUri >();
-
+
add< parsedtests::basic1 >();
+
+ add< queryobjecttests::names1 >();
+
+ add< OrderingTest >();
}
} myall;
diff --git a/dbtests/repltests.cpp b/dbtests/repltests.cpp
index 53e3609..a190dc8 100644
--- a/dbtests/repltests.cpp
+++ b/dbtests/repltests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/repl.h"
#include "../db/db.h"
@@ -89,7 +89,7 @@ namespace ReplTests {
int count = 0;
dblock lk;
Client::Context ctx( ns() );
- auto_ptr< Cursor > c = theDataFileMgr.findAll( ns() );
+ boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( ns() );
for(; c->ok(); c->advance(), ++count ) {
// cout << "obj: " << c->current().toString() << endl;
}
@@ -99,7 +99,7 @@ namespace ReplTests {
dblock lk;
Client::Context ctx( cllNS() );
int count = 0;
- for( auto_ptr< Cursor > c = theDataFileMgr.findAll( cllNS() ); c->ok(); c->advance() )
+ for( boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( cllNS() ); c->ok(); c->advance() )
++count;
return count;
}
@@ -114,7 +114,7 @@ namespace ReplTests {
vector< BSONObj > ops;
{
Client::Context ctx( cllNS() );
- for( auto_ptr< Cursor > c = theDataFileMgr.findAll( cllNS() ); c->ok(); c->advance() )
+ for( boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( cllNS() ); c->ok(); c->advance() )
ops.push_back( c->current() );
}
{
@@ -126,7 +126,7 @@ namespace ReplTests {
static void printAll( const char *ns ) {
dblock lk;
Client::Context ctx( ns );
- auto_ptr< Cursor > c = theDataFileMgr.findAll( ns );
+ boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( ns );
vector< DiskLoc > toDelete;
out() << "all for " << ns << endl;
for(; c->ok(); c->advance() ) {
@@ -137,7 +137,7 @@ namespace ReplTests {
static void deleteAll( const char *ns ) {
dblock lk;
Client::Context ctx( ns );
- auto_ptr< Cursor > c = theDataFileMgr.findAll( ns );
+ boost::shared_ptr<Cursor> c = theDataFileMgr.findAll( ns );
vector< DiskLoc > toDelete;
for(; c->ok(); c->advance() ) {
toDelete.push_back( c->currLoc() );
@@ -387,6 +387,29 @@ namespace ReplTests {
}
};
+ class UpdateId2 : public ReplTests::Base {
+ public:
+ UpdateId2() :
+ o_( fromjson( "{'_id':1}" ) ),
+ u_( fromjson( "{'_id':2}" ) ){}
+ void run() {
+ deleteAll( ns() );
+ insert( o_ );
+ client()->update( ns(), o_, u_ );
+ ASSERT_EQUALS( 1, count() );
+ checkOne( u_ );
+
+ deleteAll( ns() );
+ insert( o_ );
+ insert( u_ ); // simulate non snapshot replication, then op application
+ applyAllOperations();
+ ASSERT_EQUALS( 1, count() );
+ checkOne( u_ );
+ }
+ protected:
+ BSONObj o_, u_;
+ };
+
class UpdateDifferentFieldExplicitId : public Base {
public:
UpdateDifferentFieldExplicitId() :
@@ -1085,6 +1108,7 @@ namespace ReplTests {
add< Idempotence::UpdateSameFieldWithId >();
add< Idempotence::UpdateSameFieldExplicitId >();
add< Idempotence::UpdateId >();
+ add< Idempotence::UpdateId2 >();
add< Idempotence::UpdateDifferentFieldExplicitId >();
add< Idempotence::UpsertUpdateNoMods >();
add< Idempotence::UpsertInsertNoMods >();
diff --git a/dbtests/sharding.cpp b/dbtests/sharding.cpp
index c7c072a..2473366 100644
--- a/dbtests/sharding.cpp
+++ b/dbtests/sharding.cpp
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "dbtests.h"
diff --git a/dbtests/socktests.cpp b/dbtests/socktests.cpp
index c263f2e..267b1d6 100644
--- a/dbtests/socktests.cpp
+++ b/dbtests/socktests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../util/sock.h"
#include "dbtests.h"
@@ -29,6 +29,7 @@ namespace SockTests {
void run() {
ASSERT_EQUALS( "127.0.0.1", hostbyname( "localhost" ) );
ASSERT_EQUALS( "127.0.0.1", hostbyname( "127.0.0.1" ) );
+ // ASSERT_EQUALS( "::1", hostbyname( "::1" ) ); // IPv6 disabled at runtime by default.
}
};
diff --git a/dbtests/spin_lock_test.cpp b/dbtests/spin_lock_test.cpp
new file mode 100644
index 0000000..d053d61
--- /dev/null
+++ b/dbtests/spin_lock_test.cpp
@@ -0,0 +1,115 @@
+// spin_lock_test.cpp : spin_lcok.{h, cpp} unit test
+
+/**
+ * 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 <boost/thread/thread.hpp>
+
+#include "dbtests.h"
+#include "../util/concurrency/spin_lock.h"
+
+namespace {
+
+ using mongo::SpinLock;
+
+ class LockTester{
+ public:
+ LockTester( SpinLock* spin, int* counter )
+ : _spin(spin), _counter(counter), _requests(0){}
+
+ ~LockTester(){
+ delete _t;
+ }
+
+ void start( int increments ){
+ _t = new boost::thread( boost::bind(&LockTester::test, this, increments) );
+ }
+
+ void join(){
+ if ( _t ) _t->join();
+ }
+
+ int requests() const{
+ return _requests;
+ }
+
+ private:
+ SpinLock* _spin; // not owned here
+ int* _counter; // not owned here
+ int _requests;
+ boost::thread* _t;
+
+ void test( int increments ){
+ while ( increments-- > 0 ) {
+ _spin->lock();
+ ++(*_counter);
+ ++_requests;
+ _spin->unlock();
+ }
+ }
+
+ LockTester( LockTester& );
+ LockTester& operator=( LockTester& );
+ };
+
+ class ConcurrentIncs{
+ public:
+ void run(){
+
+#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
+
+ SpinLock spin;
+ int counter = 0;
+
+ const int threads = 64;
+ const int incs = 10000;
+ LockTester* testers[threads];
+
+ for ( int i = 0; i < threads; i++ ){
+ testers[i] = new LockTester( &spin, &counter );
+ }
+ for ( int i = 0; i < threads; i++ ){
+ testers[i]->start( incs );
+ }
+ for ( int i = 0; i < threads; i++ ){
+ testers[i]->join();
+ ASSERT_EQUALS( testers[i]->requests(), incs );
+ delete testers[i];
+ }
+
+ ASSERT_EQUALS( counter, threads*incs );
+#else
+
+ // WARNING "TODO Missing spin lock in this platform."
+ ASSERT( true );
+
+
+#endif
+
+ }
+ };
+
+ class SpinLockSuite : public Suite{
+ public:
+ SpinLockSuite() : Suite( "spinlock" ){}
+
+ void setupTests(){
+ add< ConcurrentIncs >();
+ }
+ } spinLockSuite;
+
+} // anonymous namespace
diff --git a/dbtests/test.vcproj b/dbtests/test.vcproj
index 002d464..c297d85 100644
--- a/dbtests/test.vcproj
+++ b/dbtests/test.vcproj
@@ -43,12 +43,13 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\js\src;&quot;..\pcre-7.4&quot;;&quot;c:\Program Files\boost\boost_1_35_0&quot;"
- PreprocessorDefinitions="OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
+ AdditionalIncludeDirectories="&quot;c:\program files\boost\latest&quot;;..\..\js\src;&quot;..\pcre-7.4&quot;;c:\boost;\boost"
+ PreprocessorDefinitions="MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="pch.h"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
@@ -67,7 +68,7 @@
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib Psapi.lib"
LinkIncremental="2"
- AdditionalLibraryDirectories="&quot;c:\Program Files\boost\boost_1_35_0\lib&quot;"
+ AdditionalLibraryDirectories="&quot;c:\Program Files\boost\latest\lib&quot;;c:\boost\lib;\boost\lib"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
@@ -123,12 +124,12 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="..\..\js\src;&quot;..\pcre-7.4&quot;;&quot;c:\Program Files\boost\boost_1_35_0&quot;"
- PreprocessorDefinitions="OLDJS;STATIC_JS_API;XP_WIN;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
+ AdditionalIncludeDirectories="&quot;c:\program files\boost\latest&quot;;..\..\js\src;&quot;..\pcre-7.4&quot;;c:\boost;\boost"
+ PreprocessorDefinitions="MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderThrough="pch.h"
WarningLevel="3"
DebugInformationFormat="3"
DisableSpecificWarnings="4355;4800"
@@ -146,7 +147,7 @@
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib psapi.lib"
LinkIncremental="1"
- AdditionalLibraryDirectories="&quot;c:\program files\boost\boost_1_35_0\lib&quot;"
+ AdditionalLibraryDirectories="&quot;c:\Program Files\boost\latest\lib&quot;;c:\boost\lib;\boost\lib"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
@@ -175,165 +176,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
- <Configuration
- Name="release_nojni|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="&quot;..\pcre-7.4&quot;;&quot;c:\Program Files\boost\boost_1_35_0&quot;;&quot;c:\program files\java\jdk\include&quot;;&quot;c:\program files\java\jdk\include\win32&quot;"
- PreprocessorDefinitions="NOJNI;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="2"
- PrecompiledHeaderThrough="stdafx.h"
- WarningLevel="3"
- DebugInformationFormat="3"
- DisableSpecificWarnings="4355;4800"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib"
- LinkIncremental="1"
- AdditionalLibraryDirectories="&quot;c:\program files\boost\boost_1_35_0\lib&quot;"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug Recstore|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- UseOfMFC="0"
- UseOfATL="0"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\js\src;&quot;..\pcre-7.4&quot;;&quot;c:\Program Files\boost\boost_1_35_0&quot;"
- PreprocessorDefinitions="_RECSTORE;OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="2"
- WarningLevel="3"
- Detect64BitPortabilityProblems="false"
- DebugInformationFormat="4"
- DisableSpecificWarnings="4355;4800"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="ws2_32.lib"
- LinkIncremental="2"
- AdditionalLibraryDirectories="&quot;c:\Program Files\boost\boost_1_35_0\lib&quot;"
- IgnoreAllDefaultLibraries="false"
- IgnoreDefaultLibraryNames=""
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
</Configurations>
<References>
</References>
@@ -372,22 +214,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcrecpp.h"
@@ -435,22 +261,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_compile.c"
@@ -471,22 +281,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_config.c"
@@ -507,22 +301,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_dfa_exec.c"
@@ -543,22 +321,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_exec.c"
@@ -579,22 +341,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_fullinfo.c"
@@ -615,22 +361,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_get.c"
@@ -651,22 +381,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_globals.c"
@@ -687,22 +401,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_info.c"
@@ -723,22 +421,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_maketables.c"
@@ -759,22 +441,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_newline.c"
@@ -795,22 +461,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_ord2utf8.c"
@@ -831,22 +481,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_refcount.c"
@@ -867,22 +501,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_scanner.cc"
@@ -903,22 +521,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_stringpiece.cc"
@@ -939,22 +541,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_study.c"
@@ -975,22 +561,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_tables.c"
@@ -1011,22 +581,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_try_flipped.c"
@@ -1047,22 +601,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_ucp_searchfuncs.c"
@@ -1083,22 +621,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_valid_utf8.c"
@@ -1119,22 +641,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_version.c"
@@ -1155,22 +661,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcre_xclass.c"
@@ -1191,22 +681,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\pcre-7.4\pcreposix.c"
@@ -1227,22 +701,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
</Filter>
</Filter>
@@ -1254,10 +712,6 @@
>
</File>
<File
- RelativePath="..\db\reccache.cpp"
- >
- </File>
- <File
RelativePath="..\db\reccache.h"
>
</File>
@@ -1298,6 +752,10 @@
>
</File>
<File
+ RelativePath="..\client\dbclientcursor.cpp"
+ >
+ </File>
+ <File
RelativePath="..\client\model.h"
>
</File>
@@ -1305,153 +763,29 @@
RelativePath="..\client\syncclusterconnection.cpp"
>
</File>
- <Filter
- Name="btree related"
- >
- <File
- RelativePath="..\db\btree.cpp"
- >
- </File>
- <File
- RelativePath="..\db\btree.h"
- >
- </File>
- <File
- RelativePath="..\db\btreecursor.cpp"
- >
- </File>
- </Filter>
</Filter>
<Filter
Name="db"
>
<File
- RelativePath="..\db\clientcursor.h"
- >
- </File>
- <File
- RelativePath="..\db\cmdline.cpp"
- >
- </File>
- <File
- RelativePath="..\db\cmdline.h"
- >
- </File>
- <File
- RelativePath="..\db\commands.h"
- >
- </File>
- <File
- RelativePath="..\db\concurrency.h"
- >
- </File>
- <File
- RelativePath="..\db\curop.h"
- >
- </File>
- <File
- RelativePath="..\db\cursor.h"
- >
- </File>
- <File
- RelativePath="..\db\database.h"
- >
- </File>
- <File
- RelativePath="..\db\db.h"
- >
- </File>
- <File
- RelativePath="..\db\dbhelpers.h"
- >
- </File>
- <File
- RelativePath="..\db\dbinfo.h"
- >
- </File>
- <File
- RelativePath="..\db\dbmessage.h"
- >
- </File>
- <File
- RelativePath="..\db\diskloc.h"
- >
- </File>
- <File
- RelativePath="..\db\extsort.h"
- >
- </File>
- <File
- RelativePath="..\db\introspect.h"
- >
- </File>
- <File
- RelativePath="..\db\jsobj.h"
- >
- </File>
- <File
- RelativePath="..\db\json.h"
- >
- </File>
- <File
- RelativePath="..\db\matcher.h"
- >
- </File>
- <File
- RelativePath="..\grid\message.h"
- >
- </File>
- <File
- RelativePath="..\db\minilex.h"
- >
- </File>
- <File
- RelativePath="..\db\namespace.h"
- >
- </File>
- <File
- RelativePath="..\db\pdfile.h"
- >
- </File>
- <File
- RelativePath="..\grid\protocol.h"
- >
- </File>
- <File
- RelativePath="..\db\query.h"
- >
- </File>
- <File
- RelativePath="..\db\queryoptimizer.h"
- >
- </File>
- <File
- RelativePath="..\db\queryutil.cpp"
- >
- </File>
- <File
- RelativePath="..\db\repl.h"
- >
- </File>
- <File
- RelativePath="..\db\replset.h"
- >
- </File>
- <File
- RelativePath="..\db\resource.h"
- >
- </File>
- <File
- RelativePath="..\db\scanandorder.h"
- >
- </File>
- <File
- RelativePath="..\db\security.h"
- >
- </File>
- <File
- RelativePath="..\stdafx.h"
+ RelativePath="..\pch.cpp"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
</File>
<Filter
Name="cpp"
@@ -1515,6 +849,10 @@
>
</File>
<File
+ RelativePath="..\db\indexkey.cpp"
+ >
+ </File>
+ <File
RelativePath="..\db\instance.cpp"
>
</File>
@@ -1563,6 +901,10 @@
>
</File>
<File
+ RelativePath="..\util\ramstore.cpp"
+ >
+ </File>
+ <File
RelativePath="..\db\repl.cpp"
>
</File>
@@ -1575,47 +917,155 @@
>
</File>
<File
- RelativePath="..\stdafx.cpp"
+ RelativePath="..\db\tests.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>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"
- />
- </FileConfiguration>
</File>
<File
- RelativePath="..\db\tests.cpp"
+ RelativePath="..\db\update.cpp"
>
</File>
+ </Filter>
+ <Filter
+ Name="h"
+ >
<File
- RelativePath="..\db\update.cpp"
+ RelativePath="..\db\clientcursor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\cmdline.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\cmdline.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\commands.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\concurrency.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\curop.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\cursor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\database.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\db.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\dbhelpers.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\dbinfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\dbmessage.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\diskloc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\extsort.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\introspect.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\jsobj.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\json.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\matcher.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\matcher_covered.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\grid\message.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\minilex.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\namespace.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\oplog.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\pch.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\pdfile.h"
+ >
+ </File>
+ <File
+ RelativePath="..\grid\protocol.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\query.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\queryoptimizer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\queryutil.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl_block.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\replset.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\scanandorder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\security.h"
>
</File>
</Filter>
@@ -1628,6 +1078,10 @@
>
</File>
<File
+ RelativePath="..\util\debug_util.cpp"
+ >
+ </File>
+ <File
RelativePath="..\util\file.h"
>
</File>
@@ -1714,22 +1168,6 @@
PrecompiledHeaderThrough=""
/>
</FileConfiguration>
- <FileConfiguration
- Name="release_nojni|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\util\md5main.cpp"
@@ -1740,6 +1178,10 @@
>
</File>
<File
+ RelativePath="..\util\message_server_port.cpp"
+ >
+ </File>
+ <File
RelativePath="..\util\miniwebserver.cpp"
>
</File>
@@ -1768,6 +1210,34 @@
>
</File>
</Filter>
+ <Filter
+ Name="concurrency"
+ >
+ <File
+ RelativePath="..\util\concurrency\list.h"
+ >
+ </File>
+ <File
+ RelativePath="..\util\concurrency\msg.h"
+ >
+ </File>
+ <File
+ RelativePath="..\util\concurrency\task.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\util\concurrency\task.h"
+ >
+ </File>
+ <File
+ RelativePath="..\util\concurrency\value.h"
+ >
+ </File>
+ <File
+ RelativePath="..\util\concurrency\vars.cpp"
+ >
+ </File>
+ </Filter>
</Filter>
<Filter
Name="shard"
@@ -1776,6 +1246,14 @@
RelativePath="..\s\d_logic.cpp"
>
</File>
+ <File
+ RelativePath="..\s\d_util.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\s\shardconnection.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="scripting"
@@ -1807,14 +1285,6 @@
UsePrecompiledHeader="0"
/>
</FileConfiguration>
- <FileConfiguration
- Name="Debug Recstore|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="0"
- />
- </FileConfiguration>
</File>
<File
RelativePath="..\scripting\utils.cpp"
@@ -1925,6 +1395,58 @@
>
</File>
</Filter>
+ <Filter
+ Name="replsets"
+ >
+ <File
+ RelativePath="..\db\repl\consensus.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl\health.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl\heartbeat.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl\manager.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl\replset.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl\replset_commands.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl\rs_config.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\repl\rs_initiate.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="btree related"
+ >
+ <File
+ RelativePath="..\db\btree.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\db\btree.h"
+ >
+ </File>
+ <File
+ RelativePath="..\db\btreecursor.cpp"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/dbtests/test.vcxproj b/dbtests/test.vcxproj
index efbf2d0..d52278a 100644
--- a/dbtests/test.vcxproj
+++ b/dbtests/test.vcxproj
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug Recstore|Win32">
- <Configuration>Debug Recstore</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="release_nojni|Win32">
- <Configuration>release_nojni</Configuration>
- <Platform>Win32</Platform>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{215B2D68-0A70-4D10-8E75-B33010C62A91}</ProjectGuid>
@@ -24,23 +24,23 @@
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <UseOfAtl>false</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <UseOfAtl>false</UseOfAtl>
<CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<UseOfAtl>false</UseOfAtl>
@@ -49,50 +49,64 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
- <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">false</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+ <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;c:\Program Files\boost\boost_1_41_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
+ <AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;C:\boost;\boost;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;SUPPORT_UCP;SUPPORT_UTF8;MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>No</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4355;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>c:\Program Files\boost\boost_1_41_0\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>ws2_32.lib;Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>c:\boost\lib\vs2010_32;\boost\lib\vs2010_32;\boost\lib</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -100,47 +114,49 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;c:\Program Files\boost\boost_1_41_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>OLDJS;STATIC_JS_API;XP_WIN;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;C:\boost;\boost;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;SUPPORT_UCP;SUPPORT_UTF8;MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <DisableSpecificWarnings>4355;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DisableSpecificWarnings>4355;4800;4267;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <MinimalRebuild>No</MinimalRebuild>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>c:\program files\boost\boost_1_41_0\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>ws2_32.lib;Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>c:\boost\lib\vs2010_64;\boost\lib\vs2010_64;\boost\lib</AdditionalLibraryDirectories>
+ <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
+ <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <AdditionalIncludeDirectories>..\pcre-7.4;c:\Program Files\boost\boost_1_41_0;c:\program files\java\jdk\include;c:\program files\java\jdk\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>NOJNI;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;C:\boost;\boost;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;SUPPORT_UCP;SUPPORT_UTF8;MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4355;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <MinimalRebuild>No</MinimalRebuild>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>c:\program files\boost\boost_1_41_0\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>ws2_32.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>c:\boost\lib\vs2010_32;\boost\lib\vs2010_32;\boost\lib</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
@@ -148,32 +164,36 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;c:\Program Files\boost\boost_1_41_0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_RECSTORE;OLDJS;STATIC_JS_API;XP_WIN;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <AdditionalIncludeDirectories>..\..\js\src;..\pcre-7.4;C:\boost;\boost;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;SUPPORT_UCP;SUPPORT_UTF8;MONGO_EXPOSE_MACROS;OLDJS;STATIC_JS_API;XP_WIN;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <DisableSpecificWarnings>4355;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <DisableSpecificWarnings>4355;4800;4267;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <MinimalRebuild>No</MinimalRebuild>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>c:\Program Files\boost\boost_1_41_0\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
- <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalDependencies>ws2_32.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>c:\boost\lib\vs2010_64;\boost\lib\vs2010_64;\boost\lib</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClInclude Include="..\..\boostw\boost_1_34_1\boost\config\auto_link.hpp" />
<ClInclude Include="..\pcre-7.4\pcrecpp.h" />
<ClInclude Include="..\targetver.h" />
+ <ClInclude Include="..\..\boostw\boost_1_34_1\boost\version.hpp" />
<ClInclude Include="..\pcre-7.4\config.h" />
<ClInclude Include="..\pcre-7.4\pcre.h" />
<ClInclude Include="..\db\rec.h" />
@@ -196,6 +216,8 @@
<ClInclude Include="..\db\dbhelpers.h" />
<ClInclude Include="..\db\dbinfo.h" />
<ClInclude Include="..\db\dbmessage.h" />
+ <ClInclude Include="..\db\diskloc.h" />
+ <ClInclude Include="..\db\extsort.h" />
<ClInclude Include="..\db\introspect.h" />
<ClInclude Include="..\db\jsobj.h" />
<ClInclude Include="..\db\json.h" />
@@ -203,6 +225,7 @@
<ClInclude Include="..\grid\message.h" />
<ClInclude Include="..\db\minilex.h" />
<ClInclude Include="..\db\namespace.h" />
+ <ClInclude Include="..\pch.h" />
<ClInclude Include="..\db\pdfile.h" />
<ClInclude Include="..\grid\protocol.h" />
<ClInclude Include="..\db\query.h" />
@@ -212,8 +235,10 @@
<ClInclude Include="..\db\resource.h" />
<ClInclude Include="..\db\scanandorder.h" />
<ClInclude Include="..\db\security.h" />
- <ClInclude Include="..\stdafx.h" />
<ClInclude Include="..\util\builder.h" />
+ <ClInclude Include="..\util\concurrency\list.h" />
+ <ClInclude Include="..\util\concurrency\task.h" />
+ <ClInclude Include="..\util\concurrency\value.h" />
<ClInclude Include="..\util\file.h" />
<ClInclude Include="..\util\goodies.h" />
<ClInclude Include="..\util\hashtab.h" />
@@ -228,336 +253,372 @@
<ClInclude Include="..\util\unittest.h" />
</ItemGroup>
<ItemGroup>
- <ResourceCompile Include="..\db\db.rc" />
- </ItemGroup>
- <ItemGroup>
- <CustomBuild Include="..\..\js\js\Release\js.lib">
- <FileType>Document</FileType>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
- </CustomBuild>
- <CustomBuild Include="..\..\js\js\Debug\js.lib">
- <FileType>Document</FileType>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
- </CustomBuild>
- </ItemGroup>
- <ItemGroup>
+ <ClCompile Include="..\client\dbclientcursor.cpp" />
+ <ClCompile Include="..\client\distlock.cpp" />
+ <ClCompile Include="..\client\gridfs.cpp" />
+ <ClCompile Include="..\client\model.cpp" />
+ <ClCompile Include="..\client\parallel.cpp" />
+ <ClCompile Include="..\db\cap.cpp" />
+ <ClCompile Include="..\db\geo\2d.cpp" />
+ <ClCompile Include="..\db\geo\haystack.cpp" />
+ <ClCompile Include="..\db\repl\consensus.cpp" />
+ <ClCompile Include="..\db\repl\heartbeat.cpp" />
+ <ClCompile Include="..\db\repl\manager.cpp" />
+ <ClCompile Include="..\db\repl\rs.cpp" />
+ <ClCompile Include="..\db\repl\rs_initialsync.cpp" />
+ <ClCompile Include="..\db\repl\rs_initiate.cpp" />
+ <ClCompile Include="..\db\repl\rs_rollback.cpp" />
+ <ClCompile Include="..\db\repl\rs_sync.cpp" />
+ <ClCompile Include="..\db\restapi.cpp" />
<ClCompile Include="..\pcre-7.4\pcrecpp.cc">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_chartables.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_compile.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_config.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_dfa_exec.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_exec.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_fullinfo.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_get.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_globals.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_info.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_maketables.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_newline.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_ord2utf8.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_refcount.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_scanner.cc">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_stringpiece.cc">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_study.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_tables.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_try_flipped.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_ucp_searchfuncs.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_valid_utf8.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_version.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcre_xclass.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\pcre-7.4\pcreposix.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="..\db\reccache.cpp" />
<ClCompile Include="..\db\storage.cpp" />
<ClCompile Include="..\client\connpool.cpp" />
<ClCompile Include="..\client\dbclient.cpp" />
+ <ClCompile Include="..\client\syncclusterconnection.cpp" />
<ClCompile Include="..\db\btree.cpp" />
<ClCompile Include="..\db\btreecursor.cpp" />
- <ClCompile Include="..\db\queryutil.cpp" />
+ <ClCompile Include="..\pch.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ </ClCompile>
<ClCompile Include="..\db\client.cpp" />
<ClCompile Include="..\db\clientcursor.cpp" />
<ClCompile Include="..\db\cloner.cpp" />
<ClCompile Include="..\db\commands.cpp" />
+ <ClCompile Include="..\db\common.cpp" />
<ClCompile Include="..\db\cursor.cpp" />
+ <ClCompile Include="..\db\database.cpp" />
<ClCompile Include="..\db\dbcommands.cpp" />
<ClCompile Include="..\db\dbeval.cpp" />
<ClCompile Include="..\db\dbhelpers.cpp" />
- <ClCompile Include="..\db\dbinfo.cpp" />
<ClCompile Include="..\db\dbwebserver.cpp" />
<ClCompile Include="..\db\extsort.cpp" />
+ <ClCompile Include="..\db\index.cpp" />
+ <ClCompile Include="..\db\indexkey.cpp" />
<ClCompile Include="..\db\instance.cpp" />
<ClCompile Include="..\db\introspect.cpp" />
<ClCompile Include="..\db\jsobj.cpp" />
<ClCompile Include="..\db\json.cpp" />
<ClCompile Include="..\db\lasterror.cpp" />
<ClCompile Include="..\db\matcher.cpp" />
+ <ClCompile Include="..\s\chunk.cpp" />
+ <ClCompile Include="..\s\config.cpp" />
+ <ClCompile Include="..\s\d_migrate.cpp" />
+ <ClCompile Include="..\s\d_split.cpp" />
+ <ClCompile Include="..\s\d_state.cpp" />
+ <ClCompile Include="..\s\d_util.cpp" />
+ <ClCompile Include="..\s\d_writeback.cpp" />
+ <ClCompile Include="..\s\grid.cpp" />
+ <ClCompile Include="..\s\shard.cpp" />
+ <ClCompile Include="..\s\shardconnection.cpp" />
+ <ClCompile Include="..\s\shardkey.cpp" />
+ <ClCompile Include="..\util\concurrency\task.cpp" />
+ <ClCompile Include="..\util\concurrency\thread_pool.cpp" />
+ <ClCompile Include="..\util\concurrency\vars.cpp" />
+ <ClCompile Include="..\util\log.cpp" />
<ClCompile Include="..\util\mmap_win.cpp" />
<ClCompile Include="..\db\namespace.cpp" />
<ClCompile Include="..\db\nonce.cpp" />
<ClCompile Include="..\db\pdfile.cpp" />
<ClCompile Include="..\db\query.cpp" />
<ClCompile Include="..\db\queryoptimizer.cpp" />
+ <ClCompile Include="..\util\processinfo.cpp" />
+ <ClCompile Include="..\util\ramstore.cpp" />
<ClCompile Include="..\db\repl.cpp" />
<ClCompile Include="..\db\security.cpp" />
<ClCompile Include="..\db\security_commands.cpp" />
- <ClCompile Include="..\stdafx.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">Create</PrecompiledHeader>
- </ClCompile>
<ClCompile Include="..\db\tests.cpp" />
<ClCompile Include="..\db\update.cpp" />
+ <ClCompile Include="..\db\cmdline.cpp" />
+ <ClCompile Include="..\db\matcher_covered.cpp" />
+ <ClCompile Include="..\db\oplog.cpp" />
+ <ClCompile Include="..\db\queryutil.cpp" />
+ <ClCompile Include="..\db\repl_block.cpp" />
<ClCompile Include="..\util\assert_util.cpp" />
<ClCompile Include="..\util\background.cpp" />
<ClCompile Include="..\util\base64.cpp" />
<ClCompile Include="..\util\httpclient.cpp" />
<ClCompile Include="..\util\md5.c">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ </PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeaderFile>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='release_nojni|Win32'">
- </PrecompiledHeader>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ </PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\util\md5main.cpp" />
<ClCompile Include="..\util\message.cpp" />
+ <ClCompile Include="..\util\message_server_port.cpp" />
<ClCompile Include="..\util\miniwebserver.cpp" />
<ClCompile Include="..\util\mmap.cpp" />
<ClCompile Include="..\util\ntservice.cpp" />
- <ClCompile Include="..\util\processinfo_none.cpp" />
+ <ClCompile Include="..\util\processinfo_win32.cpp" />
<ClCompile Include="..\util\sock.cpp" />
+ <ClCompile Include="..\util\stringutils.cpp" />
+ <ClCompile Include="..\util\text.cpp" />
<ClCompile Include="..\util\util.cpp" />
<ClCompile Include="..\s\d_logic.cpp" />
<ClCompile Include="..\scripting\engine.cpp" />
<ClCompile Include="..\scripting\engine_spidermonkey.cpp" />
<ClCompile Include="..\shell\mongo_vstudio.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Recstore|Win32'">
- </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ </PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ </PrecompiledHeader>
</ClCompile>
+ <ClCompile Include="..\scripting\utils.cpp" />
+ <ClCompile Include="..\util\version.cpp" />
<ClCompile Include="basictests.cpp" />
<ClCompile Include="btreetests.cpp" />
<ClCompile Include="clienttests.cpp" />
@@ -575,11 +636,47 @@
<ClCompile Include="querytests.cpp" />
<ClCompile Include="repltests.cpp" />
<ClCompile Include="socktests.cpp" />
+ <ClCompile Include="threadedtests.cpp">
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4180;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4180;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
<ClCompile Include="updatetests.cpp" />
+ <ClCompile Include="..\db\stats\counters.cpp" />
+ <ClCompile Include="..\db\stats\snapshots.cpp" />
+ <ClCompile Include="..\db\stats\top.cpp" />
+ <ClCompile Include="..\db\repl\health.cpp" />
+ <ClCompile Include="..\db\repl\replset_commands.cpp" />
+ <ClCompile Include="..\db\repl\rs_config.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\SConstruct" />
</ItemGroup>
+ <ItemGroup>
+ <Library Include="..\..\js\js32d.lib">
+ <FileType>Document</FileType>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ </Library>
+ <Library Include="..\..\js\js32r.lib">
+ <FileType>Document</FileType>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </Library>
+ <Library Include="..\..\js\js64d.lib">
+ <FileType>Document</FileType>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ </Library>
+ <Library Include="..\..\js\js64r.lib">
+ <FileType>Document</FileType>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ </Library>
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/dbtests/test.vcxproj.filters b/dbtests/test.vcxproj.filters
new file mode 100755
index 0000000..ba4c4af
--- /dev/null
+++ b/dbtests/test.vcxproj.filters
@@ -0,0 +1,707 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="misc and third party">
+ <UniqueIdentifier>{17c97725-06a4-41a6-bc1c-f0e05eada682}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="misc and third party\pcre">
+ <UniqueIdentifier>{0a50fb63-4ac3-4e30-a9d4-b0841878ee73}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="storage related">
+ <UniqueIdentifier>{eb2684bf-ca8d-4162-9313-56a81233c471}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="client">
+ <UniqueIdentifier>{45dab36c-864e-45de-bb8e-cf1d87a2c4f6}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="db">
+ <UniqueIdentifier>{69e233b0-5354-4612-8474-d4e4faaee607}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="db\cpp">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="db\h">
+ <UniqueIdentifier>{f86d2fc9-fb76-40cf-943d-330feb945ff3}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="util">
+ <UniqueIdentifier>{0ec2e082-aace-46da-9898-a1a7b24d60b7}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="util\cpp">
+ <UniqueIdentifier>{12efa241-3593-4177-a0cb-1eb672491f49}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="shard">
+ <UniqueIdentifier>{3865c5a5-bdb1-4420-a3ae-5a6615d563d4}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="scripting">
+ <UniqueIdentifier>{28893dc5-8a18-429a-b5c9-2cf701d324da}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="dbtests">
+ <UniqueIdentifier>{bc08b47a-daa3-4894-b9af-ae88755838db}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="stats">
+ <UniqueIdentifier>{2b914dc3-a760-4397-a12b-73a0381fa71d}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="replsets">
+ <UniqueIdentifier>{9320a670-3b28-471a-bf92-6c8d881a37a4}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="btree related">
+ <UniqueIdentifier>{4fff2dbf-30c4-4295-8db8-d513c1e36220}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="util\concurrency">
+ <UniqueIdentifier>{d499fdba-b256-4b12-af20-cdd1ae1addff}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="util\h">
+ <UniqueIdentifier>{353b6f01-1cab-4156-a576-bc75ab204776}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\boostw\boost_1_34_1\boost\config\auto_link.hpp">
+ <Filter>misc and third party</Filter>
+ </ClInclude>
+ <ClInclude Include="..\pcre-7.4\pcrecpp.h">
+ <Filter>misc and third party</Filter>
+ </ClInclude>
+ <ClInclude Include="..\targetver.h">
+ <Filter>misc and third party</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\boostw\boost_1_34_1\boost\version.hpp">
+ <Filter>misc and third party</Filter>
+ </ClInclude>
+ <ClInclude Include="..\pcre-7.4\config.h">
+ <Filter>misc and third party\pcre</Filter>
+ </ClInclude>
+ <ClInclude Include="..\pcre-7.4\pcre.h">
+ <Filter>misc and third party\pcre</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\rec.h">
+ <Filter>storage related</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\reccache.h">
+ <Filter>storage related</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\reci.h">
+ <Filter>storage related</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\recstore.h">
+ <Filter>storage related</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\storage.h">
+ <Filter>storage related</Filter>
+ </ClInclude>
+ <ClInclude Include="..\client\connpool.h">
+ <Filter>client</Filter>
+ </ClInclude>
+ <ClInclude Include="..\client\dbclient.h">
+ <Filter>client</Filter>
+ </ClInclude>
+ <ClInclude Include="..\client\model.h">
+ <Filter>client</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\clientcursor.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\cmdline.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\commands.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\concurrency.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\curop.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\cursor.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\database.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\db.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\dbhelpers.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\dbinfo.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\dbmessage.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\diskloc.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\extsort.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\introspect.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\jsobj.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\json.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\matcher.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\grid\message.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\minilex.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\namespace.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\pch.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\pdfile.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\grid\protocol.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\query.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\queryoptimizer.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\repl.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\replset.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\resource.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\scanandorder.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\security.h">
+ <Filter>db\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\btree.h">
+ <Filter>btree related</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\concurrency\list.h">
+ <Filter>util\concurrency</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\concurrency\value.h">
+ <Filter>util\concurrency</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\concurrency\task.h">
+ <Filter>util\concurrency</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\builder.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\unittest.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\file.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\goodies.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\hashtab.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\db\lasterror.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\log.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\lruishmap.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\md5.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\md5.hpp">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\miniwebserver.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\mmap.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ <ClInclude Include="..\util\sock.h">
+ <Filter>util\h</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <Library Include="..\..\js\js64r.lib">
+ <Filter>misc and third party</Filter>
+ </Library>
+ <Library Include="..\..\js\js32d.lib">
+ <Filter>misc and third party</Filter>
+ </Library>
+ <Library Include="..\..\js\js32r.lib">
+ <Filter>misc and third party</Filter>
+ </Library>
+ <Library Include="..\..\js\js64d.lib">
+ <Filter>misc and third party</Filter>
+ </Library>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\pcre-7.4\pcrecpp.cc">
+ <Filter>misc and third party</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_chartables.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_compile.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_config.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_dfa_exec.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_exec.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_fullinfo.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_get.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_globals.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_info.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_maketables.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_newline.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_ord2utf8.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_refcount.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_scanner.cc">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_stringpiece.cc">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_study.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_tables.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_try_flipped.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_ucp_searchfuncs.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_valid_utf8.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_version.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcre_xclass.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pcre-7.4\pcreposix.c">
+ <Filter>misc and third party\pcre</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\storage.cpp">
+ <Filter>storage related</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\connpool.cpp">
+ <Filter>client</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\dbclient.cpp">
+ <Filter>client</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\dbclientcursor.cpp">
+ <Filter>client</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\syncclusterconnection.cpp">
+ <Filter>client</Filter>
+ </ClCompile>
+ <ClCompile Include="..\pch.cpp">
+ <Filter>db</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\client.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\clientcursor.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\cloner.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\commands.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\common.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\cursor.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\database.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\dbcommands.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\dbeval.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\dbhelpers.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\dbwebserver.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\extsort.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\index.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\indexkey.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\instance.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\introspect.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\jsobj.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\json.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\lasterror.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\matcher.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\mmap_win.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\namespace.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\nonce.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\pdfile.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\query.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\queryoptimizer.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\ramstore.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\security.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\security_commands.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\tests.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\update.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\cmdline.cpp">
+ <Filter>db\h</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\matcher_covered.cpp">
+ <Filter>db\h</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\oplog.cpp">
+ <Filter>db\h</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\queryutil.cpp">
+ <Filter>db\h</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl_block.cpp">
+ <Filter>db\h</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\assert_util.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\background.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\base64.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\httpclient.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\md5.c">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\md5main.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\message.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\message_server_port.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\miniwebserver.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\mmap.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\ntservice.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\processinfo_win32.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\sock.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\util.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\d_logic.cpp">
+ <Filter>shard</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scripting\engine.cpp">
+ <Filter>scripting</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scripting\engine_spidermonkey.cpp">
+ <Filter>scripting</Filter>
+ </ClCompile>
+ <ClCompile Include="..\shell\mongo_vstudio.cpp">
+ <Filter>scripting</Filter>
+ </ClCompile>
+ <ClCompile Include="..\scripting\utils.cpp">
+ <Filter>scripting</Filter>
+ </ClCompile>
+ <ClCompile Include="basictests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="btreetests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="clienttests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="cursortests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="dbtests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="framework.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="jsobjtests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="jsontests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="jstests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="matchertests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="namespacetests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="pairingtests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="pdfiletests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="queryoptimizertests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="querytests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="repltests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="socktests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="threadedtests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="updatetests.cpp">
+ <Filter>dbtests</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\stats\counters.cpp">
+ <Filter>stats</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\stats\snapshots.cpp">
+ <Filter>stats</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\stats\top.cpp">
+ <Filter>stats</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\consensus.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\health.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\replset_commands.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\rs_config.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\btree.cpp">
+ <Filter>btree related</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\btreecursor.cpp">
+ <Filter>btree related</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\manager.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\rs_initiate.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\concurrency\vars.cpp">
+ <Filter>util\concurrency</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\concurrency\task.cpp">
+ <Filter>util\concurrency</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\heartbeat.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\shardconnection.cpp">
+ <Filter>shard</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\d_util.cpp">
+ <Filter>shard</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\concurrency\thread_pool.cpp">
+ <Filter>util\concurrency</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\version.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\rs.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\text.cpp">
+ <Filter>util\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\gridfs.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\d_writeback.cpp">
+ <Filter>shard</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\d_state.cpp">
+ <Filter>shard</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\geo\2d.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\chunk.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\config.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\shardkey.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\shard.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\model.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\parallel.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\stringutils.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\client\distlock.cpp">
+ <Filter>client</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\d_migrate.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\d_split.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\rs_rollback.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\rs_sync.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\repl\rs_initialsync.cpp">
+ <Filter>replsets</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\geo\haystack.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\cap.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\log.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\util\processinfo.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\s\grid.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ <ClCompile Include="..\db\restapi.cpp">
+ <Filter>db\cpp</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\SConstruct">
+ <Filter>misc and third party</Filter>
+ </None>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/dbtests/threadedtests.cpp b/dbtests/threadedtests.cpp
index 2ffafba..af413cc 100644
--- a/dbtests/threadedtests.cpp
+++ b/dbtests/threadedtests.cpp
@@ -17,10 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
-#include "../util/atomic_int.h"
-#include "../util/mvar.h"
-#include "../util/thread_pool.h"
+#include "pch.h"
+#include "../bson/util/atomic_int.h"
+#include "../util/concurrency/mvar.h"
+#include "../util/concurrency/thread_pool.h"
#include <boost/thread.hpp>
#include <boost/bind.hpp>
@@ -129,6 +129,20 @@ namespace ThreadedTests {
}
};
+ class LockTest {
+ public:
+ void run(){
+ // quick atomicint wrap test
+ // MSGID likely assumes this semantic
+ AtomicUInt counter = 0xffffffff;
+ counter++;
+ ASSERT( counter == 0 );
+
+ writelocktry lk( "" , 0 );
+ ASSERT( lk.got() );
+ }
+ };
+
class All : public Suite {
public:
All() : Suite( "threading" ){
@@ -138,6 +152,7 @@ namespace ThreadedTests {
add< IsAtomicUIntAtomic >();
add< MVarTest >();
add< ThreadPoolTest >();
+ add< LockTest >();
}
} myall;
}
diff --git a/dbtests/updatetests.cpp b/dbtests/updatetests.cpp
index 09caae6..17f861e 100644
--- a/dbtests/updatetests.cpp
+++ b/dbtests/updatetests.cpp
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "stdafx.h"
+#include "pch.h"
#include "../db/query.h"
#include "../db/db.h"
@@ -678,6 +678,55 @@ namespace UpdateTests {
};
+ class inc3 : public SingleTest {
+ virtual BSONObj initial(){
+ return BSON( "_id" << 1 << "x" << 537142123123LL );
+ }
+ virtual BSONObj mod(){
+ return BSON( "$inc" << BSON( "x" << 2 ) );
+ }
+ virtual BSONObj after(){
+ return BSON( "_id" << 1 << "x" << 537142123125LL );
+ }
+ virtual const char * ns(){
+ return "unittests.inc2";
+ }
+
+ };
+
+ class inc4 : public SingleTest {
+ virtual BSONObj initial(){
+ return BSON( "_id" << 1 << "x" << 537142123123LL );
+ }
+ virtual BSONObj mod(){
+ return BSON( "$inc" << BSON( "x" << 2LL ) );
+ }
+ virtual BSONObj after(){
+ return BSON( "_id" << 1 << "x" << 537142123125LL );
+ }
+ virtual const char * ns(){
+ return "unittests.inc2";
+ }
+
+ };
+
+ class inc5 : public SingleTest {
+ virtual BSONObj initial(){
+ return BSON( "_id" << 1 << "x" << 537142123123LL );
+ }
+ virtual BSONObj mod(){
+ return BSON( "$inc" << BSON( "x" << 2.0 ) );
+ }
+ virtual BSONObj after(){
+ return BSON( "_id" << 1 << "x" << 537142123125LL );
+ }
+ virtual const char * ns(){
+ return "unittests.inc2";
+ }
+
+ };
+
+
class bit1 : public Base {
const char * ns(){
return "unittests.bit1";
@@ -775,6 +824,9 @@ namespace UpdateTests {
add< basic::inc1 >();
add< basic::inc2 >();
+ add< basic::inc3 >();
+ add< basic::inc4 >();
+ add< basic::inc5 >();
add< basic::bit1 >();
add< basic::unset >();
add< basic::setswitchint >();