summaryrefslogtreecommitdiff
path: root/src/mongo/s/config.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-12-27 14:21:57 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-12-28 10:06:00 -0500
commitefb9ace86bac133fb9f9c17fbb598a45871206ea (patch)
treecac6f781d3cfd8e9f03cb23287aefc418425525d /src/mongo/s/config.cpp
parent651bc712c372e619513f1cc9564a38bf5b665237 (diff)
downloadmongo-efb9ace86bac133fb9f9c17fbb598a45871206ea.tar.gz
SERVER-27526 Remove all non-metadata command usages of DBConfig::isShardingEnabled
Diffstat (limited to 'src/mongo/s/config.cpp')
-rw-r--r--src/mongo/s/config.cpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp
index cb17f74f005..256362be582 100644
--- a/src/mongo/s/config.cpp
+++ b/src/mongo/s/config.cpp
@@ -76,22 +76,17 @@ void CollectionInfo::resetCM(ChunkManager* cm) {
_cm.reset(cm);
}
-DBConfig::DBConfig(std::string name, const DatabaseType& dbt, repl::OpTime configOpTime)
- : _name(name), _configOpTime(std::move(configOpTime)) {
- invariant(_name == dbt.getName());
- _primaryId = dbt.getPrimary();
- _shardingEnabled = dbt.getSharded();
-}
+DBConfig::DBConfig(const DatabaseType& dbt, repl::OpTime configOpTime)
+ : _name(dbt.getName()),
+ _shardingEnabled(dbt.getSharded()),
+ _primaryId(dbt.getPrimary()),
+ _configOpTime(std::move(configOpTime)) {}
DBConfig::~DBConfig() = default;
bool DBConfig::isSharded(const string& ns) {
stdx::lock_guard<stdx::mutex> lk(_lock);
- if (!_shardingEnabled) {
- return false;
- }
-
CollectionInfoMap::iterator i = _collections.find(ns);
if (i == _collections.end()) {
return false;
@@ -140,11 +135,7 @@ void DBConfig::getChunkManagerOrPrimary(OperationContext* txn,
} else {
CollectionInfo& cInfo = i->second;
- // TODO: we need to be careful about handling shardingEnabled, b/c in some places we
- // seem to use and some we don't. If we use this function in combination with just
- // getChunkManager() on a slightly borked config db, we'll get lots of staleconfig
- // retries
- if (_shardingEnabled && cInfo.isSharded()) {
+ if (cInfo.isSharded()) {
manager = cInfo.getCM();
} else {
auto primaryStatus = shardRegistry->getShard(txn, _primaryId);
@@ -358,7 +349,6 @@ bool DBConfig::_loadIfNeeded(OperationContext* txn, Counter reloadIteration) {
const auto& dbt = dbOpTimePair.value;
invariant(_name == dbt.getName());
_primaryId = dbt.getPrimary();
- _shardingEnabled = dbt.getSharded();
invariant(dbOpTimePair.opTime >= _configOpTime);
_configOpTime = dbOpTimePair.opTime;
@@ -430,21 +420,6 @@ void DBConfig::getAllShardIds(set<ShardId>* shardIds) {
}
}
-void DBConfig::getAllShardedCollections(set<string>& namespaces) {
- stdx::lock_guard<stdx::mutex> lk(_lock);
-
- for (CollectionInfoMap::const_iterator i = _collections.begin(); i != _collections.end(); i++) {
- log() << "Coll : " << i->first << " sharded? " << i->second.isSharded();
- if (i->second.isSharded())
- namespaces.insert(i->first);
- }
-}
-
-bool DBConfig::isShardingEnabled() {
- stdx::lock_guard<stdx::mutex> lk(_lock);
- return _shardingEnabled;
-}
-
ShardId DBConfig::getPrimaryId() {
stdx::lock_guard<stdx::mutex> lk(_lock);
return _primaryId;