diff options
Diffstat (limited to 'src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.cpp')
-rw-r--r-- | src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.cpp b/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.cpp index 17a2c69a207..44b87b8a534 100644 --- a/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.cpp +++ b/src/mongo/db/pipeline/process_interface/replica_set_node_process_interface.cpp @@ -123,11 +123,16 @@ void ReplicaSetNodeProcessInterface::createIndexesOnEmptyCollection( AutoGetCollection autoColl(opCtx, ns, MODE_X); writeConflictRetry( opCtx, "CommonMongodProcessInterface::createIndexesOnEmptyCollection", ns.ns(), [&] { + uassert(ErrorCodes::DatabaseDropPending, + str::stream() << "The database is in the process of being dropped " << ns.db(), + autoColl.getDb() && !autoColl.getDb()->isDropPending(opCtx)); + auto collection = autoColl.getCollection(); - invariant(collection, - str::stream() << "Failed to create indexes for aggregation because " - "collection does not exist: " - << ns << ": " << BSON("indexes" << indexSpecs)); + uassert(ErrorCodes::NamespaceNotFound, + str::stream() << "Failed to create indexes for aggregation because collection " + "does not exist: " + << ns << ": " << BSON("indexes" << indexSpecs), + collection); invariant(0U == collection->numRecords(opCtx), str::stream() << "Expected empty collection for index creation: " << ns |