diff options
-rw-r--r-- | SConstruct | 16 | ||||
-rw-r--r-- | db/db.vcproj | 20 | ||||
-rw-r--r-- | db/instance.cpp | 7 | ||||
-rw-r--r-- | db/query.cpp | 9 | ||||
-rw-r--r-- | db/query.h | 8 | ||||
-rw-r--r-- | dbtests/framework.cpp | 4 | ||||
-rw-r--r-- | dbtests/queryoptimizertests.cpp | 4 | ||||
-rw-r--r-- | dbtests/test.vcproj | 20 | ||||
-rw-r--r-- | s/dbgrid.vcproj | 4 | ||||
-rw-r--r-- | util/assert_util.cpp | 6 | ||||
-rw-r--r-- | util/base64.h | 2 |
11 files changed, 61 insertions, 39 deletions
diff --git a/SConstruct b/SConstruct index cbd3f9c32d4..bc6db828ffd 100644 --- a/SConstruct +++ b/SConstruct @@ -580,6 +580,11 @@ def getSysInfo(): else: return " ".join( os.uname() ) +def add_exe(target): + if windows: + return target + ".exe" + return target + def setupBuildInfoFile( outFile ): version = getGitVersion() sysInfo = getSysInfo() @@ -962,7 +967,7 @@ def testSetup( env , target , source ): if len( COMMAND_LINE_TARGETS ) == 1 and str( COMMAND_LINE_TARGETS[0] ) == "test": ensureDir( "/tmp/unittest/" ); -addSmoketest( "smoke", [ "test" ] , [ test[ 0 ].abspath ] ) +addSmoketest( "smoke", [ add_exe( "test" ) ] , [ test[ 0 ].abspath ] ) addSmoketest( "smokePerf", [ "perftest" ] , [ perftest[ 0 ].abspath ] ) clientExec = [ x[0].abspath for x in clientTests ] @@ -1006,21 +1011,16 @@ def runShellTest( env, target, source ): Exit( 1 ) return subprocess.call( [ mongo[0].abspath, "--port", mongodForTestsPort ] + spec ) -def add_exe(target): - if windows: - return target + ".exe" - return target - # These tests require the mongo shell if not onlyServer and not noshell: addSmoketest( "smokeJs", [add_exe("mongo")], runShellTest ) addSmoketest( "smokeClone", [ "mongo", "mongod" ], [ jsDirTestSpec( "clone" ) ] ) addSmoketest( "smokeRepl", [ "mongo", "mongod", "mongobridge" ], [ jsDirTestSpec( "repl" ) ] ) - addSmoketest( "smokeDisk", [ "mongo", "mongod" ], [ jsDirTestSpec( "disk" ) ] ) + addSmoketest( "smokeDisk", [ add_exe( "mongo" ), add_exe( "mongod" ) ], [ jsDirTestSpec( "disk" ) ] ) addSmoketest( "smokeSharding", [ "mongo", "mongod", "mongos" ], [ jsDirTestSpec( "sharding" ) ] ) addSmoketest( "smokeJsPerf", [ "mongo" ], runShellTest ) addSmoketest( "smokeQuota", [ "mongo" ], runShellTest ) - addSmoketest( "smokeTool", [ "mongo" ], [ jsDirTestSpec( "tool" ) ] ) + addSmoketest( "smokeTool", [ add_exe( "mongo" ) ], [ jsDirTestSpec( "tool" ) ] ) mongodForTests = None mongodForTestsPort = "27017" diff --git a/db/db.vcproj b/db/db.vcproj index e3677d5051c..13625d027d9 100644 --- a/db/db.vcproj +++ b/db/db.vcproj @@ -350,30 +350,30 @@ >
</File>
<File
- RelativePath="..\..\js\js\Release\js.lib"
+ RelativePath="..\..\js\js\Debug\js.lib"
>
<FileConfiguration
- Name="Debug|Win32"
+ Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\js\js\Release\js.lib"
+ >
<FileConfiguration
- Name="Debug Recstore|Win32"
+ Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
- </File>
- <File
- RelativePath="..\..\js\js\Debug\js.lib"
- >
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug Recstore|Win32"
ExcludedFromBuild="true"
>
<Tool
@@ -1699,6 +1699,10 @@ >
</File>
<File
+ RelativePath="..\util\base64.cpp"
+ >
+ </File>
+ <File
RelativePath="..\util\httpclient.cpp"
>
</File>
diff --git a/db/instance.cpp b/db/instance.cpp index 150647bf17d..1ce58a97c0c 100644 --- a/db/instance.cpp +++ b/db/instance.cpp @@ -320,7 +320,6 @@ namespace mongo { uassert( "not master", isMasterNs( ns ) ); setClient(ns); Top::setWrite(); - //if( database->profile ) ss << ns << ' '; int flags = d.pullInt(); BSONObj query = d.nextJsObj(); @@ -332,13 +331,15 @@ namespace mongo { assert( toupdate.objsize() < m.data->dataLen() ); assert( query.objsize() + toupdate.objsize() < m.data->dataLen() ); bool upsert = flags & 1; + bool multi = flags & 2; { string s = query.toString(); + /* todo: we shouldn't do all this ss stuff when we don't need it, it will slow us down. */ ss << " query: " << s; strncpy(currentOp.query, s.c_str(), sizeof(currentOp.query)-2); } - bool updatedExisting = updateObjects(ns, toupdate, query, upsert, ss); - recordUpdate( updatedExisting, ( upsert || updatedExisting ) ? 1 : 0 ); + bool updatedExisting = updateObjects(ns, toupdate, query, upsert, ss, multi); + recordUpdate( updatedExisting, ( upsert || updatedExisting ) ? 1 : 0 ); // for getlasterror } void receivedDelete(Message& m, stringstream &ss) { diff --git a/db/query.cpp b/db/query.cpp index d2890422365..4eb8aa3181e 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -750,6 +750,7 @@ namespace mongo { uassert("cannot update reserved $ collection", strchr(ns, '$') == 0 ); if ( strstr(ns, ".system.") ) { + /* dm: it's very important that system.indexes is never updated as IndexDetails has pointers into it */ uassert("cannot update system collection", legalClientSystemNS( ns , true ) ); } @@ -862,9 +863,13 @@ namespace mongo { int _updateObjects(const char *ns, BSONObj updateobj, BSONObj pattern, bool upsert, stringstream& ss, bool logop=false) { return __updateObjects( ns, updateobj, pattern, upsert, ss, logop ); } - - bool updateObjects(const char *ns, BSONObj updateobj, BSONObj pattern, bool upsert, stringstream& ss) { + + /* multi means multiple updates. this is not implemented yet, but stubbing out for future work */ + /* todo - clean up these crazy __updateobjects return codes! */ + bool updateObjects(const char *ns, BSONObj updateobj, BSONObj pattern, bool upsert, stringstream& ss, bool multi) { + uassert("multi not coded yet", !multi); int rc = __updateObjects(ns, updateobj, pattern, upsert, ss, true); + /* todo: why is there a logOp here when __updateObjects also does a bunch of logOps? */ if ( rc != 5 && rc != 0 && rc != 4 && rc != 3 ) logOp("u", ns, updateobj, &pattern, &upsert); return ( rc == 1 || rc == 2 || rc == 5 ); diff --git a/db/query.h b/db/query.h index 29f13783369..246f7881829 100644 --- a/db/query.h +++ b/db/query.h @@ -71,11 +71,13 @@ namespace mongo { -// for an existing query (ie a ClientCursor), send back additional information. + // for an existing query (ie a ClientCursor), send back additional information. QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid); - // returns true if an existing object was updated, false if no existing object was found. - bool updateObjects(const char *ns, BSONObj updateobj, BSONObj pattern, bool upsert, stringstream& ss); + /* returns true if an existing object was updated, false if no existing object was found. + multi - update multiple objects - mostly useful with things like $set + */ + bool updateObjects(const char *ns, BSONObj updateobj, BSONObj pattern, bool upsert, stringstream& ss, bool multi = false); // If justOne is true, deletedId is set to the id of the deleted object. int deleteObjects(const char *ns, BSONObj pattern, bool justOne, bool logop = false, bool god=false); diff --git a/dbtests/framework.cpp b/dbtests/framework.cpp index 10f9e1842b8..25a49242ed1 100644 --- a/dbtests/framework.cpp +++ b/dbtests/framework.cpp @@ -94,7 +94,7 @@ namespace mongo { delete( ae ); } catch ( std::exception& e ){ - err << " exception " << " : " << e.what(); + err << " exception: " << e.what(); } catch ( int x ){ err << " caught int : " << x << endl; @@ -106,7 +106,7 @@ namespace mongo { if ( ! passes ){ r->_fails++; r->_messages.push_back( err.str() ); - } + } } log(1) << "\t DONE running tests" << endl; diff --git a/dbtests/queryoptimizertests.cpp b/dbtests/queryoptimizertests.cpp index c1c1740e385..3a6fe3ae907 100644 --- a/dbtests/queryoptimizertests.cpp +++ b/dbtests/queryoptimizertests.cpp @@ -728,7 +728,7 @@ namespace QueryOptimizerTests { ASSERT_EQUALS( 3, runCount( ns(), BSON( "query" << BSONObj() ), err ) ); ASSERT_EQUALS( 3, runCount( ns(), BSON( "query" << BSON( "a" << GT << 0 ) ), err ) ); // missing ns - ASSERT_EQUALS( -1, runCount( "missingNS", BSONObj(), err ) ); + ASSERT_EQUALS( -1, runCount( "unittests.missingNS", BSONObj(), err ) ); // impossible match ASSERT_EQUALS( 0, runCount( ns(), BSON( "query" << BSON( "a" << GT << 0 << LT << -1 ) ), err ) ); } @@ -738,7 +738,7 @@ namespace QueryOptimizerTests { public: void run() { Message m; - assembleRequest( "missingNS", BSONObj(), 0, 0, 0, 0, m ); + assembleRequest( "unittests.missingNS", BSONObj(), 0, 0, 0, 0, m ); stringstream ss; ASSERT_EQUALS( 0, runQuery( m, ss )->nReturned ); } diff --git a/dbtests/test.vcproj b/dbtests/test.vcproj index fb485a7efb0..2e559a0de22 100644 --- a/dbtests/test.vcproj +++ b/dbtests/test.vcproj @@ -350,30 +350,30 @@ >
</File>
<File
- RelativePath="..\..\js\js\Debug\js.lib"
+ RelativePath="..\..\js\js\Release\js.lib"
>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
- </File>
- <File
- RelativePath="..\..\js\js\Release\js.lib"
- >
<FileConfiguration
- Name="Debug|Win32"
+ Name="Debug Recstore|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\js\js\Debug\js.lib"
+ >
<FileConfiguration
- Name="Debug Recstore|Win32"
+ Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
@@ -1683,6 +1683,10 @@ >
</File>
<File
+ RelativePath="..\util\base64.cpp"
+ >
+ </File>
+ <File
RelativePath="..\util\httpclient.cpp"
>
</File>
diff --git a/s/dbgrid.vcproj b/s/dbgrid.vcproj index df5e302c152..290beb1d4c3 100644 --- a/s/dbgrid.vcproj +++ b/s/dbgrid.vcproj @@ -429,6 +429,10 @@ >
</File>
<File
+ RelativePath="..\util\base64.cpp"
+ >
+ </File>
+ <File
RelativePath="..\db\commands.cpp"
>
</File>
diff --git a/util/assert_util.cpp b/util/assert_util.cpp index 31ba3518b1d..b43aa076689 100644 --- a/util/assert_util.cpp +++ b/util/assert_util.cpp @@ -39,7 +39,11 @@ namespace mongo { sayDbContext(); raiseError(msg && *msg ? msg : "assertion failure"); lastAssert[0].set(msg, getDbContext().c_str(), file, line); - throw AssertionException(); + stringstream temp; + temp << "assertion " << file << ":" << line; + AssertionException e; + e.msg = temp.str(); + throw e; } void uassert_nothrow(const char *msg) { diff --git a/util/base64.h b/util/base64.h index c9dde9c23dc..46dabafd047 100644 --- a/util/base64.h +++ b/util/base64.h @@ -16,8 +16,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "stdafx.h" - namespace mongo { namespace base64 { |