diff --git a/src/mongo/db/s/create_collection_coordinator.cpp b/src/mongo/db/s/create_collection_coordinator.cpp index 31e113d8af..0e07e8533d 100644 --- a/src/mongo/db/s/create_collection_coordinator.cpp +++ b/src/mongo/db/s/create_collection_coordinator.cpp @@ -54,6 +54,9 @@ namespace mongo { namespace { +MONGO_FAIL_POINT_DEFINE(hangAfterChunksWrite); +MONGO_FAIL_POINT_DEFINE(stepDownWhileRemovingChunks); + struct OptionsAndIndexes { BSONObj options; std::vector indexSpecs; @@ -213,6 +216,11 @@ void removeChunks(OperationContext* opCtx, const UUID& uuid) { BatchWriteExecStats stats; BatchedCommandResponse response; + if(stepDownWhileRemovingChunks.shouldFail()) { + stepDownWhileRemovingChunks.pauseWhileSet(); + uasserted(ErrorCodes::PrimarySteppedDown, "Stepping down on removeChunks"); + } + BatchedCommandRequest deleteRequest([&]() { write_ops::DeleteCommandRequest deleteOp(ChunkType::ConfigNS); deleteOp.setWriteCommandRequestBase([] { @@ -702,6 +710,8 @@ void CreateCollectionCoordinator::_commit(OperationContext* opCtx) { // Upsert Chunks. upsertChunks(opCtx, _initialChunks.chunks); + hangAfterChunksWrite.pauseWhileSet(); + CollectionType coll(nss(), _initialChunks.collVersion().epoch(), _initialChunks.collVersion().getTimestamp(),