Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

supress sharded sub-connection warning for getLastError()

  • Loading branch information...
commit 1b048c3a01aaaca98dbc2625920a52f39245d987 1 parent 3337ab4
gregs authored
Showing with 16 additions and 16 deletions.
  1. +2 −2 s/client.cpp
  2. +4 −4 s/shard.h
  3. +10 −10 s/shardconnection.cpp
View
4 s/client.cpp
@@ -141,7 +141,7 @@ namespace mongo {
if ( shards->size() == 1 ) {
string theShard = *(shards->begin() );
- ShardConnection conn( theShard , "" );
+ ShardConnection conn( theShard , "", true );
BSONObj res;
bool ok = false;
@@ -211,7 +211,7 @@ namespace mongo {
for ( set<string>::iterator i = shards->begin(); i != shards->end(); i++ ) {
string theShard = *i;
bbb.append( theShard );
- ShardConnection conn( theShard , "" );
+ ShardConnection conn( theShard , "", true );
BSONObj res;
bool ok = false;
try {
View
8 s/shard.h
@@ -213,9 +213,9 @@ namespace mongo {
class ShardConnection : public AScopedConnection {
public:
- ShardConnection( const Shard * s , const string& ns );
- ShardConnection( const Shard& s , const string& ns );
- ShardConnection( const string& addr , const string& ns );
+ ShardConnection( const Shard * s , const string& ns, bool ignoreDirect = false );
+ ShardConnection( const Shard& s , const string& ns, bool ignoreDirect = false );
+ ShardConnection( const string& addr , const string& ns, bool ignoreDirect = false );
~ShardConnection();
@@ -265,7 +265,7 @@ namespace mongo {
static void checkMyConnectionVersions( const string & ns );
private:
- void _init();
+ void _init( bool ignoreDirect = false );
void _finishInit();
bool _finishedInit;
View
20 s/shardconnection.cpp
@@ -79,12 +79,12 @@ namespace mongo {
_hosts.clear();
}
- DBClientBase * get( const string& addr , const string& ns ) {
+ DBClientBase * get( const string& addr , const string& ns, bool ignoreDirect = false ) {
_check( ns );
// Determine if non-shard conn is RS member for warning
// All shards added to _hosts if not present in _check()
- if( ( logLevel >= 1 || ! printedShardConnWarning ) && _hosts.find( addr ) == _hosts.end() ){
+ if( ( logLevel >= 1 || ! printedShardConnWarning ) && ! ignoreDirect && _hosts.find( addr ) == _hosts.end() ){
vector<Shard> all;
Shard::getAllShards( all );
@@ -221,24 +221,24 @@ namespace mongo {
thread_specific_ptr<ClientConnections> ClientConnections::_perThread;
- ShardConnection::ShardConnection( const Shard * s , const string& ns )
+ ShardConnection::ShardConnection( const Shard * s , const string& ns, bool ignoreDirect )
: _addr( s->getConnString() ) , _ns( ns ) {
- _init();
+ _init( ignoreDirect );
}
- ShardConnection::ShardConnection( const Shard& s , const string& ns )
+ ShardConnection::ShardConnection( const Shard& s , const string& ns, bool ignoreDirect )
: _addr( s.getConnString() ) , _ns( ns ) {
- _init();
+ _init( ignoreDirect );
}
- ShardConnection::ShardConnection( const string& addr , const string& ns )
+ ShardConnection::ShardConnection( const string& addr , const string& ns, bool ignoreDirect )
: _addr( addr ) , _ns( ns ) {
- _init();
+ _init( ignoreDirect );
}
- void ShardConnection::_init() {
+ void ShardConnection::_init( bool ignoreDirect ) {
assert( _addr.size() );
- _conn = ClientConnections::threadInstance()->get( _addr , _ns );
+ _conn = ClientConnections::threadInstance()->get( _addr , _ns, ignoreDirect );
_finishedInit = false;
}
Please sign in to comment.
Something went wrong with that request. Please try again.