diff options
author | Ian Whalen <ian.whalen@gmail.com> | 2016-07-27 14:07:59 -0400 |
---|---|---|
committer | Ian Whalen <ian.whalen@gmail.com> | 2016-07-27 14:07:59 -0400 |
commit | 1c1bf24edf54e41e541cf91a06b38d2056400179 (patch) | |
tree | 9629e1046faff0b9b093688a70d6a834c8b3efb8 /src/mongo/s/sharding_raii.cpp | |
parent | b0be62ef611373f426af8be77dd3af4457598a20 (diff) | |
download | mongo-1c1bf24edf54e41e541cf91a06b38d2056400179.tar.gz |
Revert "SERVER-24856 Make manual moveChunk requests go through the balancer on CSRS primary"
This reverts commit 22eff747e1e2408cb30f286751c47965e909c5b1.
Diffstat (limited to 'src/mongo/s/sharding_raii.cpp')
-rw-r--r-- | src/mongo/s/sharding_raii.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/mongo/s/sharding_raii.cpp b/src/mongo/s/sharding_raii.cpp index 7902657b506..a948893d36e 100644 --- a/src/mongo/s/sharding_raii.cpp +++ b/src/mongo/s/sharding_raii.cpp @@ -92,28 +92,18 @@ StatusWith<ScopedChunkManager> ScopedChunkManager::getExisting(OperationContext* auto scopedDb = std::move(scopedDbStatus.getValue()); - try { - std::shared_ptr<ChunkManager> cm = - scopedDb.db()->getChunkManager(txn, nss.ns(), true, false); - - if (!cm) { - return {ErrorCodes::NamespaceNotSharded, - str::stream() << "Collection " << nss.ns() - << " does not exist or is not sharded."}; - } - - if (cm->getChunkMap().empty()) { - return {ErrorCodes::NamespaceNotSharded, - str::stream() << "Collection " << nss.ns() - << " is marked as sharded, but does not have any chunks. This " - "most likely indicates a corrupted metadata or " - "partially completed 'shardCollection' command."}; - } + shared_ptr<ChunkManager> cm = scopedDb.db()->getChunkManagerIfExists(txn, nss.ns(), true); + if (!cm) { + return {ErrorCodes::NamespaceNotSharded, + str::stream() << "Collection " << nss.ns() << " does not exist or is not sharded."}; + } - return {ScopedChunkManager(std::move(scopedDb), std::move(cm))}; - } catch (const AssertionException& e) { - return e.toStatus(); + if (cm->getChunkMap().empty()) { + return {ErrorCodes::NamespaceNotSharded, + str::stream() << "Collection " << nss.ns() << " does not have any chunks."}; } + + return {ScopedChunkManager(std::move(scopedDb), std::move(cm))}; } } // namespace mongo |