Permalink
Browse files

don't unset sharding state when a shard connection is done

more prep for SERVER-1714
  • Loading branch information...
1 parent 8d00901 commit 0b689c83e8a8555d2167ef0337982008ff698c14 @erh erh committed May 19, 2011
Showing with 9 additions and 22 deletions.
  1. +4 −0 s/server.cpp
  2. +1 −0 s/shard_version.h
  3. +4 −22 s/shardconnection.cpp
View
@@ -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 {
View
@@ -28,4 +28,5 @@ namespace mongo {
*/
void installChunkShardVersioning();
+
} // namespace mongo
View
@@ -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 ) {

0 comments on commit 0b689c8

Please sign in to comment.