summaryrefslogtreecommitdiff
path: root/src/mongo/s/client
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-05-27 12:31:55 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-05-29 07:37:25 -0400
commit1f4188fbdc733aa1cb08403d75f13a04d2279817 (patch)
tree5dda0598a438141b8d8808c9b3b724f1f00f3920 /src/mongo/s/client
parent57e5a2ee48e68d3fedab2d2942ae1b00ad651205 (diff)
downloadmongo-1f4188fbdc733aa1cb08403d75f13a04d2279817.tar.gz
SERVER-18438 Remove unused sharding code
* Unnecessary const fields in the chunk manager * Unused methods from the shard registry No functional changes.
Diffstat (limited to 'src/mongo/s/client')
-rw-r--r--src/mongo/s/client/multi_host_query_test.cpp4
-rw-r--r--src/mongo/s/client/shard_registry.cpp44
-rw-r--r--src/mongo/s/client/shard_registry.h4
3 files changed, 3 insertions, 49 deletions
diff --git a/src/mongo/s/client/multi_host_query_test.cpp b/src/mongo/s/client/multi_host_query_test.cpp
index 3a684d30597..4b694fb2796 100644
--- a/src/mongo/s/client/multi_host_query_test.cpp
+++ b/src/mongo/s/client/multi_host_query_test.cpp
@@ -627,7 +627,6 @@ namespace {
}
TEST(MultiHostQueryOp, ThreeHostsOneHang) {
-
// Initialize notifier before the thread pool
Notification unhangNotify;
@@ -637,6 +636,7 @@ namespace {
ConnectionString hostA = uassertStatusOK(ConnectionString::parse("$hostA:1000"));
ConnectionString hostB = uassertStatusOK(ConnectionString::parse("$hostB:1000"));
ConnectionString hostC = uassertStatusOK(ConnectionString::parse("$hostC:1000"));
+
vector<ConnectionString> hosts;
hosts.push_back(hostA);
hosts.push_back(hostB);
@@ -651,12 +651,14 @@ namespace {
QuerySpec query;
StatusWith<DBClientCursor*> result = queryOp.queryAny(hosts, query, 4000);
+
// Unhang before checking status, in case it throws
unhangNotify.notifyOne();
ASSERT_OK(result.getStatus());
ASSERT(NULL != result.getValue());
ASSERT_EQUALS(result.getValue()->originalHost(), hostC.toString());
+
delete result.getValue();
}
diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp
index d9c145fe4ce..ef00a1bb4fa 100644
--- a/src/mongo/s/client/shard_registry.cpp
+++ b/src/mongo/s/client/shard_registry.cpp
@@ -131,35 +131,6 @@ namespace mongo {
return _findUsingLookUp(shardName);
}
- shared_ptr<Shard> ShardRegistry::find(const string& ident) {
- string errmsg;
- ConnectionString connStr = ConnectionString::parse(ident, errmsg);
- uassert(18642,
- str::stream() << "Error parsing connection string: " << ident,
- errmsg.empty());
-
- if (connStr.type() == ConnectionString::SET) {
- boost::lock_guard<boost::mutex> lk(_rsMutex);
- ShardMap::iterator iter = _rsLookup.find(connStr.getSetName());
-
- if (iter == _rsLookup.end()) {
- return nullptr;
- }
-
- return iter->second;
- }
- else {
- boost::lock_guard<boost::mutex> lk(_mutex);
- ShardMap::iterator iter = _lookup.find(ident);
-
- if (iter == _lookup.end()) {
- return nullptr;
- }
-
- return iter->second;
- }
- }
-
Shard ShardRegistry::lookupRSName(const string& name) {
boost::lock_guard<boost::mutex> lk(_rsMutex);
ShardMap::iterator i = _rsLookup.find(name);
@@ -252,21 +223,6 @@ namespace mongo {
result->append("map", b.obj());
}
- shared_ptr<Shard> ShardRegistry::_findWithRetry(const string& ident) {
- shared_ptr<Shard> shard(find(ident));
- if (shard != nullptr) {
- return shard;
- }
-
- // Not in our maps, re-load all
- reload();
-
- shard = find(ident);
- massert(13129, str::stream() << "can't find shard for: " << ident, shard != NULL);
-
- return shard;
- }
-
shared_ptr<Shard> ShardRegistry::_findUsingLookUp(const string& shardName) {
boost::lock_guard<boost::mutex> lk(_mutex);
ShardMap::iterator it = _lookup.find(shardName);
diff --git a/src/mongo/s/client/shard_registry.h b/src/mongo/s/client/shard_registry.h
index 0235322e2c2..6b7cf4bb58c 100644
--- a/src/mongo/s/client/shard_registry.h
+++ b/src/mongo/s/client/shard_registry.h
@@ -51,7 +51,6 @@ namespace mongo {
void reload();
boost::shared_ptr<Shard> findIfExists(const std::string& shardName);
- boost::shared_ptr<Shard> find(const std::string& ident);
/**
* Lookup shard by replica set name. Returns Shard::EMTPY if the name can't be found.
@@ -70,13 +69,10 @@ namespace mongo {
void toBSON(BSONObjBuilder* result) const;
-
private:
typedef std::map<std::string, boost::shared_ptr<Shard>> ShardMap;
- boost::shared_ptr<Shard> _findWithRetry(const std::string& ident);
-
boost::shared_ptr<Shard> _findUsingLookUp(const std::string& shardName);