diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-08-03 18:12:04 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-08-03 18:12:04 -0400 |
commit | c1a0ce0228d75d62a10eeab6aa8aa0ee65b64958 (patch) | |
tree | 539096c537f360d5350f41e7221dab4f49a2ca8d /s/shard.cpp | |
parent | 9078eba70f6e459c960a2c6b7c988a83947c2506 (diff) | |
download | mongo-c1a0ce0228d75d62a10eeab6aa8aa0ee65b64958.tar.gz |
check all shard connections at once so we don't get cascading failure SERVER-1560
Diffstat (limited to 's/shard.cpp')
-rw-r--r-- | s/shard.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/s/shard.cpp b/s/shard.cpp index 4ef68c0103c..8ef21a0f798 100644 --- a/s/shard.cpp +++ b/s/shard.cpp @@ -98,7 +98,6 @@ namespace mongo { reload(); scoped_lock lk( _mutex ); - map<string,Shard>::iterator i = _lookup.find( ident ); uassert( 13129 , (string)"can't find shard for: " + ident , i != _lookup.end() ); return i->second; @@ -164,6 +163,17 @@ namespace mongo { staticShardInfo.getAllShards( all ); } + bool Shard::isAShard( const string& ident ){ + return staticShardInfo.isMember( ident ); + } + + void Shard::printShardInfo( ostream& out ){ + vector<Shard> all; + getAllShards( all ); + for ( unsigned i=0; i<all.size(); i++ ) + out << all[i].toString() << "\n"; + out.flush(); + } BSONObj Shard::runCommand( const string& db , const BSONObj& cmd ) const { ScopedDbConnection conn( this ); |