Permalink
Browse files

don't hide first connection warning for shards

  • Loading branch information...
1 parent 930611d commit c40ec7638318696be5eaa07f83a859af2b76ff66 gregs committed Jun 30, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 s/shardconnection.cpp
View
@@ -41,6 +41,9 @@ namespace mongo {
boost::function4<bool, DBClientBase&, const string&, bool, int> checkShardVersionCB = defaultCheckShardVersion;
boost::function1<void, DBClientBase*> resetShardVersionCB = defaultResetShardVersion;
+ // Only print the non-top-level-shard-conn warning once if not verbose
+ volatile bool printedShardConnWarning = false;
+
/**
* holds all the actual db connections for a client to various servers
* 1 pre thread, so don't have to worry about thread safety
@@ -81,7 +84,7 @@ namespace mongo {
// Determine if non-shard conn is RS member for warning
// All shards added to _hosts if not present in _check()
- if( logLevel >= 1 && _hosts.find( addr ) == _hosts.end() ){
+ if( ( logLevel >= 1 || ! printedShardConnWarning ) && _hosts.find( addr ) == _hosts.end() ){
vector<Shard> all;
Shard::getAllShards( all );
@@ -98,6 +101,7 @@ namespace mongo {
}
if( isRSMember ){
+ printedShardConnWarning = true;
warning() << "adding shard sub-connection " << addr << " (parent " << parentShard << ") as sharded, this is safe but unexpected" << endl;
printStackTrace();
}

0 comments on commit c40ec76

Please sign in to comment.