diff options
Diffstat (limited to 'src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp')
-rw-r--r-- | src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp index 4f3905b61bd..a4574dfc676 100644 --- a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp +++ b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp @@ -63,7 +63,7 @@ namespace { * distrubution and chunk placement information which is needed by the balancer policy. */ StatusWith<DistributionStatus> createCollectionDistributionStatus( - OperationContext* txn, const ShardStatisticsVector& allShards, ChunkManager* chunkMgr) { + OperationContext* opCtx, const ShardStatisticsVector& allShards, ChunkManager* chunkMgr) { ShardToChunksMap shardToChunksMap; // Makes sure there is an entry in shardToChunksMap for every shard, so empty shards will also @@ -87,8 +87,8 @@ StatusWith<DistributionStatus> createCollectionDistributionStatus( } vector<TagsType> collectionTags; - Status tagsStatus = Grid::get(txn)->catalogClient(txn)->getTagsForCollection( - txn, chunkMgr->getns(), &collectionTags); + Status tagsStatus = Grid::get(opCtx)->catalogClient(opCtx)->getTagsForCollection( + opCtx, chunkMgr->getns(), &collectionTags); if (!tagsStatus.isOK()) { return {tagsStatus.code(), str::stream() << "Unable to load tags for collection " << chunkMgr->getns() @@ -186,8 +186,8 @@ BalancerChunkSelectionPolicyImpl::BalancerChunkSelectionPolicyImpl(ClusterStatis BalancerChunkSelectionPolicyImpl::~BalancerChunkSelectionPolicyImpl() = default; StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToSplit( - OperationContext* txn) { - auto shardStatsStatus = _clusterStats->getStats(txn); + OperationContext* opCtx) { + auto shardStatsStatus = _clusterStats->getStats(opCtx); if (!shardStatsStatus.isOK()) { return shardStatsStatus.getStatus(); } @@ -196,8 +196,8 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToSpli vector<CollectionType> collections; - Status collsStatus = - Grid::get(txn)->catalogClient(txn)->getCollections(txn, nullptr, &collections, nullptr); + Status collsStatus = Grid::get(opCtx)->catalogClient(opCtx)->getCollections( + opCtx, nullptr, &collections, nullptr); if (!collsStatus.isOK()) { return collsStatus; } @@ -215,7 +215,7 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToSpli const NamespaceString nss(coll.getNs()); - auto candidatesStatus = _getSplitCandidatesForCollection(txn, nss, shardStats); + auto candidatesStatus = _getSplitCandidatesForCollection(opCtx, nss, shardStats); if (candidatesStatus == ErrorCodes::NamespaceNotFound) { // Namespace got dropped before we managed to get to it, so just skip it continue; @@ -234,8 +234,8 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToSpli } StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToMove( - OperationContext* txn, bool aggressiveBalanceHint) { - auto shardStatsStatus = _clusterStats->getStats(txn); + OperationContext* opCtx, bool aggressiveBalanceHint) { + auto shardStatsStatus = _clusterStats->getStats(opCtx); if (!shardStatsStatus.isOK()) { return shardStatsStatus.getStatus(); } @@ -248,8 +248,8 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToMo vector<CollectionType> collections; - Status collsStatus = - Grid::get(txn)->catalogClient(txn)->getCollections(txn, nullptr, &collections, nullptr); + Status collsStatus = Grid::get(opCtx)->catalogClient(opCtx)->getCollections( + opCtx, nullptr, &collections, nullptr); if (!collsStatus.isOK()) { return collsStatus; } @@ -273,7 +273,7 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToMo } auto candidatesStatus = - _getMigrateCandidatesForCollection(txn, nss, shardStats, aggressiveBalanceHint); + _getMigrateCandidatesForCollection(opCtx, nss, shardStats, aggressiveBalanceHint); if (candidatesStatus == ErrorCodes::NamespaceNotFound) { // Namespace got dropped before we managed to get to it, so just skip it continue; @@ -292,9 +292,9 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToMo } StatusWith<boost::optional<MigrateInfo>> -BalancerChunkSelectionPolicyImpl::selectSpecificChunkToMove(OperationContext* txn, +BalancerChunkSelectionPolicyImpl::selectSpecificChunkToMove(OperationContext* opCtx, const ChunkType& chunk) { - auto shardStatsStatus = _clusterStats->getStats(txn); + auto shardStatsStatus = _clusterStats->getStats(opCtx); if (!shardStatsStatus.isOK()) { return shardStatsStatus.getStatus(); } @@ -303,7 +303,7 @@ BalancerChunkSelectionPolicyImpl::selectSpecificChunkToMove(OperationContext* tx const NamespaceString nss(chunk.getNS()); - auto scopedCMStatus = ScopedChunkManager::refreshAndGet(txn, nss); + auto scopedCMStatus = ScopedChunkManager::refreshAndGet(opCtx, nss); if (!scopedCMStatus.isOK()) { return scopedCMStatus.getStatus(); } @@ -311,7 +311,7 @@ BalancerChunkSelectionPolicyImpl::selectSpecificChunkToMove(OperationContext* tx const auto& scopedCM = scopedCMStatus.getValue(); const auto cm = scopedCM.cm().get(); - const auto collInfoStatus = createCollectionDistributionStatus(txn, shardStats, cm); + const auto collInfoStatus = createCollectionDistributionStatus(opCtx, shardStats, cm); if (!collInfoStatus.isOK()) { return collInfoStatus.getStatus(); } @@ -321,10 +321,10 @@ BalancerChunkSelectionPolicyImpl::selectSpecificChunkToMove(OperationContext* tx return BalancerPolicy::balanceSingleChunk(chunk, shardStats, distribution); } -Status BalancerChunkSelectionPolicyImpl::checkMoveAllowed(OperationContext* txn, +Status BalancerChunkSelectionPolicyImpl::checkMoveAllowed(OperationContext* opCtx, const ChunkType& chunk, const ShardId& newShardId) { - auto shardStatsStatus = _clusterStats->getStats(txn); + auto shardStatsStatus = _clusterStats->getStats(opCtx); if (!shardStatsStatus.isOK()) { return shardStatsStatus.getStatus(); } @@ -333,7 +333,7 @@ Status BalancerChunkSelectionPolicyImpl::checkMoveAllowed(OperationContext* txn, const NamespaceString nss(chunk.getNS()); - auto scopedCMStatus = ScopedChunkManager::refreshAndGet(txn, nss); + auto scopedCMStatus = ScopedChunkManager::refreshAndGet(opCtx, nss); if (!scopedCMStatus.isOK()) { return scopedCMStatus.getStatus(); } @@ -341,7 +341,7 @@ Status BalancerChunkSelectionPolicyImpl::checkMoveAllowed(OperationContext* txn, const auto& scopedCM = scopedCMStatus.getValue(); const auto cm = scopedCM.cm().get(); - const auto collInfoStatus = createCollectionDistributionStatus(txn, shardStats, cm); + const auto collInfoStatus = createCollectionDistributionStatus(opCtx, shardStats, cm); if (!collInfoStatus.isOK()) { return collInfoStatus.getStatus(); } @@ -365,8 +365,8 @@ Status BalancerChunkSelectionPolicyImpl::checkMoveAllowed(OperationContext* txn, } StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::_getSplitCandidatesForCollection( - OperationContext* txn, const NamespaceString& nss, const ShardStatisticsVector& shardStats) { - auto scopedCMStatus = ScopedChunkManager::refreshAndGet(txn, nss); + OperationContext* opCtx, const NamespaceString& nss, const ShardStatisticsVector& shardStats) { + auto scopedCMStatus = ScopedChunkManager::refreshAndGet(opCtx, nss); if (!scopedCMStatus.isOK()) { return scopedCMStatus.getStatus(); } @@ -376,7 +376,7 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::_getSplitCandidate const auto& shardKeyPattern = cm->getShardKeyPattern().getKeyPattern(); - const auto collInfoStatus = createCollectionDistributionStatus(txn, shardStats, cm); + const auto collInfoStatus = createCollectionDistributionStatus(opCtx, shardStats, cm); if (!collInfoStatus.isOK()) { return collInfoStatus.getStatus(); } @@ -416,11 +416,11 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::_getSplitCandidate } StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::_getMigrateCandidatesForCollection( - OperationContext* txn, + OperationContext* opCtx, const NamespaceString& nss, const ShardStatisticsVector& shardStats, bool aggressiveBalanceHint) { - auto scopedCMStatus = ScopedChunkManager::refreshAndGet(txn, nss); + auto scopedCMStatus = ScopedChunkManager::refreshAndGet(opCtx, nss); if (!scopedCMStatus.isOK()) { return scopedCMStatus.getStatus(); } @@ -430,7 +430,7 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::_getMigrateCandi const auto& shardKeyPattern = cm->getShardKeyPattern().getKeyPattern(); - const auto collInfoStatus = createCollectionDistributionStatus(txn, shardStats, cm); + const auto collInfoStatus = createCollectionDistributionStatus(opCtx, shardStats, cm); if (!collInfoStatus.isOK()) { return collInfoStatus.getStatus(); } |