diff options
author | Dwight <dmerriman@gmail.com> | 2009-09-09 16:22:41 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2009-09-09 16:22:41 -0400 |
commit | b860415ae2a09bb3f81c7c37478017f47b11fe0d (patch) | |
tree | e97c61fa91c1d7837ac942e4414bf576ae45a394 | |
parent | 2691b4033955da75b8290c9f68fecce5d59cd8ac (diff) | |
parent | 61390f8aea1c173871c8212dbab8d06b67f1b1d5 (diff) | |
download | mongo-b860415ae2a09bb3f81c7c37478017f47b11fe0d.tar.gz |
Merge branch 'master' of git@github.com:mongodb/mongo
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | SConstruct | 14 | ||||
-rw-r--r-- | db/cursor.cpp | 2 | ||||
-rw-r--r-- | db/jsobj.cpp | 11 | ||||
-rw-r--r-- | db/jsobj.h | 42 | ||||
-rw-r--r-- | dbtests/jsobjtests.cpp | 122 | ||||
-rw-r--r-- | dbtests/namespacetests.cpp | 229 | ||||
-rw-r--r-- | gch.py | 108 | ||||
-rw-r--r-- | jstests/sort4.js | 12 | ||||
-rw-r--r-- | stdafx.h.gch | bin | 1098384 -> 0 bytes | |||
-rw-r--r-- | util/allocator.h | 2 | ||||
-rw-r--r-- | util/goodies.h | 2 |
12 files changed, 422 insertions, 123 deletions
diff --git a/.gitignore b/.gitignore index 1cdaf0f3f06..e6a74705040 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ *.idb *.pdb *.manifest +*.gch *# .#* shell/mongo.cpp diff --git a/SConstruct b/SConstruct index f95b384eeb7..8c0231733ec 100644 --- a/SConstruct +++ b/SConstruct @@ -215,7 +215,7 @@ nojni = not GetOption( "nojni" ) is None usesm = not GetOption( "usesm" ) is None usejvm = not GetOption( "usejvm" ) is None -env = Environment( MSVS_ARCH=msarch ) +env = Environment( MSVS_ARCH=msarch , tools = ["default", "gch"], toolpath = '.' ) if GetOption( "cxx" ) is not None: env["CC"] = GetOption( "cxx" ) env["CXX"] = GetOption( "cxx" ) @@ -295,6 +295,8 @@ serverOnlyFiles += coreShardFiles + [ "s/d_logic.cpp" ] allClientFiles = commonFiles + coreDbFiles + [ "client/clientOnly.cpp" , "client/gridfs.cpp" ]; +allCXXFiles = allClientFiles + coreShardFiles + shardServerFiles + serverOnlyFiles; + # ---- other build setup ----- platform = os.sys.platform @@ -511,7 +513,7 @@ if not nojni and useJavaHome: env.Append( LINKFLAGS="-Xlinker -rpath -Xlinker " + javaHome + "jre/lib/" + javaVersion ) if nix: - env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas" ) + env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch" ) env.Append( CXXFLAGS=" -Wnon-virtual-dtor " ) env.Append( LINKFLAGS=" -fPIC -pthread " ) env.Append( LIBS=[] ) @@ -537,6 +539,14 @@ if nix: if GetOption( "profile" ) is not None: env.Append( LINKFLAGS=" -pg " ) + # pre-compiled headers + if False and 'Gch' in dir( env ): + print( "using precompiled headers" ) + env['Gch'] = env.Gch( [ "stdafx.h" ] )[0] + #Depends( "stdafx.o" , "stdafx.h.gch" ) + #SideEffect( "dummyGCHSideEffect" , "stdafx.h.gch" ) + + if "uname" in dir(os): hacks = buildscripts.findHacks( os.uname() ) if hacks is not None: diff --git a/db/cursor.cpp b/db/cursor.cpp index fe8673ce70c..f61fc6f5b42 100644 --- a/db/cursor.cpp +++ b/db/cursor.cpp @@ -14,7 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "stdafx.h" +#include "../stdafx.h" #include "pdfile.h" namespace mongo { diff --git a/db/jsobj.cpp b/db/jsobj.cpp index 0269e5bc1c6..78951cc772e 100644 --- a/db/jsobj.cpp +++ b/db/jsobj.cpp @@ -924,9 +924,8 @@ namespace mongo { if ( e.eoo() ) break; BSONElement x = getFieldDotted(e.fieldName()); - if ( x.eoo() ) - return BSONObj(); - b.append(x); + if ( ! x.eoo() ) + b.append(x); } return b.obj(); } @@ -1448,6 +1447,9 @@ namespace mongo { case NumberLong: append( field.c_str() , numeric_limits<double>::max() ); break; + case BinData: + appendMinForType( field , jstOID ); + break; case jstOID: { OID o; @@ -1455,6 +1457,9 @@ namespace mongo { appendOID( field.c_str() , &o); break; } + case Undefined: + case jstNULL: + appendMinForType( field , NumberInt ); case Bool: appendBool( field.c_str() , true); break; case Date: appendDate( field.c_str() , 0xFFFFFFFFFFFFFFFFLL ); break; case Symbol: diff --git a/db/jsobj.h b/db/jsobj.h index 103802b829c..54a278c306f 100644 --- a/db/jsobj.h +++ b/db/jsobj.h @@ -208,17 +208,51 @@ namespace mongo { /** returns the tyoe of the element fixed for the main type the main purpose is numbers. any numeric type will return NumberDouble + Note: if the order changes, indexes have to be re-built or than can be corruption */ - BSONType canonicalType() const { + int canonicalType() const { BSONType t = type(); switch ( t ){ + case MinKey: + case MaxKey: + return t; + case EOO: + case Undefined: + return 0; + case jstNULL: + return 5; + case NumberDouble: case NumberInt: case NumberLong: - return NumberDouble; + return 10; + case String: case Symbol: - return String; + return 15; + case Object: + return 20; + case Array: + return 25; + case BinData: + return 30; + case jstOID: + return 35; + case Bool: + return 40; + case Date: + return 45; + case RegEx: + return 50; + case DBRef: + return 55; + case Code: + return 60; + case CodeWScope: + return 65; + case Timestamp: + return 70; default: - return t; + assert(0); + return -1; } } diff --git a/dbtests/jsobjtests.cpp b/dbtests/jsobjtests.cpp index 3ab487d4cae..3a43e569566 100644 --- a/dbtests/jsobjtests.cpp +++ b/dbtests/jsobjtests.cpp @@ -145,6 +145,51 @@ namespace JsobjTests { } }; + class MultiKeySortOrder : public Base { + public: + void run(){ + ASSERT( BSON( "x" << "a" ).woCompare( BSON( "x" << "b" ) ) < 0 ); + ASSERT( BSON( "x" << "b" ).woCompare( BSON( "x" << "a" ) ) > 0 ); + + ASSERT( BSON( "x" << "a" << "y" << "a" ).woCompare( BSON( "x" << "a" << "y" << "b" ) ) < 0 ); + ASSERT( BSON( "x" << "a" << "y" << "a" ).woCompare( BSON( "x" << "b" << "y" << "a" ) ) < 0 ); + ASSERT( BSON( "x" << "a" << "y" << "a" ).woCompare( BSON( "x" << "b" ) ) < 0 ); + + ASSERT( BSON( "x" << "c" ).woCompare( BSON( "x" << "b" << "y" << "h" ) ) > 0 ); + ASSERT( BSON( "x" << "b" << "y" << "b" ).woCompare( BSON( "x" << "c" ) ) < 0 ); + + BSONObj key = BSON( "x" << 1 << "y" << 1 ); + + ASSERT( BSON( "x" << "c" ).woSortOrder( BSON( "x" << "b" << "y" << "h" ) , key ) > 0 ); + ASSERT( BSON( "x" << "b" << "y" << "b" ).woCompare( BSON( "x" << "c" ) , key ) < 0 ); + + key = BSON( "" << 1 << "" << 1 ); + + ASSERT( BSON( "" << "c" ).woSortOrder( BSON( "" << "b" << "" << "h" ) , key ) > 0 ); + ASSERT( BSON( "" << "b" << "" << "b" ).woCompare( BSON( "" << "c" ) , key ) < 0 ); + + { + BSONObjBuilder b; + b.append( "" , "c" ); + b.appendNull( "" ); + BSONObj o = b.obj(); + ASSERT( o.woSortOrder( BSON( "" << "b" << "" << "h" ) , key ) > 0 ); + ASSERT( BSON( "" << "b" << "" << "h" ).woSortOrder( o , key ) < 0 ); + + } + + + ASSERT( BSON( "" << "a" ).woCompare( BSON( "" << "a" << "" << "c" ) ) < 0 ); + { + BSONObjBuilder b; + b.append( "" , "a" ); + b.appendNull( "" ); + ASSERT( b.obj().woCompare( BSON( "" << "a" << "" << "c" ) ) < 0 ); // SERVER-282 + } + + } + }; + class TimestampTest : public Base { public: void run() { @@ -662,12 +707,14 @@ namespace JsobjTests { void run(){ for ( int t=1; t<JSTypeMax; t++ ){ - if ( t == CodeWScope ) - continue; - assert( min( t ).woCompare( max( t ) ) < 0 ); - assert( max( t ).woCompare( min( t ) ) > 0 ); - assert( min( t ).woCompare( min( t ) ) == 0 ); - assert( max( t ).woCompare( max( t ) ) == 0 ); + stringstream ss; + ss << "type: " << t; + string s = ss.str(); + massert( s , min( t ).woCompare( max( t ) ) < 0 ); + massert( s , max( t ).woCompare( min( t ) ) > 0 ); + massert( s , min( t ).woCompare( min( t ) ) == 0 ); + massert( s , max( t ).woCompare( max( t ) ) == 0 ); + massert( s , abs( min( t ).firstElement().canonicalType() - max( t ).firstElement().canonicalType() ) <= 10 ); } } @@ -675,6 +722,66 @@ namespace JsobjTests { }; + class ExtractFieldsTest { + public: + void run(){ + BSONObj x = BSON( "a" << 10 << "b" << 11 ); + assert( BSON( "a" << 10 ).woCompare( x.extractFields( BSON( "a" << 1 ) ) ) == 0 ); + assert( BSON( "b" << 11 ).woCompare( x.extractFields( BSON( "b" << 1 ) ) ) == 0 ); + assert( x.woCompare( x.extractFields( BSON( "a" << 1 << "b" << 1 ) ) ) == 0 ); + + assert( (string)"a" == x.extractFields( BSON( "a" << 1 << "c" << 1 ) ).firstElement().fieldName() ); + } + }; + + class ComparatorTest { + public: + BSONObj one( string s ){ + return BSON( "x" << s ); + } + BSONObj two( string x , string y ){ + BSONObjBuilder b; + b.append( "x" , x ); + if ( y.size() ) + b.append( "y" , y ); + else + b.appendNull( "y" ); + return b.obj(); + } + + void test( BSONObj order , BSONObj l , BSONObj r , bool wanted ){ + BSONObjCmp c( order ); + bool got = c(l,r); + if ( got == wanted ) + return; + cout << " order: " << order << " l: " << l << "r: " << r << " wanted: " << wanted << " got: " << got << endl; + } + + void lt( BSONObj order , BSONObj l , BSONObj r ){ + test( order , l , r , 1 ); + } + + void run(){ + BSONObj s = BSON( "x" << 1 ); + BSONObj c = BSON( "x" << 1 << "y" << 1 ); + test( s , one( "A" ) , one( "B" ) , 1 ); + test( s , one( "B" ) , one( "A" ) , 0 ); + + test( c , two( "A" , "A" ) , two( "A" , "B" ) , 1 ); + test( c , two( "A" , "A" ) , two( "B" , "A" ) , 1 ); + test( c , two( "B" , "A" ) , two( "A" , "B" ) , 0 ); + + lt( c , one("A") , two( "A" , "A" ) ); + lt( c , one("A") , one( "B" ) ); + lt( c , two("A","") , two( "B" , "A" ) ); + + lt( c , two("B","A") , two( "C" , "A" ) ); + lt( c , two("B","A") , one( "C" ) ); + lt( c , two("B","A") , two( "C" , "" ) ); + + } + }; + class All : public Suite { public: All() { @@ -688,6 +795,7 @@ namespace JsobjTests { add< BSONObjTests::WoCompareOrdered >(); add< BSONObjTests::WoCompareDifferentLength >(); add< BSONObjTests::WoSortOrder >(); + add< BSONObjTests::MultiKeySortOrder > (); add< BSONObjTests::TimestampTest >(); add< BSONObjTests::Nan >(); add< BSONObjTests::Validation::BadType >(); @@ -736,6 +844,8 @@ namespace JsobjTests { add< ValueStreamTests::ElementAppend >(); add< SubObjectBuilder >(); add< MinMaxElementTest >(); + add< ComparatorTest >(); + add< ExtractFieldsTest >(); } }; diff --git a/dbtests/namespacetests.cpp b/dbtests/namespacetests.cpp index a988fc5ac2c..8efbad6e6e2 100644 --- a/dbtests/namespacetests.cpp +++ b/dbtests/namespacetests.cpp @@ -90,15 +90,15 @@ namespace NamespaceTests { static void assertEquals( const BSONObj &a, const BSONObj &b ) { if ( a.woCompare( b ) != 0 ) { out() << "expected: " << a.toString() - << ", got: " << b.toString() << endl; + << ", got: " << b.toString() << endl; } ASSERT( a.woCompare( b ) == 0 ); } - BSONObj nullObj() const { - BSONObjBuilder b; - b.appendNull( "" ); - return b.obj(); - } + BSONObj nullObj() const { + BSONObjBuilder b; + b.appendNull( "" ); + return b.obj(); + } private: dblock lk_; IndexDetails id_; @@ -338,12 +338,12 @@ namespace NamespaceTests { id().getKeysFromObject( b.done(), keys ); checkSize( 4, keys ); BSONObjSetDefaultOrder::iterator i = keys.begin(); + assertEquals( nullObj(), *i++ ); for ( int j = 1; j < 4; ++i, ++j ) { BSONObjBuilder b; b.append( "", j ); assertEquals( b.obj(), *i ); } - assertEquals( nullObj(), *i++ ); } private: virtual BSONObj key() const { @@ -366,7 +366,7 @@ namespace NamespaceTests { BSONObjSetDefaultOrder keys; id().getKeysFromObject( b.done(), keys ); checkSize( 1, keys ); - assertEquals( nullObj(), *keys.begin() ); + assertEquals( nullObj(), *keys.begin() ); } private: virtual BSONObj key() const { @@ -381,14 +381,14 @@ namespace NamespaceTests { BSONObjSetDefaultOrder keys; id().getKeysFromObject( BSON( "b" << 1 ), keys ); checkSize( 1, keys ); - assertEquals( nullObj(), *keys.begin() ); + assertEquals( nullObj(), *keys.begin() ); } private: virtual BSONObj key() const { return BSON( "a" << 1 ); } }; - + class SubobjectMissing : public Base { public: void run() { @@ -396,7 +396,7 @@ namespace NamespaceTests { BSONObjSetDefaultOrder keys; id().getKeysFromObject( fromjson( "{a:[1,2]}" ), keys ); checkSize( 1, keys ); - assertEquals( nullObj(), *keys.begin() ); + assertEquals( nullObj(), *keys.begin() ); } private: virtual BSONObj key() const { @@ -404,75 +404,107 @@ namespace NamespaceTests { } }; - class ArraySubelementComplex : public Base { - public: - void run() { - create(); - BSONObjSetDefaultOrder keys; - id().getKeysFromObject( fromjson( "{a:[{b:[2]}]}" ), keys ); - checkSize( 1, keys ); - assertEquals( BSON( "" << 2 ), *keys.begin() ); - } - private: - virtual BSONObj key() const { - return aDotB(); - } - }; - - class ParallelArraysComplex : public Base { - public: - void run() { - create(); - BSONObjSetDefaultOrder keys; - ASSERT_EXCEPTION( id().getKeysFromObject( fromjson( "{a:[{b:[1],c:[2]}]}" ), keys ), - UserException ); - } - private: - virtual BSONObj key() const { - return fromjson( "{'a.b':1,'a.c':1}" ); - } - }; - - class AlternateMissing : public Base { - public: - void run() { - create(); - BSONObjSetDefaultOrder keys; - id().getKeysFromObject( fromjson( "{a:[{b:1},{c:2}]}" ), keys ); - checkSize( 2, keys ); - BSONObjSetDefaultOrder::iterator i = keys.begin(); - { - BSONObjBuilder e; - e.append( "", 1 ); - e.appendNull( "" ); - assertEquals( e.obj(), *i++ ); - } - { - BSONObjBuilder e; - e.appendNull( "" ); - e.append( "", 2 ); - assertEquals( e.obj(), *i ); - } - } - private: - virtual BSONObj key() const { - return fromjson( "{'a.b':1,'a.c':1}" ); - } - }; - - class MultiComplex : public Base { - public: - void run() { - create(); - BSONObjSetDefaultOrder keys; - id().getKeysFromObject( fromjson( "{a:[{b:1},{b:[1,2,3]}]}" ), keys ); - checkSize( 3, keys ); - } - private: - virtual BSONObj key() const { - return aDotB(); - } - }; + class CompoundMissing : public Base { + public: + void run(){ + create(); + + { + BSONObjSetDefaultOrder keys; + id().getKeysFromObject( fromjson( "{x:'a',y:'b'}" ) , keys ); + checkSize( 1 , keys ); + assertEquals( BSON( "" << "a" << "" << "b" ) , *keys.begin() ); + } + + { + BSONObjSetDefaultOrder keys; + id().getKeysFromObject( fromjson( "{x:'a'}" ) , keys ); + checkSize( 1 , keys ); + BSONObjBuilder b; + b.append( "" , "a" ); + b.appendNull( "" ); + assertEquals( b.obj() , *keys.begin() ); + } + + } + + private: + virtual BSONObj key() const { + return BSON( "x" << 1 << "y" << 1 ); + } + + }; + + class ArraySubelementComplex : public Base { + public: + void run() { + create(); + BSONObjSetDefaultOrder keys; + id().getKeysFromObject( fromjson( "{a:[{b:[2]}]}" ), keys ); + checkSize( 1, keys ); + assertEquals( BSON( "" << 2 ), *keys.begin() ); + } + private: + virtual BSONObj key() const { + return aDotB(); + } + }; + + class ParallelArraysComplex : public Base { + public: + void run() { + create(); + BSONObjSetDefaultOrder keys; + ASSERT_EXCEPTION( id().getKeysFromObject( fromjson( "{a:[{b:[1],c:[2]}]}" ), keys ), + UserException ); + } + private: + virtual BSONObj key() const { + return fromjson( "{'a.b':1,'a.c':1}" ); + } + }; + + class AlternateMissing : public Base { + public: + void run() { + create(); + BSONObjSetDefaultOrder keys; + id().getKeysFromObject( fromjson( "{a:[{b:1},{c:2}]}" ), keys ); + checkSize( 2, keys ); + BSONObjSetDefaultOrder::iterator i = keys.begin(); + { + BSONObjBuilder e; + e.appendNull( "" ); + e.append( "", 2 ); + assertEquals( e.obj(), *i++ ); + } + + { + BSONObjBuilder e; + e.append( "", 1 ); + e.appendNull( "" ); + assertEquals( e.obj(), *i++ ); + } + } + private: + virtual BSONObj key() const { + return fromjson( "{'a.b':1,'a.c':1}" ); + } + }; + + class MultiComplex : public Base { + public: + void run() { + create(); + BSONObjSetDefaultOrder keys; + id().getKeysFromObject( fromjson( "{a:[{b:1},{b:[1,2,3]}]}" ), keys ); + checkSize( 3, keys ); + } + private: + virtual BSONObj key() const { + return aDotB(); + } + }; } // namespace IndexDetailsTests @@ -506,7 +538,7 @@ namespace NamespaceTests { if ( fileNo == -1 ) continue; for ( int j = i.ext()->firstRecord.getOfs(); j != DiskLoc::NullOfs; - j = DiskLoc( fileNo, j ).rec()->nextOfs ) { + j = DiskLoc( fileNo, j ).rec()->nextOfs ) { ++count; } } @@ -639,22 +671,22 @@ namespace NamespaceTests { // This isn't a particularly useful test, and because it doesn't clean up // after itself, /tmp/unittest needs to be cleared after running. -// class BigCollection : public Base { -// public: -// BigCollection() : Base( "NamespaceDetailsTests_BigCollection" ) {} -// void run() { -// create(); -// ASSERT_EQUALS( 2, nExtents() ); -// } -// private: -// virtual string spec() const { -// // NOTE 256 added to size in _userCreateNS() -// long long big = MongoDataFile::maxSize() - MDFHeader::headerSize(); -// stringstream ss; -// ss << "{\"capped\":true,\"size\":" << big << "}"; -// return ss.str(); -// } -// }; + // class BigCollection : public Base { + // public: + // BigCollection() : Base( "NamespaceDetailsTests_BigCollection" ) {} + // void run() { + // create(); + // ASSERT_EQUALS( 2, nExtents() ); + // } + // private: + // virtual string spec() const { + // // NOTE 256 added to size in _userCreateNS() + // long long big = MongoDataFile::maxSize() - MDFHeader::headerSize(); + // stringstream ss; + // ss << "{\"capped\":true,\"size\":" << big << "}"; + // return ss.str(); + // } + // }; class Size { public: @@ -686,12 +718,13 @@ namespace NamespaceTests { add< IndexDetailsTests::MultiComplex >(); add< IndexDetailsTests::MissingField >(); add< IndexDetailsTests::SubobjectMissing >(); + add< IndexDetailsTests::CompoundMissing >(); add< NamespaceDetailsTests::Create >(); add< NamespaceDetailsTests::SingleAlloc >(); add< NamespaceDetailsTests::Realloc >(); add< NamespaceDetailsTests::TwoExtent >(); add< NamespaceDetailsTests::Migrate >(); -// add< NamespaceDetailsTests::BigCollection >(); + // add< NamespaceDetailsTests::BigCollection >(); add< NamespaceDetailsTests::Size >(); } }; diff --git a/gch.py b/gch.py new file mode 100644 index 00000000000..e5ff601638d --- /dev/null +++ b/gch.py @@ -0,0 +1,108 @@ +# $Id$ +# +# SCons builder for gcc's precompiled headers +# Copyright (C) 2006 Tim Blechmann +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# $Revision$ +# $LastChangedRevision$ +# $LastChangedDate$ +# $LastChangedBy$ + +import SCons.Action +import SCons.Builder +import SCons.Scanner.C +import SCons.Util +import SCons.Script + +SCons.Script.EnsureSConsVersion(0,96,92) + +GchAction = SCons.Action.Action('$GCHCOM', '$GCHCOMSTR') +GchShAction = SCons.Action.Action('$GCHSHCOM', '$GCHSHCOMSTR') + +def gen_suffix(env, sources): + return sources[0].get_suffix() + env['GCHSUFFIX'] + + +GchShBuilder = SCons.Builder.Builder(action = GchShAction, + source_scanner = SCons.Scanner.C.CScanner(), + suffix = gen_suffix) + +GchBuilder = SCons.Builder.Builder(action = GchAction, + source_scanner = SCons.Scanner.C.CScanner(), + suffix = gen_suffix) + +def static_pch_emitter(target,source,env): + SCons.Defaults.StaticObjectEmitter( target, source, env ) + + scanner = SCons.Scanner.C.CScanner() + path = scanner.path(env) + deps = scanner(source[0], env, path) + + if env.has_key('Gch') and env['Gch']: + if env['Gch'].path.strip('.gch') in [x.path for x in deps]: + env.Depends(target, env['Gch']) + + return (target, source) + +def shared_pch_emitter(target,source,env): + SCons.Defaults.SharedObjectEmitter( target, source, env ) + + scanner = SCons.Scanner.C.CScanner() + path = scanner.path(env) + deps = scanner(source[0], env, path) + + if env.has_key('GchSh') and env['GchSh']: + if env['GchSh'].path.strip('.gch') in [x.path for x in deps]: + env.Depends(target, env['GchSh']) + return (target, source) + +def generate(env): + """ + Add builders and construction variables for the Gch builder. + """ + env.Append(BUILDERS = { + 'gch': env.Builder( + action = GchAction, + target_factory = env.fs.File, + ), + 'gchsh': env.Builder( + action = GchShAction, + target_factory = env.fs.File, + ), + }) + + try: + bld = env['BUILDERS']['Gch'] + bldsh = env['BUILDERS']['GchSh'] + except KeyError: + bld = GchBuilder + bldsh = GchShBuilder + env['BUILDERS']['Gch'] = bld + env['BUILDERS']['GchSh'] = bldsh + + env['GCHCOM'] = '$CXX -o $TARGET -x c++-header -c $CXXFLAGS $_CCCOMCOM $SOURCE' + env['GCHSHCOM'] = '$CXX -o $TARGET -x c++-header -c $SHCXXFLAGS $_CCCOMCOM $SOURCE' + env['GCHSUFFIX'] = '.gch' + + for suffix in SCons.Util.Split('.c .C .cc .cxx .cpp .c++'): + env['BUILDERS']['StaticObject'].add_emitter( suffix, static_pch_emitter ) + env['BUILDERS']['SharedObject'].add_emitter( suffix, shared_pch_emitter ) + + +def exists(env): + return env.Detect('g++') diff --git a/jstests/sort4.js b/jstests/sort4.js index 40b0c2c5aa1..5174b46f41f 100644 --- a/jstests/sort4.js +++ b/jstests/sort4.js @@ -33,9 +33,11 @@ t.save({name: 'A'}) nice( {name:1, prename:1} , "A,AB,AC,BB,BD" , "e1" ); t.save({name: 'C'}) -nice({name:1, prename:1}) -//nice( {name:1, prename:1} , "A,AB,AC,BB,BD,C" , "e2" ); // SERVER-282 +nice( {name:1, prename:1} , "A,AB,AC,BB,BD,C" , "e2" ); // SERVER-282 -t.ensureIndex( { name : 1 } ); -nice({name:1, prename:1}) -//nice( {name:1, prename:1} , "A,AB,AC,BB,BD,C" , "e2i" ); // SERVER-282 +t.ensureIndex( { name : 1 , prename : 1 } ); +nice( {name:1, prename:1} , "A,AB,AC,BB,BD,C" , "e2ia" ); // SERVER-282 + +t.dropIndexes(); +t.ensureIndex( { name : 1 } ); +nice( {name:1, prename:1} , "A,AB,AC,BB,BD,C" , "e2ib" ); // SERVER-282 diff --git a/stdafx.h.gch b/stdafx.h.gch Binary files differdeleted file mode 100644 index d616f62ad94..00000000000 --- a/stdafx.h.gch +++ /dev/null diff --git a/util/allocator.h b/util/allocator.h index c3f816af6c6..f837347102d 100644 --- a/util/allocator.h +++ b/util/allocator.h @@ -18,8 +18,6 @@ #pragma once -#include "../stdafx.h" - namespace mongo { inline void * ourmalloc(size_t size) { diff --git a/util/goodies.h b/util/goodies.h index 34cb289b460..380969714de 100644 --- a/util/goodies.h +++ b/util/goodies.h @@ -19,8 +19,6 @@ #pragma once -#include "../stdafx.h" - namespace mongo { #if !defined(_WIN32) && !defined(NOEXECINFO) |