diff options
author | Marcos José Grillo Ramírez <marcos.grillo@10gen.com> | 2019-11-22 17:49:19 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-22 17:49:19 +0000 |
commit | 11754f469d36468e7c649cb9c052230614e4cb44 (patch) | |
tree | 05e9962361cb3256afadec30a5068fb237b13c7b /src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp | |
parent | c72849fb005cfcba272eb53b6024d5fd31c3ec9c (diff) | |
download | mongo-11754f469d36468e7c649cb9c052230614e4cb44.tar.gz |
SERVER-44476 Include number of jumbo chunks remaining in output of removeShard
Diffstat (limited to 'src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp')
-rw-r--r-- | src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp index 4e737b23027..2501ef509fe 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp @@ -741,7 +741,7 @@ StatusWith<std::string> ShardingCatalogManager::addShard( return shardType.getName(); } -ShardDrainingStatus ShardingCatalogManager::removeShard(OperationContext* opCtx, +RemoveShardProgress ShardingCatalogManager::removeShard(OperationContext* opCtx, const ShardId& shardId) { const auto name = shardId.toString(); @@ -786,7 +786,8 @@ ShardDrainingStatus ShardingCatalogManager::removeShard(OperationContext* opCtx, shardRegistry->reload(opCtx); - return ShardDrainingStatus::STARTED; + return {RemoveShardProgress::STARTED, + boost::optional<RemoveShardProgress::DrainingShardUsage>(boost::none)}; } // Draining has already started, now figure out how many chunks and databases are still on the @@ -797,12 +798,18 @@ ShardDrainingStatus ShardingCatalogManager::removeShard(OperationContext* opCtx, const auto databaseCount = uassertStatusOK( _runCountCommandOnConfig(opCtx, DatabaseType::ConfigNS, BSON(DatabaseType::primary(name)))); + const auto jumboCount = uassertStatusOK(_runCountCommandOnConfig( + opCtx, ChunkType::ConfigNS, BSON(ChunkType::shard(name) << ChunkType::jumbo(true)))); + if (chunkCount > 0 || databaseCount > 0) { // Still more draining to do LOG(0) << "chunkCount: " << chunkCount; LOG(0) << "databaseCount: " << databaseCount; + LOG(0) << "jumboCount: " << jumboCount; - return ShardDrainingStatus::ONGOING; + return {RemoveShardProgress::ONGOING, + boost::optional<RemoveShardProgress::DrainingShardUsage>( + {chunkCount, databaseCount, jumboCount})}; } // Draining is done, now finish removing the shard. @@ -825,7 +832,8 @@ ShardDrainingStatus ShardingCatalogManager::removeShard(OperationContext* opCtx, ShardingLogging::get(opCtx)->logChange( opCtx, "removeShard", "", BSON("shard" << name), ShardingCatalogClient::kLocalWriteConcern); - return ShardDrainingStatus::COMPLETED; + return {RemoveShardProgress::COMPLETED, + boost::optional<RemoveShardProgress::DrainingShardUsage>(boost::none)}; } void ShardingCatalogManager::appendConnectionStats(executor::ConnectionPoolStats* stats) { |