diff options
author | Dwight <dwight@10gen.com> | 2010-08-03 13:02:14 -0400 |
---|---|---|
committer | Dwight <dwight@10gen.com> | 2010-08-03 13:02:14 -0400 |
commit | e8898377a92c44b6d248d921d2e3e221c84cd1c2 (patch) | |
tree | b24a1e883625bf85af292d3b87a7b1823ca398ce | |
parent | ccb1bee3d9325562e95cd3a747460858898db17d (diff) | |
parent | f35d46318b2dc91e38a3c566f89e382f6c03b2c9 (diff) | |
download | mongo-e8898377a92c44b6d248d921d2e3e221c84cd1c2.tar.gz |
Merge branch 'master' of github.com:mongodb/mongo
-rw-r--r-- | db/lasterror.h | 5 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | doxygenConfig | 2 | ||||
-rw-r--r-- | jstests/slowNightly/sharding_rs1.js | 61 | ||||
-rw-r--r-- | rpm/mongo.spec | 2 | ||||
-rw-r--r-- | s/server.cpp | 3 | ||||
-rw-r--r-- | shell/servers.js | 68 | ||||
-rw-r--r-- | util/version.cpp | 2 |
8 files changed, 132 insertions, 17 deletions
diff --git a/db/lasterror.h b/db/lasterror.h index 03ea6fcd4f4..5900208b6c7 100644 --- a/db/lasterror.h +++ b/db/lasterror.h @@ -102,7 +102,10 @@ namespace mongo { LastError * get( bool create = false ); LastError * getSafe(){ LastError * le = get(false); - assert( le ); + if ( ! le ){ + log( LL_ERROR ) << " no LastError! id: " << getID() << endl; + assert( le ); + } return le; } diff --git a/debian/changelog b/debian/changelog index 6883e69e852..8919ca923b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +mongodb (1.5.8) unstable; urgency=low + + * sharding lots of changes + * replica_sets lots of changes + + mongodb (1.5.7) unstable; urgency=low * sharding lots of changes diff --git a/doxygenConfig b/doxygenConfig index 04fa009a99c..93db1315f77 100644 --- a/doxygenConfig +++ b/doxygenConfig @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = MongoDB -PROJECT_NUMBER = 1.5.7 +PROJECT_NUMBER = 1.5.8 OUTPUT_DIRECTORY = docs/doxygen CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English diff --git a/jstests/slowNightly/sharding_rs1.js b/jstests/slowNightly/sharding_rs1.js new file mode 100644 index 00000000000..3769e32f432 --- /dev/null +++ b/jstests/slowNightly/sharding_rs1.js @@ -0,0 +1,61 @@ +// tests sharding with replica sets + +s = new ShardingTest( "rs1" , 3 , 1 , 2 , { rs : true , chunksize : 1 } ) + +s.adminCommand( { enablesharding : "test" } ); + +s.config.settings.find().forEach( printjson ) + +db = s.getDB( "test" ); + +bigString = "" +while ( bigString.length < 10000 ) + bigString += "asdasdasdasdadasdasdasdasdasdasdasdasda"; + +inserted = 0; +num = 0; +while ( inserted < ( 20 * 1024 * 1024 ) ){ + db.foo.insert( { _id : num++ , s : bigString } ); + inserted += bigString.length; +} + +db.getLastError(); +s.adminCommand( { shardcollection : "test.foo" , key : { _id : 1 } } ); +assert.lt( 20 , s.config.chunks.count() , "setup2" ); + +function diff(){ + var x = s.chunkCounts( "foo" ); + var total = 0; + var min = 1000000000; + var max = 0; + for ( var sn in x ){ + total += x[sn]; + if ( x[sn] < min ) + min = x[sn]; + if ( x[sn] > max ) + max = x[sn]; + } + + print( tojson(x) + " total: " + total + " min: " + min + " max: " + max ) + return max - min; +} + +assert.lt( 20 , diff() , "big differential here" ); +print( diff() ) + +assert.soon( function(){ + var d = diff(); + return d < 5; +} , "balance didn't happen" , 1000 * 60 * 3 , 5000 ); + + +for ( i=0; i<s._rs.length; i++ ){ + r = s._rs[i]; + r.test.awaitReplication(); + x = r.test.getHashes( "test" ); + print( r.url + "\t" + tojson( x ) ) + for ( j=0; j<x.slaves.length; j++ ) + assert.eq( x.master.md5 , x.slaves[j].md5 , "hashes same for: " + r.url + " slave: " + j ); +} + +s.stop() diff --git a/rpm/mongo.spec b/rpm/mongo.spec index a2884715db9..fc37058f045 100644 --- a/rpm/mongo.spec +++ b/rpm/mongo.spec @@ -1,5 +1,5 @@ Name: mongo -Version: 1.5.7 +Version: 1.5.8 Release: mongodb_1%{?dist} Summary: mongo client shell and tools License: AGPL 3.0 diff --git a/s/server.cpp b/s/server.cpp index 75c6c782bd8..5c6ac9bf9ab 100644 --- a/s/server.cpp +++ b/s/server.cpp @@ -64,7 +64,8 @@ namespace mongo { class ShardingConnectionHook : public DBConnectionHook { public: virtual void onCreate( DBClientBase * conn ){ - conn->simpleCommand( "admin" , 0 , "switchtoclienterrors" ); + if ( conn->type() != ConnectionString::SYNC ) + conn->simpleCommand( "admin" , 0 , "switchtoclienterrors" ); } virtual void onHandedOut( DBClientBase * conn ){ ClientInfo::get()->addShard( conn->getServerAddress() ); diff --git a/shell/servers.js b/shell/servers.js index c36fba4bba9..03e7304c8cd 100644 --- a/shell/servers.js +++ b/shell/servers.js @@ -155,27 +155,54 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other if ( otherParams.sync && numShards < 3 ) throw "if you want sync, you need at least 3 servers"; - for ( var i=0; i<numShards; i++){ - var conn = startMongodTest( 30000 + i , testName + i ); - this._connections.push( conn ); - } - - if ( otherParams.sync ){ - this._configDB = "localhost:30000,localhost:30001,localhost:30002"; + var localhost = "localhost"; + + if ( otherParams.rs ){ + localhost = getHostName(); + // start replica sets + this._rs = [] + for ( var i=0; i<numShards; i++){ + var rs = new ReplSetTest( { name : testName + "-rs" + i , nodes : 3 , startPort : 31100 + ( i * 100 ) } ); + this._rs[i] = { test : rs , nodes : rs.startSet( { oplogSize:40 } ) , url : rs.getURL() }; + rs.initiate(); + rs.getMaster().getDB( "admin" ).foo.save( { x : 1 } ) + rs.awaitReplication(); + this._connections.push( new Mongo( rs.getURL() ) ); + } + + this._configServers = [] + for ( var i=0; i<3; i++ ){ + var conn = startMongodTest( 30000 + i , testName + "-config" + i ); + this._configServers.push( conn ); + } + + this._configDB = localhost + ":30000," + localhost + ":30001," + localhost + ":30002"; this._configConnection = new Mongo( this._configDB ); this._configConnection.getDB( "config" ).settings.insert( { _id : "chunksize" , value : otherParams.chunksize || 50 } ); } else { - this._configDB = "localhost:30000"; - this._connections[0].getDB( "config" ).settings.insert( { _id : "chunksize" , value : otherParams.chunksize || 50 } ); + for ( var i=0; i<numShards; i++){ + var conn = startMongodTest( 30000 + i , testName + i ); + this._connections.push( conn ); + } + + if ( otherParams.sync ){ + this._configDB = "localhost:30000,localhost:30001,localhost:30002"; + this._configConnection = new Mongo( this._configDB ); + this._configConnection.getDB( "config" ).settings.insert( { _id : "chunksize" , value : otherParams.chunksize || 50 } ); + } + else { + this._configDB = "localhost:30000"; + this._connections[0].getDB( "config" ).settings.insert( { _id : "chunksize" , value : otherParams.chunksize || 50 } ); + } } - + this._mongos = []; var startMongosPort = 31000; for ( var i=0; i<(numMongos||1); i++ ){ var myPort = startMongosPort - i; var conn = startMongos( { port : startMongosPort - i , v : verboseLevel || 0 , configdb : this._configDB } ); - conn.name = "localhost:" + myPort; + conn.name = localhost + ":" + myPort; this._mongos.push( conn ); if ( i == 0 ) this.s = conn; @@ -187,7 +214,11 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other if ( ! otherParams.manualAddShard ){ this._connections.forEach( function(z){ - admin.runCommand( { addshard : z.name } ); + var n = z.name; + if ( ! n ) + n = z; + print( "going to add shard: " + n ) + admin.runCommand( { addshard : n } ); } ); } @@ -276,6 +307,11 @@ ShardingTest.prototype.stop = function(){ for ( var i=0; i<this._connections.length; i++){ stopMongod( 30000 + i ); } + if ( this._rs ){ + for ( var i=0; i<this._rs.length; i++ ){ + this._rs[i].test.stopSet( 15 ); + } + } print('*** ' + this._testName + " completed successfully ***"); } @@ -1237,6 +1273,14 @@ ReplSetTest.prototype.awaitReplication = function() { }); } +ReplSetTest.prototype.getHashes = function( db ){ + this.getMaster(); + var res = {}; + res.master = this.liveNodes.master.getDB( db ).runCommand( "dbhash" ) + res.slaves = this.liveNodes.slaves.map( function(z){ return z.getDB( db ).runCommand( "dbhash" ); } ) + return res; +} + /** * Starts up a server. * diff --git a/util/version.cpp b/util/version.cpp index 780334cfb5e..800b8ff554e 100644 --- a/util/version.cpp +++ b/util/version.cpp @@ -14,7 +14,7 @@ namespace mongo { // mongo processes version support // - const char versionString[] = "1.5.8-pre-"; + const char versionString[] = "1.5.8"; string mongodVersion() { stringstream ss; |