summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/balancer/balancer.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-03-12 17:27:34 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-03-12 17:27:34 -0400
commit8125c55a251805899552d0af4776930216223703 (patch)
tree3e1a43aa762a2136422b4fa66f70ee89222d29a1 /src/mongo/db/s/balancer/balancer.cpp
parentae2518adace4ba7ed6a16eba6943bff6ea4ade10 (diff)
downloadmongo-8125c55a251805899552d0af4776930216223703.tar.gz
Revert "SERVER-22611 Sharding catalog cache refactor"
This reverts commit ae2518adace4ba7ed6a16eba6943bff6ea4ade10.
Diffstat (limited to 'src/mongo/db/s/balancer/balancer.cpp')
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp
index b85f08b7189..60a765cf5d6 100644
--- a/src/mongo/db/s/balancer/balancer.cpp
+++ b/src/mongo/db/s/balancer/balancer.cpp
@@ -46,11 +46,12 @@
#include "mongo/s/balancer_configuration.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/catalog/type_chunk.h"
-#include "mongo/s/catalog_cache.h"
+#include "mongo/s/client/shard.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/cluster_identity_loader.h"
#include "mongo/s/grid.h"
#include "mongo/s/shard_util.h"
+#include "mongo/s/sharding_raii.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/exit.h"
#include "mongo/util/log.h"
@@ -533,20 +534,18 @@ Status Balancer::_enforceTagRanges(OperationContext* opCtx) {
}
for (const auto& splitInfo : chunksToSplitStatus.getValue()) {
- auto routingInfoStatus =
- Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(
- opCtx, splitInfo.nss);
- if (!routingInfoStatus.isOK()) {
- return routingInfoStatus.getStatus();
+ auto scopedCMStatus = ScopedChunkManager::refreshAndGet(opCtx, splitInfo.nss);
+ if (!scopedCMStatus.isOK()) {
+ return scopedCMStatus.getStatus();
}
- auto cm = routingInfoStatus.getValue().cm();
+ const auto& scopedCM = scopedCMStatus.getValue();
auto splitStatus =
shardutil::splitChunkAtMultiplePoints(opCtx,
splitInfo.shardId,
splitInfo.nss,
- cm->getShardKeyPattern(),
+ scopedCM.cm()->getShardKeyPattern(),
splitInfo.collectionVersion,
ChunkRange(splitInfo.minKey, splitInfo.maxKey),
splitInfo.splitKeys);
@@ -614,9 +613,8 @@ int Balancer::_moveChunks(OperationContext* opCtx,
void Balancer::_splitOrMarkJumbo(OperationContext* opCtx,
const NamespaceString& nss,
const BSONObj& minKey) {
- auto routingInfo = uassertStatusOK(
- Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(opCtx, nss));
- const auto cm = routingInfo.cm().get();
+ auto scopedCM = uassertStatusOK(ScopedChunkManager::refreshAndGet(opCtx, nss));
+ const auto cm = scopedCM.cm().get();
auto chunk = cm->findIntersectingChunkWithSimpleCollation(minKey);