diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-05-19 14:22:20 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-05-19 14:23:06 -0400 |
commit | 0b689c83e8a8555d2167ef0337982008ff698c14 (patch) | |
tree | 49aef5a03c71135931acbaa5d455b093bec3b8e9 /s | |
parent | 8d009017c96b68241a405da7a5ff2b4593278386 (diff) | |
download | mongo-0b689c83e8a8555d2167ef0337982008ff698c14.tar.gz |
don't unset sharding state when a shard connection is done
more prep for SERVER-1714
Diffstat (limited to 's')
-rw-r--r-- | s/server.cpp | 4 | ||||
-rw-r--r-- | s/shard_version.h | 1 | ||||
-rw-r--r-- | s/shardconnection.cpp | 26 |
3 files changed, 9 insertions, 22 deletions
diff --git a/s/server.cpp b/s/server.cpp index ce7e5990268..18edb93b090 100644 --- a/s/server.cpp +++ b/s/server.cpp @@ -72,6 +72,10 @@ namespace mongo { virtual void onHandedOut( DBClientBase * conn ) { ClientInfo::get()->addShard( conn->getServerAddress() ); } + + virtual void onDestory( DBClientBase * conn ) { + resetShardVersionCB( conn ); + } }; class ShardedMessageHandler : public MessageHandler { diff --git a/s/shard_version.h b/s/shard_version.h index 023b7fc47a6..98cacf67af2 100644 --- a/s/shard_version.h +++ b/s/shard_version.h @@ -28,4 +28,5 @@ namespace mongo { */ void installChunkShardVersioning(); + } // namespace mongo diff --git a/s/shardconnection.cpp b/s/shardconnection.cpp index c404fcde1d2..72b2ec6d491 100644 --- a/s/shardconnection.cpp +++ b/s/shardconnection.cpp @@ -67,8 +67,10 @@ namespace mongo { if ( ss->avail ) { /* if we're shutting down, don't want to initiate release mechanism as it is slow, and isn't needed since all connections will be closed anyway */ - if ( inShutdown() ) + if ( inShutdown() ) { + resetShardVersionCB( ss->avail ); delete ss->avail; + } else release( addr , ss->avail ); ss->avail = 0; @@ -137,27 +139,7 @@ namespace mongo { } void release( const string& addr , DBClientBase * conn ) { - resetShardVersionCB( conn ); - BSONObj res; - - try { - if ( conn->simpleCommand( "admin" , &res , "unsetSharding" ) ) { - shardConnectionPool.release( addr , conn ); - } - else { - error() << "unset sharding failed : " << res << endl; - delete conn; - } - } - catch ( SocketException& e ) { - // server down or something - LOG(1) << "socket exception trying to unset sharding: " << e.toString() << endl; - delete conn; - } - catch ( std::exception& e ) { - error() << "couldn't unset sharding : " << e.what() << endl; - delete conn; - } + shardConnectionPool.release( addr , conn ); } void _check( const string& ns ) { |