summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheahuychou Mao <cheahuychou.mao@mongodb.com>2019-11-21 16:44:52 +0000
committerevergreen <evergreen@mongodb.com>2019-11-21 16:44:52 +0000
commit762e983eb72fa048ba00ab46c384458d308a461c (patch)
tree31e2bbca75400ad6ad9cc953bd11eefe907216c2
parent725469619160f02e62d8dace122e3210594597ff (diff)
downloadmongo-762e983eb72fa048ba00ab46c384458d308a461c.tar.gz
SERVER-44448 Delete dead code ShardingCatalogManager::_findCollectionVersion
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager.h7
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp47
2 files changed, 0 insertions, 54 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager.h b/src/mongo/db/s/config/sharding_catalog_manager.h
index bd976dd497e..3ec26ec69fd 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager.h
+++ b/src/mongo/db/s/config/sharding_catalog_manager.h
@@ -533,13 +533,6 @@ private:
const NamespaceString& nss,
const BSONObj& key);
- /**
- * Retrieve the the latest collection version from the config.
- */
- StatusWith<ChunkVersion> _findCollectionVersion(OperationContext* opCtx,
- const NamespaceString& nss,
- const OID& collectionEpoch);
-
// The owning service context
ServiceContext* const _serviceContext;
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
index e8e6fca56c9..fcc534c642d 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
@@ -923,53 +923,6 @@ StatusWith<ChunkType> ShardingCatalogManager::_findChunkOnConfig(OperationContex
return ChunkType::fromConfigBSON(origChunks.front());
}
-StatusWith<ChunkVersion> ShardingCatalogManager::_findCollectionVersion(
- OperationContext* opCtx, const NamespaceString& nss, const OID& collectionEpoch) {
- auto const configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
-
- // Must use local read concern because we will perform subsequent writes.
- auto findResponse =
- configShard->exhaustiveFindOnConfig(opCtx,
- ReadPreferenceSetting{ReadPreference::PrimaryOnly},
- repl::ReadConcernLevel::kLocalReadConcern,
- ChunkType::ConfigNS,
- BSON("ns" << nss.ns()),
- BSON(ChunkType::lastmod << -1),
- 1);
- if (!findResponse.isOK()) {
- return findResponse.getStatus();
- }
-
- const auto chunksVector = std::move(findResponse.getValue().docs);
- if (chunksVector.empty()) {
- return {ErrorCodes::IncompatibleShardingMetadata,
- str::stream() << "Tried to find max chunk version for collection '" << nss.ns()
- << ", but found no chunks"};
- }
-
- const auto swChunk = ChunkType::fromConfigBSON(chunksVector.front());
- if (!swChunk.isOK()) {
- return swChunk.getStatus();
- }
-
- const auto currentCollectionVersion = swChunk.getValue().getVersion();
-
- // It is possible for a migration to end up running partly without the protection of the
- // distributed lock if the config primary stepped down since the start of the migration and
- // failed to recover the migration. Check that the collection has not been dropped and recreated
- // since the migration began, unbeknown to the shard when the command was sent.
- if (currentCollectionVersion.epoch() != collectionEpoch) {
- return {ErrorCodes::StaleEpoch,
- str::stream() << "The collection '" << nss.ns()
- << "' has been dropped and recreated since the migration began."
- " The config server's collection version epoch is now '"
- << currentCollectionVersion.epoch().toString()
- << "', but the shard's is " << collectionEpoch.toString() << "'."};
- }
-
- return currentCollectionVersion;
-}
-
void ShardingCatalogManager::clearJumboFlag(OperationContext* opCtx,
const NamespaceString& nss,
const OID& collectionEpoch,