summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/config')
-rw-r--r--src/mongo/db/s/config/configsvr_split_chunk_command.cpp6
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager.h17
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp18
3 files changed, 24 insertions, 17 deletions
diff --git a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
index 5451137ad59..c62bca910e9 100644
--- a/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
+++ b/src/mongo/db/s/config/configsvr_split_chunk_command.cpp
@@ -112,14 +112,14 @@ public:
auto parsedRequest = uassertStatusOK(SplitChunkRequest::parseFromConfigCommand(cmdObj));
- Status splitChunkResult =
+ auto shardVers = uassertStatusOK(
ShardingCatalogManager::get(opCtx)->commitChunkSplit(opCtx,
parsedRequest.getNamespace(),
parsedRequest.getEpoch(),
parsedRequest.getChunkRange(),
parsedRequest.getSplitPoints(),
- parsedRequest.getShardName());
- uassertStatusOK(splitChunkResult);
+ parsedRequest.getShardName()));
+ result.appendElements(shardVers);
return true;
}
diff --git a/src/mongo/db/s/config/sharding_catalog_manager.h b/src/mongo/db/s/config/sharding_catalog_manager.h
index 4e5f0d61241..21e6121cb5d 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager.h
+++ b/src/mongo/db/s/config/sharding_catalog_manager.h
@@ -179,13 +179,16 @@ public:
/**
* Updates metadata in the config.chunks collection to show the given chunk as split into
* smaller chunks at the specified split points.
- */
- Status commitChunkSplit(OperationContext* opCtx,
- const NamespaceString& nss,
- const OID& requestEpoch,
- const ChunkRange& range,
- const std::vector<BSONObj>& splitPoints,
- const std::string& shardName);
+ *
+ * Returns a BSON object with the newly produced chunk version after the migration:
+ * - shardVersion - The new shard version of the source shard
+ */
+ StatusWith<BSONObj> commitChunkSplit(OperationContext* opCtx,
+ const NamespaceString& nss,
+ const OID& requestEpoch,
+ const ChunkRange& range,
+ const std::vector<BSONObj>& splitPoints,
+ const std::string& shardName);
/**
* Updates metadata in the config.chunks collection so the chunks with given boundaries are seen
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 f07c54d6341..68d291d91dc 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
@@ -287,12 +287,13 @@ StatusWith<ChunkVersion> getMaxChunkVersionFromQueryResponse(
} // namespace
-Status ShardingCatalogManager::commitChunkSplit(OperationContext* opCtx,
- const NamespaceString& nss,
- const OID& requestEpoch,
- const ChunkRange& range,
- const std::vector<BSONObj>& splitPoints,
- const std::string& shardName) {
+StatusWith<BSONObj> ShardingCatalogManager::commitChunkSplit(
+ OperationContext* opCtx,
+ const NamespaceString& nss,
+ const OID& requestEpoch,
+ const ChunkRange& range,
+ const std::vector<BSONObj>& splitPoints,
+ const std::string& shardName) {
// Take _kChunkOpLock in exclusive mode to prevent concurrent chunk splits, merges, and
// migrations
// TODO(SERVER-25359): Replace with a collection-specific lock map to allow splits/merges/
@@ -523,7 +524,10 @@ Status ShardingCatalogManager::commitChunkSplit(OperationContext* opCtx,
}
}
- return Status::OK();
+ // currentMaxVersion contains shard version with incremented minor version
+ BSONObjBuilder result;
+ currentMaxVersion.appendToCommand(&result);
+ return result.obj();
}
Status ShardingCatalogManager::commitChunkMerge(OperationContext* opCtx,