summaryrefslogtreecommitdiff
path: root/s/shard.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-08-03 18:12:04 -0400
committerEliot Horowitz <eliot@10gen.com>2010-08-03 18:12:04 -0400
commitc1a0ce0228d75d62a10eeab6aa8aa0ee65b64958 (patch)
tree539096c537f360d5350f41e7221dab4f49a2ca8d /s/shard.cpp
parent9078eba70f6e459c960a2c6b7c988a83947c2506 (diff)
downloadmongo-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.cpp12
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 );