diff options
author | Greg Studer <greg@10gen.com> | 2012-10-19 16:24:41 -0400 |
---|---|---|
committer | Greg Studer <greg@10gen.com> | 2012-10-19 16:25:35 -0400 |
commit | 3cbe374586919e5d09cec7ee19301b085401d51c (patch) | |
tree | 247354a793c9afc75e9722430a153be916022fe3 | |
parent | fd3f282059ab92907f22038914f034fffcf83dbb (diff) | |
download | mongo-3cbe374586919e5d09cec7ee19301b085401d51c.tar.gz |
buildbot sharding_balance4.js explicitly report chunk manager sequence number when available in setShardVersion
-rw-r--r-- | src/mongo/s/chunk.cpp | 26 | ||||
-rw-r--r-- | src/mongo/s/chunk.h | 7 | ||||
-rw-r--r-- | src/mongo/s/shard_version.cpp | 2 |
3 files changed, 30 insertions, 5 deletions
diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp index d1fd4b7899d..c53fc411037 100644 --- a/src/mongo/s/chunk.cpp +++ b/src/mongo/s/chunk.cpp @@ -1253,8 +1253,15 @@ namespace mongo { // we need a special command for dropping on the d side // this hack works for the moment - if ( ! setShardVersion( conn->conn(), _ns, ShardChunkVersion( 0, OID() ), true, res ) ) + if ( ! setShardVersion( conn->conn(), + _ns, + ShardChunkVersion( 0, OID() ), + ChunkManagerPtr(), + true, res ) ) + { throw UserException( 8071 , str::stream() << "cleaning up after drop failed: " << res ); + } + conn->get()->simpleCommand( "admin", 0, "unsetSharding" ); conn->done(); } @@ -1417,7 +1424,13 @@ namespace mongo { // NOTE (careful when deprecating) // currently the sharding is enabled because of a write or read (as opposed to a split or migrate), the shard learns // its name and through the 'setShardVersion' command call - bool setShardVersion( DBClientBase & conn , const string& ns , ShardChunkVersion version , bool authoritative , BSONObj& result ) { + bool setShardVersion( DBClientBase & conn, + const string& ns, + ShardChunkVersion version, + ChunkManagerPtr manager, // Used only for reporting! + bool authoritative , + BSONObj& result ) + { BSONObjBuilder cmdBuilder; cmdBuilder.append( "setShardVersion" , ns.c_str() ); cmdBuilder.append( "configdb" , configServer.modelServer() ); @@ -1431,7 +1444,14 @@ namespace mongo { cmdBuilder.append( "shardHost" , s.getConnString() ); BSONObj cmd = cmdBuilder.obj(); - LOG(1) << " setShardVersion " << s.getName() << " " << conn.getServerAddress() << " " << ns << " " << cmd << " " << &conn << endl; + LOG(1) << " setShardVersion " << s.getName() + << " " << conn.getServerAddress() + << " " << ns + << " " << cmd + << " " << &conn + << (manager.get() ? string(str::stream() << " " << manager->getSequenceNumber()) : + "") + << endl; return conn.runCommand( "admin", cmd, diff --git a/src/mongo/s/chunk.h b/src/mongo/s/chunk.h index 200db636964..a56232d27db 100644 --- a/src/mongo/s/chunk.h +++ b/src/mongo/s/chunk.h @@ -555,6 +555,11 @@ namespace mongo { */ inline string Chunk::genID() const { return genID(_manager->getns(), _min); } - bool setShardVersion( DBClientBase & conn , const string& ns , ShardChunkVersion version , bool authoritative , BSONObj& result ); + bool setShardVersion( DBClientBase & conn, + const string& ns, + ShardChunkVersion version, + ChunkManagerPtr manager, + bool authoritative, + BSONObj& result ); } // namespace mongo diff --git a/src/mongo/s/shard_version.cpp b/src/mongo/s/shard_version.cpp index ee959795027..8356c1bae87 100644 --- a/src/mongo/s/shard_version.cpp +++ b/src/mongo/s/shard_version.cpp @@ -235,7 +235,7 @@ namespace mongo { const string versionableServerAddress(conn->getServerAddress()); BSONObj result; - if ( setShardVersion( *conn , ns , version , authoritative , result ) ) { + if ( setShardVersion( *conn , ns , version , manager , authoritative , result ) ) { // success! LOG(1) << " setShardVersion success: " << result << endl; connectionShardStatus.setSequence( conn , ns , officialSequenceNumber ); |