From e24e6f3cbec9fc057f02633dbae13a0640af53ee Mon Sep 17 00:00:00 2001 From: yellow Date: Fri, 29 May 2009 07:32:30 -0400 Subject: [PATCH 01/25] fixed some readline issues with scon MINOR --- SConstruct | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/SConstruct b/SConstruct index c8490f93334..129400807ab 100644 --- a/SConstruct +++ b/SConstruct @@ -506,10 +506,7 @@ def doConfigure( myenv , needJava=True , needPcre=True , shell=False ): if release and not java and not windows and failIfNotFound: - extra = "" - if linux64 and shell: - extra += " 32 bit version for shell" - print( "ERROR: can't find static version of: " + str( poss ) + extra + " in: " + str( allPlaces ) ) + print( "ERROR: can't find static version of: " + str( poss ) + " in: " + str( allPlaces ) ) Exit(1) res = not staticOnly and conf.CheckLib( poss ) @@ -583,11 +580,11 @@ def doConfigure( myenv , needJava=True , needPcre=True , shell=False ): myCheckLib( "ncurses" , True ) else: myenv.Append( LINKFLAGS=" /usr/lib/libreadline.dylib " ) - elif myCheckLib( "readline" ): + elif myCheckLib( "readline" , release , staticOnly=release ): myenv.Append( CPPDEFINES=[ "USE_READLINE" ] ) myCheckLib( "tinfo" , staticOnly=release ) else: - print( "WARNING: no readline, shell will be a bit ugly" ) + print( "warning: no readline, shell will be a bit ugly" ) if linux: myCheckLib( "rt" , True ) @@ -1042,7 +1039,6 @@ if distBuild: installDir = "mongodb-" + platform + "-" + processor + "-"; installDir += getDistName( installDir ) print "going to make dist: " + installDir - Exit(1) # binaries From 7dbf34c67ed1933a0958007fcd17001955f6f70d Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Fri, 29 May 2009 10:21:43 -0400 Subject: [PATCH 02/25] if the version in the code is 'clean' then do a dist release for s3dist --- SConstruct | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 129400807ab..013f94b67ee 100644 --- a/SConstruct +++ b/SConstruct @@ -241,6 +241,7 @@ installDir = DEFAULT_INSTALl_DIR nixLibPrefix = "lib" distName = GetOption( "distname" ) +dontReplacePackage = False javaHome = GetOption( "javaHome" ) javaVersion = "i386"; @@ -1022,14 +1023,18 @@ def getCodeVersion(): def getDistName( sofar ): global distName - + global dontReplacePackage + if distName is not None: return distName if str( COMMAND_LINE_TARGETS[0] ) == "s3dist": version = getCodeVersion() if not version.endswith( "+" ): - print( "maybe a real version" ) + print( "got real code version, doing release build for: " + version ) + dontReplacePackage = True + distName = version + return version return today.strftime( "%Y-%m-%d" ) @@ -1147,6 +1152,10 @@ def s3push( localName , remoteName=None , remotePrefix=None , fixName=True , pla name = platform + "/" + name print( "uploading " + localName + " to http://s3.amazonaws.com/" + s.name + "/" + name ) + if dontReplacePackage: + for ( key , modify , etag , size ) in s.listdir( prefix=name ): + print( "error: already a file with that name, not uploading" ) + Exit(2) s.put( name , open( localName , "rb" ).read() , acl="public-read" ); print( " done uploading!" ) From 107c1b979d3133c255e1fab227d7c629f3884367 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Fri, 29 May 2009 10:24:23 -0400 Subject: [PATCH 03/25] BUMP 0.9.3 --- stdafx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdafx.cpp b/stdafx.cpp index 24c295224ef..9de1f5e4b72 100644 --- a/stdafx.cpp +++ b/stdafx.cpp @@ -22,7 +22,7 @@ namespace mongo { - const char versionString[] = "0.9.2+"; + const char versionString[] = "0.9.3"; // TODO: reference any additional headers you need in STDAFX.H // and not in this file From bc43e8c7938649d4d429b87e64bbda95ef0a5b48 Mon Sep 17 00:00:00 2001 From: eliot Date: Fri, 29 May 2009 12:08:51 -0400 Subject: [PATCH 04/25] windows compile MINOR --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 013f94b67ee..088b6028507 100644 --- a/SConstruct +++ b/SConstruct @@ -581,7 +581,7 @@ def doConfigure( myenv , needJava=True , needPcre=True , shell=False ): myCheckLib( "ncurses" , True ) else: myenv.Append( LINKFLAGS=" /usr/lib/libreadline.dylib " ) - elif myCheckLib( "readline" , release , staticOnly=release ): + elif myCheckLib( "readline" , release and nix , staticOnly=release ): myenv.Append( CPPDEFINES=[ "USE_READLINE" ] ) myCheckLib( "tinfo" , staticOnly=release ) else: From b363a5baa5a70380084f73553c7fbb353b7deac2 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Fri, 29 May 2009 12:09:40 -0400 Subject: [PATCH 05/25] change version string to 0.9.3+ --- stdafx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdafx.cpp b/stdafx.cpp index 9de1f5e4b72..74444f3ea04 100644 --- a/stdafx.cpp +++ b/stdafx.cpp @@ -22,7 +22,7 @@ namespace mongo { - const char versionString[] = "0.9.3"; + const char versionString[] = "0.9.3+"; // TODO: reference any additional headers you need in STDAFX.H // and not in this file From 21e7f9c42cea1cafc3d9d89486ced6325c458d90 Mon Sep 17 00:00:00 2001 From: yellow Date: Fri, 29 May 2009 13:23:25 -0400 Subject: [PATCH 06/25] strip installed binaries --- SConstruct | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 088b6028507..0c3dd935da1 100644 --- a/SConstruct +++ b/SConstruct @@ -1051,10 +1051,15 @@ allBinaries = [] def installBinary( e , name ): global allBinaries + if windows: name += ".exe" - env.Install( installDir + "/bin" , name ) + + inst = e.Install( installDir + "/bin" , name ) + allBinaries += [ name ] + if nix: + e.AddPostAction( inst, e.Action( 'strip ' + installDir + "/bin/" + name ) ) installBinary( env , "mongodump" ) installBinary( env , "mongorestore" ) From c4f307c4858ef996ef62ebbeb2871faa4f4b7ff1 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 29 May 2009 13:36:42 -0400 Subject: [PATCH 07/25] create /data/ and /data/db/ in scons target tests if they don't exist --- SConstruct | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 013f94b67ee..8aa0527cc46 100644 --- a/SConstruct +++ b/SConstruct @@ -786,6 +786,10 @@ elif not onlyServer: testEnv.Alias( "dummySmokeSideEffect", [], [] ) def addSmoketest( name, deps, actions ): + if type( actions ) == type( list() ): + actions = [ testSetup ] + actions + else: + actions = [ testSetup, actions ] testEnv.Alias( name, deps, actions ) testEnv.AlwaysBuild( name ) # Prevent smoke tests from running in parallel @@ -800,10 +804,15 @@ def ensureDir( name ): print( "Failed to create dir: " + name ); Exit( 1 ) -def testSetup( env , target , source ): +def ensureTestDirs(): ensureDir( "/tmp/unittest/" ) + ensureDir( "/data/" ) + ensureDir( "/data/db/" ) -addSmoketest( "smoke", [ "test" ] , [ testSetup , test[ 0 ].abspath ] ) +def testSetup( env , target , source ): + ensureTestDirs() + +addSmoketest( "smoke", [ "test" ] , [ test[ 0 ].abspath ] ) addSmoketest( "smokePerf", [ "perftest" ] , [ perftest[ 0 ].abspath ] ) clientExec = [ x[0].abspath for x in clientTests ] @@ -869,6 +878,7 @@ def startMongodForTests( env, target, source ): return mongodForTestsPort = "40000" import os + ensureTestDirs() dirName = "/data/db/sconsTests/" ensureDir( dirName ) from subprocess import Popen From bff800e98a6eacb92566a49bdecec583d807e76d Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 29 May 2009 15:21:01 -0400 Subject: [PATCH 08/25] fix test race condition MINOR --- jstests/clone/clonecollection.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jstests/clone/clonecollection.js b/jstests/clone/clonecollection.js index 0f1108eb0f1..4ce619fb0e6 100644 --- a/jstests/clone/clonecollection.js +++ b/jstests/clone/clonecollection.js @@ -138,7 +138,15 @@ sleep( 200 ); f.a.save( { i: -1 } ); waitParallel(); -ret = rawMongoProgramOutput().match( /clone_clone_clone_commandResult:::::(.*):::::/ )[ 1 ]; +// even after parallel shell finished, must wait for finishToken line to appear in log +assert.soon( function() { + ret = rawMongoProgramOutput().match( /clone_clone_clone_commandResult:::::(.*):::::/ ); + if ( ret == null ) { + return false; + } + ret = ret[ 1 ]; + return true; + } ); eval( "ret = " + ret ); From f490759af1a138ceae561bddcc9e51317795e428 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 29 May 2009 15:32:24 -0400 Subject: [PATCH 09/25] smokeRepl relies on mongobridge MINOR --- SConstruct | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 16ec8ce09a4..0d01f8b4fd9 100644 --- a/SConstruct +++ b/SConstruct @@ -860,7 +860,7 @@ def runShellTest( env, target, source ): if not onlyServer and not noshell: addSmoketest( "smokeJs", [ "mongo" ], runShellTest ) addSmoketest( "smokeClone", [ "mongo", "mongod" ], [ jsDirTestSpec( "clone" ) ] ) - addSmoketest( "smokeRepl", [ "mongo", "mongod" ], [ jsDirTestSpec( "repl" ) ] ) + addSmoketest( "smokeRepl", [ "mongo", "mongod", "mongobridge" ], [ jsDirTestSpec( "repl" ) ] ) addSmoketest( "smokeDisk", [ "mongo", "mongod" ], [ jsDirTestSpec( "disk" ) ] ) addSmoketest( "smokeSharding", [ "mongo", "mongod", "mongos" ], [ jsDirTestSpec( "sharding" ) ] ) addSmoketest( "smokeJsPerf", [ "mongo" ], runShellTest ) From ec8d64817af4560f1e5f8d233b7ce69a0017f1f2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 May 2009 23:43:59 +0800 Subject: [PATCH 10/25] Added vs 2008 projects for building MongoDB components Signed-off-by: mongodb --- msvc/bin/Debug/README | 1 + msvc/bin/Release/README | 1 + msvc/core_server/core_server.vcproj | 216 +++++ msvc/lib/Debug/README | 1 + msvc/lib/Release/README | 1 + msvc/mongo.sln | 138 +++ msvc/mongo/mongo.vcproj | 288 ++++++ msvc/mongo_app.vsprops | 22 + msvc/mongo_common/mongo_common.vcproj | 920 ++++++++++++++++++++ msvc/mongo_lib.vsprops | 22 + msvc/mongobridge/mongobridge.vcproj | 272 ++++++ msvc/mongoclient/mongoclient.vcproj | 216 +++++ msvc/mongod/mongod.vcproj | 208 +++++ msvc/mongodump/mongodump.vcproj | 272 ++++++ msvc/mongoexport/mongoexport.vcproj | 272 ++++++ msvc/mongofiles/mongofiles.vcproj | 272 ++++++ msvc/mongoimportjson/mongoimportjson.vcproj | 272 ++++++ msvc/mongorestore/mongorestore.vcproj | 272 ++++++ msvc/mongos/mongos.vcproj | 204 +++++ msvc/msvc_scripting.cpp | 10 + msvc/server_only/server_only.vcproj | 354 ++++++++ msvc/shard_server/shard_server.vcproj | 238 +++++ 22 files changed, 4472 insertions(+) create mode 100644 msvc/bin/Debug/README create mode 100644 msvc/bin/Release/README create mode 100644 msvc/core_server/core_server.vcproj create mode 100644 msvc/lib/Debug/README create mode 100644 msvc/lib/Release/README create mode 100644 msvc/mongo.sln create mode 100644 msvc/mongo/mongo.vcproj create mode 100644 msvc/mongo_app.vsprops create mode 100644 msvc/mongo_common/mongo_common.vcproj create mode 100644 msvc/mongo_lib.vsprops create mode 100644 msvc/mongobridge/mongobridge.vcproj create mode 100644 msvc/mongoclient/mongoclient.vcproj create mode 100644 msvc/mongod/mongod.vcproj create mode 100644 msvc/mongodump/mongodump.vcproj create mode 100644 msvc/mongoexport/mongoexport.vcproj create mode 100644 msvc/mongofiles/mongofiles.vcproj create mode 100644 msvc/mongoimportjson/mongoimportjson.vcproj create mode 100644 msvc/mongorestore/mongorestore.vcproj create mode 100644 msvc/mongos/mongos.vcproj create mode 100644 msvc/msvc_scripting.cpp create mode 100644 msvc/server_only/server_only.vcproj create mode 100644 msvc/shard_server/shard_server.vcproj diff --git a/msvc/bin/Debug/README b/msvc/bin/Debug/README new file mode 100644 index 00000000000..edf36a256dc --- /dev/null +++ b/msvc/bin/Debug/README @@ -0,0 +1 @@ +This is a dummy file to prevent Git from ignoring this empty directory. \ No newline at end of file diff --git a/msvc/bin/Release/README b/msvc/bin/Release/README new file mode 100644 index 00000000000..edf36a256dc --- /dev/null +++ b/msvc/bin/Release/README @@ -0,0 +1 @@ +This is a dummy file to prevent Git from ignoring this empty directory. \ No newline at end of file diff --git a/msvc/core_server/core_server.vcproj b/msvc/core_server/core_server.vcproj new file mode 100644 index 00000000000..6ac3aa669e6 --- /dev/null +++ b/msvc/core_server/core_server.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/lib/Debug/README b/msvc/lib/Debug/README new file mode 100644 index 00000000000..edf36a256dc --- /dev/null +++ b/msvc/lib/Debug/README @@ -0,0 +1 @@ +This is a dummy file to prevent Git from ignoring this empty directory. \ No newline at end of file diff --git a/msvc/lib/Release/README b/msvc/lib/Release/README new file mode 100644 index 00000000000..edf36a256dc --- /dev/null +++ b/msvc/lib/Release/README @@ -0,0 +1 @@ +This is a dummy file to prevent Git from ignoring this empty directory. \ No newline at end of file diff --git a/msvc/mongo.sln b/msvc/mongo.sln new file mode 100644 index 00000000000..6b0b1cc1ab3 --- /dev/null +++ b/msvc/mongo.sln @@ -0,0 +1,138 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongo_common", "mongo_common\mongo_common.vcproj", "{69E92318-D8DA-434E-B3D6-F172E88ADC95}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongod", "mongod\mongod.vcproj", "{0811084D-41C1-49E6-998B-3B1230227FF0}" + ProjectSection(ProjectDependencies) = postProject + {3FEF2C0D-6B49-469F-94C4-0673291D58CE} = {3FEF2C0D-6B49-469F-94C4-0673291D58CE} + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + {8DA99072-BDC8-4204-8DE2-67B5A5466D40} = {8DA99072-BDC8-4204-8DE2-67B5A5466D40} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongo", "mongo\mongo.vcproj", "{34348125-2F31-459F-AA95-A1525903AE2B}" + ProjectSection(ProjectDependencies) = postProject + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_server", "core_server\core_server.vcproj", "{8DA99072-BDC8-4204-8DE2-67B5A5466D40}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server_only", "server_only\server_only.vcproj", "{3FEF2C0D-6B49-469F-94C4-0673291D58CE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shard_server", "shard_server\shard_server.vcproj", "{9D2CD1F3-973E-49E6-A0E2-95C834562263}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongos", "mongos\mongos.vcproj", "{942113AE-678B-4C7B-BC78-D91AB9C52390}" + ProjectSection(ProjectDependencies) = postProject + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + {8DA99072-BDC8-4204-8DE2-67B5A5466D40} = {8DA99072-BDC8-4204-8DE2-67B5A5466D40} + {9D2CD1F3-973E-49E6-A0E2-95C834562263} = {9D2CD1F3-973E-49E6-A0E2-95C834562263} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongodump", "mongodump\mongodump.vcproj", "{44348125-2F31-459F-AA95-A1525903AE2B}" + ProjectSection(ProjectDependencies) = postProject + {3FEF2C0D-6B49-469F-94C4-0673291D58CE} = {3FEF2C0D-6B49-469F-94C4-0673291D58CE} + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongorestore", "mongorestore\mongorestore.vcproj", "{45348125-2F31-459F-AA95-A1525903AE2B}" + ProjectSection(ProjectDependencies) = postProject + {3FEF2C0D-6B49-469F-94C4-0673291D58CE} = {3FEF2C0D-6B49-469F-94C4-0673291D58CE} + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongoexport", "mongoexport\mongoexport.vcproj", "{45448125-2F31-459F-AA95-A1525903AE2B}" + ProjectSection(ProjectDependencies) = postProject + {3FEF2C0D-6B49-469F-94C4-0673291D58CE} = {3FEF2C0D-6B49-469F-94C4-0673291D58CE} + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongoimportjson", "mongoimportjson\mongoimportjson.vcproj", "{45459135-2F31-459F-AA95-A1525903AE2B}" + ProjectSection(ProjectDependencies) = postProject + {3FEF2C0D-6B49-469F-94C4-0673291D58CE} = {3FEF2C0D-6B49-469F-94C4-0673291D58CE} + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongofiles", "mongofiles\mongofiles.vcproj", "{45459125-2F31-459F-AA95-A1525903AE2B}" + ProjectSection(ProjectDependencies) = postProject + {3FEF2C0D-6B49-469F-94C4-0673291D58CE} = {3FEF2C0D-6B49-469F-94C4-0673291D58CE} + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongobridge", "mongobridge\mongobridge.vcproj", "{45458225-2F31-459F-AA95-A1525903AE2B}" + ProjectSection(ProjectDependencies) = postProject + {3FEF2C0D-6B49-469F-94C4-0673291D58CE} = {3FEF2C0D-6B49-469F-94C4-0673291D58CE} + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mongoclient", "mongoclient\mongoclient.vcproj", "{36AAAE5C-4750-4713-9240-A43BE30BA8D3}" + ProjectSection(ProjectDependencies) = postProject + {69E92318-D8DA-434E-B3D6-F172E88ADC95} = {69E92318-D8DA-434E-B3D6-F172E88ADC95} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {69E92318-D8DA-434E-B3D6-F172E88ADC95}.Debug|Win32.ActiveCfg = Debug|Win32 + {69E92318-D8DA-434E-B3D6-F172E88ADC95}.Debug|Win32.Build.0 = Debug|Win32 + {69E92318-D8DA-434E-B3D6-F172E88ADC95}.Release|Win32.ActiveCfg = Release|Win32 + {69E92318-D8DA-434E-B3D6-F172E88ADC95}.Release|Win32.Build.0 = Release|Win32 + {0811084D-41C1-49E6-998B-3B1230227FF0}.Debug|Win32.ActiveCfg = Debug|Win32 + {0811084D-41C1-49E6-998B-3B1230227FF0}.Debug|Win32.Build.0 = Debug|Win32 + {0811084D-41C1-49E6-998B-3B1230227FF0}.Release|Win32.ActiveCfg = Release|Win32 + {0811084D-41C1-49E6-998B-3B1230227FF0}.Release|Win32.Build.0 = Release|Win32 + {34348125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.ActiveCfg = Debug|Win32 + {34348125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.Build.0 = Debug|Win32 + {34348125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.ActiveCfg = Release|Win32 + {34348125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.Build.0 = Release|Win32 + {8DA99072-BDC8-4204-8DE2-67B5A5466D40}.Debug|Win32.ActiveCfg = Debug|Win32 + {8DA99072-BDC8-4204-8DE2-67B5A5466D40}.Debug|Win32.Build.0 = Debug|Win32 + {8DA99072-BDC8-4204-8DE2-67B5A5466D40}.Release|Win32.ActiveCfg = Release|Win32 + {8DA99072-BDC8-4204-8DE2-67B5A5466D40}.Release|Win32.Build.0 = Release|Win32 + {3FEF2C0D-6B49-469F-94C4-0673291D58CE}.Debug|Win32.ActiveCfg = Debug|Win32 + {3FEF2C0D-6B49-469F-94C4-0673291D58CE}.Debug|Win32.Build.0 = Debug|Win32 + {3FEF2C0D-6B49-469F-94C4-0673291D58CE}.Release|Win32.ActiveCfg = Release|Win32 + {3FEF2C0D-6B49-469F-94C4-0673291D58CE}.Release|Win32.Build.0 = Release|Win32 + {9D2CD1F3-973E-49E6-A0E2-95C834562263}.Debug|Win32.ActiveCfg = Debug|Win32 + {9D2CD1F3-973E-49E6-A0E2-95C834562263}.Debug|Win32.Build.0 = Debug|Win32 + {9D2CD1F3-973E-49E6-A0E2-95C834562263}.Release|Win32.ActiveCfg = Release|Win32 + {9D2CD1F3-973E-49E6-A0E2-95C834562263}.Release|Win32.Build.0 = Release|Win32 + {942113AE-678B-4C7B-BC78-D91AB9C52390}.Debug|Win32.ActiveCfg = Debug|Win32 + {942113AE-678B-4C7B-BC78-D91AB9C52390}.Debug|Win32.Build.0 = Debug|Win32 + {942113AE-678B-4C7B-BC78-D91AB9C52390}.Release|Win32.ActiveCfg = Release|Win32 + {942113AE-678B-4C7B-BC78-D91AB9C52390}.Release|Win32.Build.0 = Release|Win32 + {44348125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.ActiveCfg = Debug|Win32 + {44348125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.Build.0 = Debug|Win32 + {44348125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.ActiveCfg = Release|Win32 + {44348125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.Build.0 = Release|Win32 + {45348125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.ActiveCfg = Debug|Win32 + {45348125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.Build.0 = Debug|Win32 + {45348125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.ActiveCfg = Release|Win32 + {45348125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.Build.0 = Release|Win32 + {45448125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.ActiveCfg = Debug|Win32 + {45448125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.Build.0 = Debug|Win32 + {45448125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.ActiveCfg = Release|Win32 + {45448125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.Build.0 = Release|Win32 + {45459135-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.ActiveCfg = Debug|Win32 + {45459135-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.Build.0 = Debug|Win32 + {45459135-2F31-459F-AA95-A1525903AE2B}.Release|Win32.ActiveCfg = Release|Win32 + {45459135-2F31-459F-AA95-A1525903AE2B}.Release|Win32.Build.0 = Release|Win32 + {45459125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.ActiveCfg = Debug|Win32 + {45459125-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.Build.0 = Debug|Win32 + {45459125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.ActiveCfg = Release|Win32 + {45459125-2F31-459F-AA95-A1525903AE2B}.Release|Win32.Build.0 = Release|Win32 + {45458225-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.ActiveCfg = Debug|Win32 + {45458225-2F31-459F-AA95-A1525903AE2B}.Debug|Win32.Build.0 = Debug|Win32 + {45458225-2F31-459F-AA95-A1525903AE2B}.Release|Win32.ActiveCfg = Release|Win32 + {45458225-2F31-459F-AA95-A1525903AE2B}.Release|Win32.Build.0 = Release|Win32 + {36AAAE5C-4750-4713-9240-A43BE30BA8D3}.Debug|Win32.ActiveCfg = Debug|Win32 + {36AAAE5C-4750-4713-9240-A43BE30BA8D3}.Debug|Win32.Build.0 = Debug|Win32 + {36AAAE5C-4750-4713-9240-A43BE30BA8D3}.Release|Win32.ActiveCfg = Release|Win32 + {36AAAE5C-4750-4713-9240-A43BE30BA8D3}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/msvc/mongo/mongo.vcproj b/msvc/mongo/mongo.vcproj new file mode 100644 index 00000000000..1b96fd17a2d --- /dev/null +++ b/msvc/mongo/mongo.vcproj @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongo_app.vsprops b/msvc/mongo_app.vsprops new file mode 100644 index 00000000000..22980f5b011 --- /dev/null +++ b/msvc/mongo_app.vsprops @@ -0,0 +1,22 @@ + + + + + + diff --git a/msvc/mongo_common/mongo_common.vcproj b/msvc/mongo_common/mongo_common.vcproj new file mode 100644 index 00000000000..7883419cde5 --- /dev/null +++ b/msvc/mongo_common/mongo_common.vcproj @@ -0,0 +1,920 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongo_lib.vsprops b/msvc/mongo_lib.vsprops new file mode 100644 index 00000000000..d2caf0a65a3 --- /dev/null +++ b/msvc/mongo_lib.vsprops @@ -0,0 +1,22 @@ + + + + + + diff --git a/msvc/mongobridge/mongobridge.vcproj b/msvc/mongobridge/mongobridge.vcproj new file mode 100644 index 00000000000..1b2115c7ae0 --- /dev/null +++ b/msvc/mongobridge/mongobridge.vcproj @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongoclient/mongoclient.vcproj b/msvc/mongoclient/mongoclient.vcproj new file mode 100644 index 00000000000..f3b3faea1b7 --- /dev/null +++ b/msvc/mongoclient/mongoclient.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongod/mongod.vcproj b/msvc/mongod/mongod.vcproj new file mode 100644 index 00000000000..7bc0f21e854 --- /dev/null +++ b/msvc/mongod/mongod.vcproj @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongodump/mongodump.vcproj b/msvc/mongodump/mongodump.vcproj new file mode 100644 index 00000000000..8b3408a3778 --- /dev/null +++ b/msvc/mongodump/mongodump.vcproj @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongoexport/mongoexport.vcproj b/msvc/mongoexport/mongoexport.vcproj new file mode 100644 index 00000000000..375e45d32e3 --- /dev/null +++ b/msvc/mongoexport/mongoexport.vcproj @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongofiles/mongofiles.vcproj b/msvc/mongofiles/mongofiles.vcproj new file mode 100644 index 00000000000..604075b3b18 --- /dev/null +++ b/msvc/mongofiles/mongofiles.vcproj @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongoimportjson/mongoimportjson.vcproj b/msvc/mongoimportjson/mongoimportjson.vcproj new file mode 100644 index 00000000000..1c292477a10 --- /dev/null +++ b/msvc/mongoimportjson/mongoimportjson.vcproj @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongorestore/mongorestore.vcproj b/msvc/mongorestore/mongorestore.vcproj new file mode 100644 index 00000000000..54117b10fc2 --- /dev/null +++ b/msvc/mongorestore/mongorestore.vcproj @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/mongos/mongos.vcproj b/msvc/mongos/mongos.vcproj new file mode 100644 index 00000000000..0ad3ca05699 --- /dev/null +++ b/msvc/mongos/mongos.vcproj @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/msvc_scripting.cpp b/msvc/msvc_scripting.cpp new file mode 100644 index 00000000000..0b4e21f3809 --- /dev/null +++ b/msvc/msvc_scripting.cpp @@ -0,0 +1,10 @@ + +#include "stdafx.h" + +#if defined(USESM) +#include "..\scripting\engine_spidermonkey.cpp" +#elif defined(NOJNI) +#include "..\scripting\engine_java.cpp" +#else +#include "..\scripting\engine_none.cpp" +#endif \ No newline at end of file diff --git a/msvc/server_only/server_only.vcproj b/msvc/server_only/server_only.vcproj new file mode 100644 index 00000000000..3f45dee5e6c --- /dev/null +++ b/msvc/server_only/server_only.vcproj @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvc/shard_server/shard_server.vcproj b/msvc/shard_server/shard_server.vcproj new file mode 100644 index 00000000000..1335b321d5f --- /dev/null +++ b/msvc/shard_server/shard_server.vcproj @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ada453281694f4f5d971a8f9259541730bd979a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 30 May 2009 03:23:09 +0800 Subject: [PATCH 11/25] Added README file describing building MongoDB using Visual Studio 2008 Signed-off-by: mongodb --- msvc/README | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 msvc/README diff --git a/msvc/README b/msvc/README new file mode 100644 index 00000000000..1a7221a89c9 --- /dev/null +++ b/msvc/README @@ -0,0 +1,54 @@ + +Instructions for compiling MongoDB in Visual Studio 2008 +======================================================== + +Visual Studio Solution: +----------------------- + +mongo.sln -> MongoDB solution that contains all projects necessary for building applications and libraries. + + + +Static Library Projects: +------------------------ + +mongo_common -> common MongoDB files +core_server -> score server files +server_only -> files for building server-only applications +shard_server -> shard server files + + +Console Application Projects: +----------------------------- + +mongod -> MongoDB server (links mongo_common and server_only) +mongo -> MongoDB shell (links mongo_common) +mongobridge -> MongoDB bridge server shell (links mongo_common and server_only) +mongodump -> MongoDB dump application (links mongo_common and server_only) +mongoexport -> MongoDB export application (links mongo_common and server_only) +mongofiles -> MongoDB files application (links mongo_common and server_only) +mongoimportjson -> MongoDB import json application (links mongo_common and server_only) +mongorestore -> MongoDB restore application (links mongo_common and server_only) +mongos -> MongoDB shard server (links mongo_common, core_server and shard_server) + + +Client Driver Library: +----------------------------- + +mongoclient -> static library containing client driver files + + + +Notes: +====== + +1) All static libraries derive project settings from Project Property Sheet "mongo_lib" +(View->Other Windows->Property Manager). Settings configured in this Property Sheet will +be inherited by all static library projects (Include Directories, Library Directories, etc). + +2) All console applications derive project settings from "mongo_app". + +3) msvc_scripting.cpp is used to control the javascript library to use - to change, simply +modify the "Preprocessor" project setting in the Property Sheets to reflect the required +javascript option (USESM or NOJNI). + From 8c107408f27930db95ae43bde40dd8418c466910 Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 29 May 2009 15:56:45 -0400 Subject: [PATCH 12/25] use rawOut() when shell seg faults, log if shell gets SIGPIPE MINOR --- shell/dbshell.cpp | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp index 6274aca9121..d74b84bb7fa 100644 --- a/shell/dbshell.cpp +++ b/shell/dbshell.cpp @@ -52,32 +52,21 @@ char * shellReadline( const char * prompt ){ #include void quitNicely( int sig ){ + if ( sig == SIGPIPE ) + mongo::rawOut( "mongo got signal SIGPIPE\n" ); shellHistoryDone(); exit(0); } -/* use "addr2line -CFe " to parse. */ -inline void printStackTrace() { - void *b[20]; - size_t size; - char **strings; - size_t i; - - size = backtrace(b, 20); - strings = backtrace_symbols(b, size); - - for (i = 0; i < size; i++) - cout << hex << b[i] << ' '; - cout << '\n'; - for (i = 0; i < size; i++) - cout << ' ' << strings[i] << '\n'; - cout << dec; - free (strings); -} - void quitAbruptly( int sig ) { - cout << "mongo got signal " << sig << " (" << strsignal( sig ) << "), stack trace: " << endl; - printStackTrace(); + ostringstream ossSig; + ossSig << "mongo got signal " << sig << " (" << strsignal( sig ) << "), stack trace: " << endl; + mongo::rawOut( ossSig.str() ); + + ostringstream ossBt; + mongo::printStackTrace( ossBt ); + mongo::rawOut( ossBt.str() ); + mongo::shellUtils::KillMongoProgramInstances(); exit(14); } From 3cb12e98e7814b93b2c859522956c69dbfb0ff5d Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Fri, 29 May 2009 16:26:59 -0400 Subject: [PATCH 13/25] hack for ubuntu's weird js version --- scripting/engine_spidermonkey.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripting/engine_spidermonkey.h b/scripting/engine_spidermonkey.h index 480a868aa55..1e8b6ec5b22 100644 --- a/scripting/engine_spidermonkey.h +++ b/scripting/engine_spidermonkey.h @@ -6,6 +6,8 @@ #if defined( MOZJS ) +#define MOZILLA_1_8_BRANCH + #include "mozjs/jsapi.h" #include "mozjs/jsdate.h" From 11aaed6a9ffd7e911dd4c1f8cb3f80512a5ce843 Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Mon, 1 Jun 2009 11:28:03 -0400 Subject: [PATCH 14/25] js can be a sibling to mongo directory on windows --- SConstruct | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 0d01f8b4fd9..677ae44f910 100644 --- a/SConstruct +++ b/SConstruct @@ -337,6 +337,8 @@ elif "win32" == os.sys.platform: if usesm: env.Append( CPPPATH=[ "js/src/" ] ) + env.Append(CPPPATH=["../js/src/"]) + env.Append(LIBPATH=["../js/src"]) env.Append( CPPDEFINES=[ "OLDJS" ] ) else: javaHome = findVersion( "C:/Program Files/java/" , @@ -354,7 +356,7 @@ elif "win32" == os.sys.platform: env.Append( CPPDEFINES=["WIN32","_CONSOLE","_CRT_SECURE_NO_WARNINGS","HAVE_CONFIG_H","PCRE_STATIC","_UNICODE","UNICODE" ] ) #env.Append( CPPFLAGS=' /Yu"stdafx.h" ' ) # this would be for pre-compiled headers, could play with it later - + if release: env.Append( CPPDEFINES=[ "NDEBUG" ] ) env.Append( CPPFLAGS= " /O2 /Oi /GL /FD /MT /Gy /nologo /Zi /TP /errorReport:prompt /Gm " ) @@ -469,7 +471,7 @@ def bigLibString( myenv ): if 'SLIBS' in myenv._dict: s += str( myenv["SLIBS"] ) return s - + def doConfigure( myenv , needJava=True , needPcre=True , shell=False ): conf = Configure(myenv) @@ -548,7 +550,7 @@ def doConfigure( myenv , needJava=True , needPcre=True , shell=False ): if nix and needPcre: myCheckLib( "pcrecpp" , True ) myCheckLib( "pcre" , True ) - + myenv["_HAVEPCAP"] = myCheckLib( "pcap", staticOnly=release ) # this is outside of usesm block so don't have to rebuild for java From 4a534aedd1d1b4874363c1e4683a3c8547ece4bf Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 11:34:11 -0400 Subject: [PATCH 15/25] fix dates in spider monkey SERVER-83 --- jstests/date1.js | 14 ++++++++++---- scripting/engine_spidermonkey.h | 2 ++ scripting/sm_db.cpp | 15 +++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/jstests/date1.js b/jstests/date1.js index a0b8dced730..27e56a31731 100644 --- a/jstests/date1.js +++ b/jstests/date1.js @@ -1,8 +1,14 @@ t = db.date1; -t.drop(); -d = new Date() -t.save( { a : 1 , d : d } ); -assert.eq( d , t.findOne().d , "A" ) +function go( d , msg ){ + t.drop(); + t.save( { a : 1 , d : d } ); + assert.eq( d , t.findOne().d , msg ) +} + +go( new Date() , "A" ) +go( new Date( 1 ) , "B") +go( new Date( 0 ) , "C") + diff --git a/scripting/engine_spidermonkey.h b/scripting/engine_spidermonkey.h index 1e8b6ec5b22..075f5244300 100644 --- a/scripting/engine_spidermonkey.h +++ b/scripting/engine_spidermonkey.h @@ -42,6 +42,8 @@ JSBool JS_CStringsAreUTF8(){ return false; } +#define js_DateClass date_class + #endif // -- END SM 1.6 hacks --- diff --git a/scripting/sm_db.cpp b/scripting/sm_db.cpp index a27d7438b1e..e7a8d9b1940 100644 --- a/scripting/sm_db.cpp +++ b/scripting/sm_db.cpp @@ -555,17 +555,12 @@ namespace mongo { b.appendTimestamp( name.c_str() , (unsigned long long)c->getNumber( o , "t" ) , (unsigned int )c->getNumber( o , "i" ) ); return true; } - - { - jsdouble d = js_DateGetMsecSinceEpoch( c->_context , o ); - if ( d ){ - b.appendDate( name.c_str() , (unsigned long long)d ); - return true; - } - } - - + if ( JS_InstanceOf( c->_context , o, &js_DateClass, 0 ) ){ + jsdouble d = js_DateGetMsecSinceEpoch( c->_context , o ); + b.appendDate( name.c_str() , (unsigned long long)d ); + return true; + } return false; } From d6811aaaaddb117e931702c22b4f1c02fa428020 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 12:53:24 -0400 Subject: [PATCH 16/25] CodeWScope SERVER-80 --- dbtests/jstests.cpp | 33 +++++++++++++++++++++++++++++++ scripting/engine_spidermonkey.cpp | 16 ++++++++++++--- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/dbtests/jstests.cpp b/dbtests/jstests.cpp index 0dc96fdb31f..112606ce2d1 100644 --- a/dbtests/jstests.cpp +++ b/dbtests/jstests.cpp @@ -485,6 +485,36 @@ namespace JSTests { static const char *ns() { return "unittest.jstests.longutf8string"; } }; + class CodeTests { + public: + void run(){ + Scope * s = globalScriptEngine->createScope(); + + { + BSONObjBuilder b; + b.append( "a" , 1 ); + b.appendCode( "b" , "function(){ out.b = 11; }" ); + b.appendCodeWScope( "c" , "function(){ out.c = 12; }" , BSONObj() ); + b.appendCodeWScope( "d" , "function(){ out.d = 13 + bleh; }" , BSON( "bleh" << 5 ) ); + s->setObject( "foo" , b.obj() ); + } + + s->invokeSafe( "out = {}; out.a = foo.a; foo.b(); foo.c();" , BSONObj() ); + BSONObj out = s->getObject( "out" ); + + ASSERT_EQUALS( 1 , out["a"].number() ); + ASSERT_EQUALS( 11 , out["b"].number() ); + ASSERT_EQUALS( 12 , out["c"].number() ); + + //s->invokeSafe( "foo.d() " , BSONObj() ); + //out = s->getObject( "out" ); + //ASSERT_EQUALS( 18 , out["d"].number() ); + + + delete s; + } + }; + class All : public Suite { public: All() { @@ -492,6 +522,7 @@ namespace JSTests { add< BasicScope >(); add< FalseTests >(); add< SimpleFunctions >(); + add< ObjectMapping >(); add< ObjectDecoding >(); add< JSOIDTests >(); @@ -499,9 +530,11 @@ namespace JSTests { add< OtherJSTypes >(); add< SpecialDBTypes >(); add< TypeConservation >(); + add< WeirdObjects >(); add< Utf8Check >(); add< LongUtf8String >(); + add< CodeTests >(); } }; diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index f450a1e8c03..356636cf761 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -258,13 +258,13 @@ namespace mongo { return true; } - JSFunction * compileFunction( const char * code ){ + JSFunction * compileFunction( const char * code, JSObject * assoc = 0 ){ if ( ! hasFunctionIdentifier( code ) ){ string s = code; if ( isSimpleStatement( s ) ){ s = "return " + s; } - return JS_CompileFunction( _context , 0 , "anonymous" , 0 , 0 , s.c_str() , strlen( s.c_str() ) , "nofile_a" , 0 ); + return JS_CompileFunction( _context , assoc , "anonymous" , 0 , 0 , s.c_str() , strlen( s.c_str() ) , "nofile_a" , 0 ); } // TODO: there must be a way in spider monkey to do this - this is a total hack @@ -273,7 +273,7 @@ namespace mongo { s += code; s += ";"; - JSFunction * func = JS_CompileFunction( _context , 0 , "anonymous" , 0 , 0 , s.c_str() , strlen( s.c_str() ) , "nofile_b" , 0 ); + JSFunction * func = JS_CompileFunction( _context , assoc , "anonymous" , 0 , 0 , s.c_str() , strlen( s.c_str() ) , "nofile_b" , 0 ); if ( ! func ){ cerr << "compile for hack failed" << endl; return 0; @@ -383,6 +383,16 @@ namespace mongo { JSFunction * func = compileFunction( e.valuestr() ); return OBJECT_TO_JSVAL( JS_GetFunctionObject( func ) ); } + case CodeWScope:{ + JSFunction * func = compileFunction( e.codeWScopeCode() ); + + BSONObj extraScope = e.codeWScopeObject(); + if ( ! extraScope.isEmpty() ){ + log() << "warning: CodeWScope doesn't transfer to db.eval" << endl; + } + + return OBJECT_TO_JSVAL( JS_GetFunctionObject( func ) ); + } case Date: return OBJECT_TO_JSVAL( js_NewDateObjectMsec( _context , (jsdouble) e.date() ) ); From e3a3919baa70bda2f183b613c2c61d2546a53a3d Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 12:59:07 -0400 Subject: [PATCH 17/25] spider monkey 1.6 compile MINOR --- scripting/engine_spidermonkey.h | 2 +- scripting/sm_db.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripting/engine_spidermonkey.h b/scripting/engine_spidermonkey.h index 075f5244300..5ff24c35a0f 100644 --- a/scripting/engine_spidermonkey.h +++ b/scripting/engine_spidermonkey.h @@ -42,7 +42,7 @@ JSBool JS_CStringsAreUTF8(){ return false; } -#define js_DateClass date_class +#define SM16 #endif // -- END SM 1.6 hacks --- diff --git a/scripting/sm_db.cpp b/scripting/sm_db.cpp index e7a8d9b1940..ad1e53347f7 100644 --- a/scripting/sm_db.cpp +++ b/scripting/sm_db.cpp @@ -555,12 +555,24 @@ namespace mongo { b.appendTimestamp( name.c_str() , (unsigned long long)c->getNumber( o , "t" ) , (unsigned int )c->getNumber( o , "i" ) ); return true; } - + +#ifdef SM16 + { + jsdouble d = js_DateGetMsecSinceEpoch( c->_context , o ); + if ( d ){ + b.appendDate( name.c_str() , (unsigned long long)d ); + return true; + } + } +#else if ( JS_InstanceOf( c->_context , o, &js_DateClass, 0 ) ){ jsdouble d = js_DateGetMsecSinceEpoch( c->_context , o ); b.appendDate( name.c_str() , (unsigned long long)d ); return true; } +#endif + + return false; } From 4919bc092633254e4db084cbf5868b41511b2b63 Mon Sep 17 00:00:00 2001 From: kristina Date: Mon, 1 Jun 2009 13:55:45 -0400 Subject: [PATCH 18/25] man pages, version, and APGL MINOR --- debian/changelog | 2 +- debian/copyright | 7 ++---- debian/files | 2 +- debian/mongo.1 | Bin 0 -> 865 bytes debian/mongodump.1 | 36 +++++++++++++++++++++++++++ debian/mongoexport.1 | 51 ++++++++++++++++++++++++++++++++++++++ debian/mongofiles.1 | 52 +++++++++++++++++++++++++++++++++++++++ debian/mongoimportjson.1 | 45 +++++++++++++++++++++++++++++++++ debian/mongorestore.1 | 36 +++++++++++++++++++++++++++ debian/mongos.1 | 39 +++++++++++++++++++++++++++++ 10 files changed, 263 insertions(+), 7 deletions(-) create mode 100644 debian/mongo.1 create mode 100644 debian/mongodump.1 create mode 100644 debian/mongoexport.1 create mode 100644 debian/mongofiles.1 create mode 100644 debian/mongoimportjson.1 create mode 100644 debian/mongorestore.1 create mode 100644 debian/mongos.1 diff --git a/debian/changelog b/debian/changelog index 7386ae2227d..15a806665b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mongodb (0.9.1-1) unstable; urgency=low +mongodb (0.9.3-1) unstable; urgency=low * Initial release diff --git a/debian/copyright b/debian/copyright index 4236b9ffd8b..478c6f99424 100644 --- a/debian/copyright +++ b/debian/copyright @@ -17,10 +17,7 @@ Copyright: License: - Apache 2 + AGPL The Debian packaging is (C) 2009, Kristina Chodorow and -is licensed under Apache version 2, see `/usr/share/common-licenses/Apache-2.0'. - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. +is licensed under the AGPL, see `http://www.fsf.org/licensing/licenses/agpl-3.0.html'. diff --git a/debian/files b/debian/files index b5f34826b74..1511a4b2e38 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -mongodb_0.9.1-1_i386.deb devel optional +mongodb_0.9.3-1_i386.deb devel optional diff --git a/debian/mongo.1 b/debian/mongo.1 new file mode 100644 index 0000000000000000000000000000000000000000..beb66dcfce9cd16812bea6af61a28756633f2018 GIT binary patch literal 865 zcmV-n1D^aJiwFR|`6EgI1Ep0_Z{s!$e)q2+{M2HJn{?QU7PyDB_BH9+IEYi+4)ZW5 zHXUo{NIpq!mVZA=N)z{r!(mu}B(%hjqP~x$qdbII7Tp$wVTMZql~iDAgeNIBGQI^} zW77oDY6?&3{62+n976ce353hh=$h>DXoG_O9ROlx*qUh!gD9IqIG;QvVX$>u`S27N z3c1}fQRc&jQz#>4;{n;{dAi7ESs3Kit;hY5SF?1nnx*qBuaz+?G8(urs90h63j*B+gcSL(zu0Lc$fp{GHOoGr*$?{X7fiq!y_b>j zwL`Uce3b`AfrM#Mkv>~GYY&n(6;z!loNj{FS<~!+Lh^>K8w7WktmP#tBK-^QDV6vb ztut+BfM_VWZX33D*}+4W&TS2BnTZ@{v#OtE#Tz8z6oPKC;1wqn9d7eHC<>Oefm`vE z?l}FZPP`+>5G~&X|El7ObhIHaC}7qw$qHs?*Mu{0wSy&s~T>vc4We!2K>aeK%gMZUSF&;JN-;on5pt{BGA-}+!)p3I-g z46NLyR)~j1?FhCqdI=Bhd{i(W=0iVdJn}U|R#CMO4vWs|=*q7TBCj^kwcOEV*v6KR zuU+bhH*TZ=Ow()?97@2**YdFDS&0?v8t?MqsM&cxgl%|Oq{~&{tnUP{4j-H#Z@@y9 zYY0k7Jz)Ac&u8BgUswZvYz5Ztn898Ho?JV4&XT2_uYqsHy`3HIW{up~K4Lwl+QlTx zKBdd}=-e``cT!RNRvvgpxpC?`J66!n1tF=)S%K$Xv%7Thc{#hEuKX;$lkHydO>OLZ z;3^;5w*k0!!C{am2}~ZdGz>n{;Mz*{Mw|h(4ccN;Sox&;@0=a~!Uw%UMip5b)81TM r>~_1zleUhedYuT9=hZY_hQV)&YpN3lceN~~lDptv@CK!T;06EyMMkbr literal 0 HcmV?d00001 diff --git a/debian/mongodump.1 b/debian/mongodump.1 new file mode 100644 index 00000000000..5cb33ce9eb2 --- /dev/null +++ b/debian/mongodump.1 @@ -0,0 +1,36 @@ +.\" Documentation for the MongoDB dump tool +.TH MONGODUMP "1" "June 2009" "10gen" "Mongo Database" +.SH "NAME" +mongodump \- the Mongo dump tool +.SH "SYNOPSIS" +\fBmongodump [\fIOPTIONS\fR]\fR +.SH "DESCRIPTION" +.PP +\fBmongodump\fR +is a tool to output a binary representation of a database. It is mostly used for doing hot backups of a database. +.SH "OPTIONS" +.TP +.B \-\-help +show usage information +.TP +.B \-h, \-\-host HOST +server to connect to (default HOST=localhost) +.TP +.B \-d, \-\-db DATABASE +database to use +.TP +.B \-c, \-\-c COLLECTION +collection to use +.TP +.B \-o, \-\-out FILE +output file, if not specified, stdout is used +.TP +.B \-\-dbpath PATH +directly access mongod data files in this path, instead of connecting to a mongod instance +.SH "COPYRIGHT" +.PP +Copyright 2007\-2009 10gen +.SH "SEE ALSO" +For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. +.SH "AUTHOR" +Kristina Chodorow diff --git a/debian/mongoexport.1 b/debian/mongoexport.1 new file mode 100644 index 00000000000..1996b36f31d --- /dev/null +++ b/debian/mongoexport.1 @@ -0,0 +1,51 @@ +.\" Documentation for the MongoDB shell +.TH MONGOEXPORT "1" "June 2009" "10gen" "Mongo Database" +.SH "NAME" +mongoexport \- the Mongo export tool +.SH "SYNOPSIS" +\fBmongoexport [\fIOPTIONS\fR]\fR +.SH "DESCRIPTION" +.PP +\fBmongoexport\fR +is a tool to export a MongoDB collection to either JSON or CSV. The query can be filtered or a list of fields to output can be given. +.PP +If the output is CSV, the fields must be specified in order. +.SH "EXAMPLES" +.TP +.B mongoexport -d test -c test1 --csv -f "name,num" +export documents from test.test1 in CSV format +.SH "OPTIONS" +.TP +.B \-\-help +show usage information +.TP +.B \-h, \-\-host HOST +server to connect to (default HOST=localhost) +.TP +.B \-d, \-\-db DATABASE +database to use +.TP +.B \-c, \-\-c COLLECTION +collection to use +.TP +.B \-q, \-\-query QUERY +query filter +.TP +.B \-f, \-\-fields FIELDS +comma\-separated list of field names +.TP +.B \-\-csv +export to CSV instead of JSON +.TP +.B \-o, \-\-out FILE +output file, if not specified, stdout is used +.TP +.B \-\-dbpath PATH +directly access mongod data files in this path, instead of connecting to a mongod instance +.SH "COPYRIGHT" +.PP +Copyright 2007\-2009 10gen +.SH "SEE ALSO" +For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. +.SH "AUTHOR" +Kristina Chodorow diff --git a/debian/mongofiles.1 b/debian/mongofiles.1 new file mode 100644 index 00000000000..4d7c0c54aff --- /dev/null +++ b/debian/mongofiles.1 @@ -0,0 +1,52 @@ +.\" Documentation for the MongoDB dump tool +.TH MONGOFILES "1" "June 2009" "10gen" "Mongo Database" +.SH "NAME" +mongofiles \- a simple GridFS interface +.SH "SYNOPSIS" +\fBmongofiles [\fIOPTIONS\fR]\fR +.SH "DESCRIPTION" +.PP +\fBmongofiles\fR +is used to list, get, and insert files in the database. +.SH "EXAMPLES" +.TP +.B mongofiles list +lists files in test.fs.files +.TP +.B mongofiles put README.txt +inserts the file README.txt into the collection test.fs.files +.TP +.B mongofiles get photo.jpg +retrieves photo.jpg from test.fs.files and saves it locally +.SH "OPTIONS" +.TP +.B \-\-help +show usage information +.TP +.B \-h, \-\-host HOST +mongo host to which to connect +.TP +.B \-d, \-\-db DB +database to use (default DB=test) +.TP +.B \-c, \-\-collection COLLECTION (default COLLECTION=fs.files) +collection to use +.TP +.B \-\-command [list\||\|search\||\|put\||\|get] +execute a command +.TP +.B \-\-file FILE +filename for get or put +.TP +.B list +list all files. takes an optional filename. the file has to start with the filename +.TP +.B search +search all files for something that contains the string +.SH "COPYRIGHT" +.PP +Copyright 2007\-2009 10gen +.SH "SEE ALSO" +For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. +.SH "AUTHOR" +Kristina Chodorow diff --git a/debian/mongoimportjson.1 b/debian/mongoimportjson.1 new file mode 100644 index 00000000000..5f3f450693e --- /dev/null +++ b/debian/mongoimportjson.1 @@ -0,0 +1,45 @@ +.\" Documentation for the MongoDB shell +.TH MONGOIMPORTJSON "1" "June 2009" "10gen" "Mongo Database" +.SH "NAME" +mongoimportjson \- the Mongo import tool +.SH "SYNOPSIS" +\fBmongoimportjson [\fIOPTIONS\fR]\fR +.SH "DESCRIPTION" +.PP +\fBmongoimportjson\fR +is a tool to import JSON documents into MongoDB. This utility takes a single file that contains one JSON string per line and inserts it. A databaase and collection must be specified. +.SH "OPTIONS" +.TP +.B \-\-help +show usage information +.TP +.B \-h, \-\-host HOST +server to connect to (default HOST=localhost) +.TP +.B \-d, \-\-db DATABASE +database to use +.TP +.B \-c, \-\-c COLLECTION +collection to use +.TP +.B \-\-file FILE +file from which to import +.TP +.B \-\-dbpath PATH +directly access mongod data files in this path, instead of connecting to a mongod instance +.TP +.B \-\-idbefore +create id index before importing +.TP +.B \-\-id +create id index after importing (recommended) +.TP +.B \-\-drop +drop collection before importing +.SH "COPYRIGHT" +.PP +Copyright 2007\-2009 10gen +.SH "SEE ALSO" +For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. +.SH "AUTHOR" +Kristina Chodorow diff --git a/debian/mongorestore.1 b/debian/mongorestore.1 new file mode 100644 index 00000000000..5f207b0f893 --- /dev/null +++ b/debian/mongorestore.1 @@ -0,0 +1,36 @@ +.\" Documentation for the MongoDB dump tool +.TH MONGORESTORE "1" "June 2009" "10gen" "Mongo Database" +.SH "NAME" +mongorestore \- the Mongo restoration tool +.SH "SYNOPSIS" +\fBmongorestore [\fIOPTIONS\fR]\fR +.SH "DESCRIPTION" +.PP +\fBmongorestore\fR +is a tool to use the output from mongodump to restore a database. +.SH "OPTIONS" +.TP +.B \-\-help +show usage information +.TP +.B \-h, \-\-host HOST +server to connect to (default HOST=localhost) +.TP +.B \-d, \-\-db DATABASE +database to use +.TP +.B \-c, \-\-c COLLECTION +collection to use +.TP +.B \-\-dir PATH +directory from which to restore +.TP +.B \-\-dbpath PATH +directly access mongod data files in this path, instead of connecting to a mongod instance +.SH "COPYRIGHT" +.PP +Copyright 2007\-2009 10gen +.SH "SEE ALSO" +For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. +.SH "AUTHOR" +Kristina Chodorow diff --git a/debian/mongos.1 b/debian/mongos.1 new file mode 100644 index 00000000000..74d01c6862e --- /dev/null +++ b/debian/mongos.1 @@ -0,0 +1,39 @@ +.\" Documentation for the MongoDB dump tool +.TH MONGOS "1" "June 2009" "10gen" "Mongo Database" +.SH "NAME" +mongos \- the Mongo sharding server +.SH "SYNOPSIS" +\fBmongos [\fIOPTIONS\fR]\fR +.SH "DESCRIPTION" +.PP +\fBmongos\fR +is used to setup, configure, and get information about sharded databases. +.SH "EXAMPLES" +.PP +.B ./mongod --port 9999 --dbpath /data/db/a # first server +.PP +.B ./mongod --port 9998 --dbpath /data/db/b # second server +.PP +.B ./mongos --configdb localhost:9999 # mongos +.PP +starts three servers to set up sharding +.SH "OPTIONS" +.TP +.B \-\-help +show usage information +.TP +.B \-\-port N +port on which to listen +.TP +.B \-\-configdb DATABASE+ +one or more databases to use as the configuration databases +.TP +.B \-v+ +verbosity +.SH "COPYRIGHT" +.PP +Copyright 2007\-2009 10gen +.SH "SEE ALSO" +For more information, please refer to the MongoDB wiki, available at http://www.mongodb.org. +.SH "AUTHOR" +Kristina Chodorow From eb02ffe19b079db803825738e97e8f77987552d5 Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Mon, 1 Jun 2009 14:04:12 -0400 Subject: [PATCH 19/25] minor: towards being able to run tests on windows --- SConstruct | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 677ae44f910..6bc438784eb 100644 --- a/SConstruct +++ b/SConstruct @@ -858,9 +858,14 @@ 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", [ "mongo" ], runShellTest ) + 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" ) ] ) @@ -909,7 +914,7 @@ def stopMongodForTests(): kill( mongodForTests.pid, 15 ) mongodForTests.wait() -testEnv.Alias( "startMongod", ["mongod"], [startMongodForTests] ); +testEnv.Alias( "startMongod", [add_exe("mongod")], [startMongodForTests] ); testEnv.AlwaysBuild( "startMongod" ); testEnv.SideEffect( "dummySmokeSideEffect", "startMongod" ) From 48a68868f2f95fa44622d350f213c83ebbdc5eb7 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 14:17:44 -0400 Subject: [PATCH 20/25] better error message on dup key SERVER-81 added some const --- db/btree.cpp | 12 ++++++++++-- db/btree.h | 1 + db/namespace.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/db/btree.cpp b/db/btree.cpp index b47712dcda3..db1273717ed 100644 --- a/db/btree.cpp +++ b/db/btree.cpp @@ -313,6 +313,14 @@ namespace mongo { return false; } + string BtreeBucket::dupKeyError( const IndexDetails& idx , const BSONObj& key ){ + stringstream ss; + ss << "E11000 duplicate key error"; + ss << "index: " << idx.indexNamespace() << " "; + ss << "dup key: " << key; + return ss.str(); + } + /* Find a key withing this btree bucket. When duplicate keys are allowed, we use the DiskLoc of the record as if it were part of the @@ -357,11 +365,11 @@ namespace mongo { if( !dupsChecked ) { dupsChecked = true; if( idx.head.btree()->exists(idx, idx.head, key, order) ) - uasserted("E11000 duplicate key error"); + uasserted( dupKeyError( idx , key ) ); } } else - uasserted("E11000 duplicate key error"); + uasserted( dupKeyError( idx , key ) ); } // dup keys allowed. use recordLoc as if it is part of the key diff --git a/db/btree.h b/db/btree.h index 3fd624f6370..e4e8a76a1f9 100644 --- a/db/btree.h +++ b/db/btree.h @@ -203,6 +203,7 @@ namespace mongo { DiskLoc lChild, DiskLoc rChild, IndexDetails&); bool find(const IndexDetails& idx, const BSONObj& key, DiskLoc recordLoc, const BSONObj &order, int& pos, bool assertIfDup); static void findLargestKey(const DiskLoc& thisLoc, DiskLoc& largestLoc, int& largestKey); + string dupKeyError( const IndexDetails& idx , const BSONObj& key ); }; class BtreeCursor : public Cursor { diff --git a/db/namespace.h b/db/namespace.h index 55c4dcbcd38..4dd52fd79b2 100644 --- a/db/namespace.h +++ b/db/namespace.h @@ -164,7 +164,7 @@ namespace mongo { // returns name of this index's storage area // database.table.$index - string indexNamespace() { + string indexNamespace() const { BSONObj io = info.obj(); string s; s.reserve(Namespace::MaxNsLen); From 4a64d52c9cd9865e7efa1cb5b037438a695017fd Mon Sep 17 00:00:00 2001 From: Dwight Date: Mon, 1 Jun 2009 14:20:49 -0400 Subject: [PATCH 21/25] BUG SERVER-79 ports variable wasn't thread safe --- db/dbcommands.cpp | 2 +- debian/rules | 0 util/message.cpp | 30 +++++++++++++++++++++++++----- 3 files changed, 26 insertions(+), 6 deletions(-) mode change 100755 => 100644 debian/rules diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index 10b1b889945..3a9f07f0640 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -1054,7 +1054,7 @@ namespace mongo { returns true if ran a cmd */ bool _runCommands(const char *ns, BSONObj& _cmdobj, stringstream& ss, BufBuilder &b, BSONObjBuilder& anObjBuilder, bool fromRepl, int queryOptions) { - log(1) << "run command " << ns << ' ' << _cmdobj << endl; + log(1) << "run command " << ns << ' ' << _cmdobj << endl; const char *p = strchr(ns, '.'); if ( !p ) return false; diff --git a/debian/rules b/debian/rules old mode 100755 new mode 100644 diff --git a/util/message.cpp b/util/message.cpp index b8c88590477..533617cd6ff 100644 --- a/util/message.cpp +++ b/util/message.cpp @@ -142,13 +142,33 @@ namespace mongo { } } msgstart; -// we "new" this so it guaranteed to still be around when other automatic global vars -// are being destructed during termination. - set& ports = *(new set()); + class Ports { + set& ports; + boost::mutex& m; + public: + // we "new" this so it is still be around when other automatic global vars + // are being destructed during termination. + Ports() : ports( *(new set()) ), + m( *(new boost::mutex()) ) { } + void closeAll() { \ + boostlock bl(m); + for ( set::iterator i = ports.begin(); i != ports.end(); i++ ) + (*i)->shutdown(); + } + void insert(MessagingPort* p) { + boostlock bl(m); + ports.insert(p); + } + void erase(MessagingPort* p) { + boostlock bl(m); + ports.erase(p); + } + } ports; + + void closeAllSockets() { - for ( set::iterator i = ports.begin(); i != ports.end(); i++ ) - (*i)->shutdown(); + ports.closeAll(); } MessagingPort::MessagingPort(int _sock, SockAddr& _far) : sock(_sock), piggyBackData(0), farEnd(_far) { From 5fbb421a82717906edb344cbc6438f634de60db4 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 14:50:59 -0400 Subject: [PATCH 22/25] fix gc issue with long running $where SERVER-86 --- scripting/engine_spidermonkey.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index 356636cf761..5184f526efb 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -259,6 +259,14 @@ namespace mongo { } JSFunction * compileFunction( const char * code, JSObject * assoc = 0 ){ + JSFunction * f = _compileFunction( code , assoc ); + if ( f ){ + JS_AddRoot( _context , f ); + } + return f; + } + + JSFunction * _compileFunction( const char * code, JSObject * assoc ){ if ( ! hasFunctionIdentifier( code ) ){ string s = code; if ( isSimpleStatement( s ) ){ @@ -625,7 +633,7 @@ namespace mongo { holder->check(); string s = c.toString( id ); - + BSONElement e = holder->_obj[ s.c_str() ]; if ( e.type() == EOO ){ From 3ef3489ad56aae6efc99f2a7ac7187609a3516e5 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 16:09:16 -0400 Subject: [PATCH 23/25] don't strip on mac --- SConstruct | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 6bc438784eb..647e6f24e4f 100644 --- a/SConstruct +++ b/SConstruct @@ -162,6 +162,7 @@ linux64 = False darwin = False windows = False freebsd = False +solaris = False force64 = not GetOption( "force64" ) is None force32 = not GetOption( "force32" ) is None release = not GetOption( "release" ) is None @@ -312,6 +313,7 @@ elif "linux2" == os.sys.platform: elif "sunos5" == os.sys.platform: nix = True + solaris = True useJavaHome = True javaHome = "/usr/lib/jvm/java-6-sun/" javaOS = "solaris" @@ -1075,7 +1077,7 @@ def installBinary( e , name ): inst = e.Install( installDir + "/bin" , name ) allBinaries += [ name ] - if nix: + if linux or solaris: e.AddPostAction( inst, e.Action( 'strip ' + installDir + "/bin/" + name ) ) installBinary( env , "mongodump" ) From dbff105e9925cfeae712209381128c462cfe8ae6 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 16:47:43 -0400 Subject: [PATCH 24/25] fix "show users" in shell SERVER-87 --- shell/utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/utils.js b/shell/utils.js index eb31d7058a7..edf395d3146 100644 --- a/shell/utils.js +++ b/shell/utils.js @@ -329,8 +329,10 @@ shellHelper.show = function( what ){ return ""; } - if ( what == "users" ) - return db.system.users.find(); + if ( what == "users" ){ + db.system.users.find().forEach( printjson ); + return ""; + } if ( what == "collections" || what == "tables" ) { db.getCollectionNames().forEach( function(x){print(x)} ); From 0a4fb84bad5178b9318102fa9bf09abbedb12095 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 1 Jun 2009 17:28:13 -0400 Subject: [PATCH 25/25] test that already passes MINOR --- jstests/jni5.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 jstests/jni5.js diff --git a/jstests/jni5.js b/jstests/jni5.js new file mode 100644 index 00000000000..c6e6b54c72b --- /dev/null +++ b/jstests/jni5.js @@ -0,0 +1,10 @@ + +t = db.jni5 +t.drop(); + +t.save( { a : 1 } ) +t.save( { a : 2 } ) + +assert.eq( 2 , t.find( { "$where" : "this.a" } ).count() , "A" ); +assert.eq( 0 , t.find( { "$where" : "this.b" } ).count() , "B" ); +assert.eq( 0 , t.find( { "$where" : "this.b > 45" } ).count() , "C" );