summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-02-08 12:02:38 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-02-08 12:02:55 -0500
commitbae38e4ebedfe66f66f3cef6ee0e9d12ad79b116 (patch)
treea77ba91545392fc02d43cfda178e5ca3d860777a /src
parent92b04fe8dc31e7ec90bc97ad8722768d7732717e (diff)
downloadmongo-bae38e4ebedfe66f66f3cef6ee0e9d12ad79b116.tar.gz
SERVER-27382 Get rid of the DBConfig::reload method
Diffstat (limited to 'src')
-rw-r--r--src/mongo/s/config.cpp33
-rw-r--r--src/mongo/s/config.h1
2 files changed, 13 insertions, 21 deletions
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp
index fea546c14a4..6240bac0ba6 100644
--- a/src/mongo/s/config.cpp
+++ b/src/mongo/s/config.cpp
@@ -202,9 +202,20 @@ std::shared_ptr<ChunkManager> DBConfig::getChunkManager(OperationContext* txn,
if (!tempChunkManager->numChunks()) {
// Maybe we're not sharded any more, so do a full reload
- reload(txn);
+ const auto currentReloadIteration = _reloadCount.load();
+
+ const bool successful = [&]() {
+ stdx::lock_guard<stdx::mutex> lk(_lock);
+ return _loadIfNeeded(txn, currentReloadIteration);
+ }();
+
+ // If we aren't successful loading the database entry, we don't want to keep the stale
+ // object around which has invalid data.
+ if (!successful) {
+ Grid::get(txn)->catalogCache()->invalidate(_name);
+ }
- return getChunkManager(txn, ns, false);
+ return getChunkManager(txn, ns);
}
}
@@ -328,24 +339,6 @@ bool DBConfig::_loadIfNeeded(OperationContext* txn, Counter reloadIteration) {
return true;
}
-bool DBConfig::reload(OperationContext* txn) {
- bool successful = false;
- const auto currentReloadIteration = _reloadCount.load();
-
- {
- stdx::lock_guard<stdx::mutex> lk(_lock);
- successful = _loadIfNeeded(txn, currentReloadIteration);
- }
-
- // If we aren't successful loading the database entry, we don't want to keep the stale
- // object around which has invalid data.
- if (!successful) {
- Grid::get(txn)->catalogCache()->invalidate(_name);
- }
-
- return successful;
-}
-
void DBConfig::getAllShardIds(std::set<ShardId>* shardIds) {
stdx::lock_guard<stdx::mutex> lk(_lock);
shardIds->insert(_primaryId);
diff --git a/src/mongo/s/config.h b/src/mongo/s/config.h
index acc0c4968c3..73694eb37e2 100644
--- a/src/mongo/s/config.h
+++ b/src/mongo/s/config.h
@@ -95,7 +95,6 @@ public:
* and throws on all other errors.
*/
bool load(OperationContext* txn);
- bool reload(OperationContext* txn);
void getAllShardIds(std::set<ShardId>* shardIds);