Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/mongo/s/shard.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ namespace mongo {
// Controls whether we throw on initially failing to set a version
static bool ignoreInitialVersionFailure;

// Use for settings timeout for connections between mongos and mongod
static double shardConnectionTimeout;

/** checks all of my thread local connections for the version of this ns */
static void checkMyConnectionVersions( const string & ns );

Expand Down
13 changes: 11 additions & 2 deletions src/mongo/s/shardconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,22 @@
namespace mongo {

bool ShardConnection::ignoreInitialVersionFailure( false );
double ShardConnection::shardConnectionTimeout(1.0);

ExportedServerParameter<bool>
_ignoreInitialVersionFailure( ServerParameterSet::getGlobal(),
"ignoreInitialVersionFailure",
&ShardConnection::ignoreInitialVersionFailure,
true,
true );

ExportedServerParameter<double>
_shardConnectionTimeout( ServerParameterSet::getGlobal(),
"shardConnectionTimeout",
&ShardConnection::shardConnectionTimeout,
true,
true );

DBConnectionPool shardConnectionPool;

class ClientConnections;
Expand Down Expand Up @@ -171,7 +180,7 @@ namespace mongo {
s->avail = 0;
shardConnectionPool.onHandedOut( c.get() ); // May throw an exception
} else {
c.reset( shardConnectionPool.get( addr ) );
c.reset( shardConnectionPool.get( addr, ShardConnection::shardConnectionTimeout ) );
s->created++; // After, so failed creation doesn't get counted
}
return c.release();
Expand Down Expand Up @@ -249,7 +258,7 @@ namespace mongo {
Status* s = _getStatus( sconnString );

if( ! s->avail ) {
s->avail = shardConnectionPool.get( sconnString );
s->avail = shardConnectionPool.get( sconnString, ShardConnection::shardConnectionTimeout );
s->created++; // After, so failed creation doesn't get counted
}

Expand Down