summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/catalog/drop_database.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/mongo/db/catalog/drop_database.cpp b/src/mongo/db/catalog/drop_database.cpp
index 793d9a9f779..bb3747bfc23 100644
--- a/src/mongo/db/catalog/drop_database.cpp
+++ b/src/mongo/db/catalog/drop_database.cpp
@@ -54,8 +54,8 @@
namespace mongo {
-MONGO_FAIL_POINT_DEFINE(dropDatabaseHangBeforeLog);
MONGO_FAIL_POINT_DEFINE(dropDatabaseHangAfterAllCollectionsDrop);
+MONGO_FAIL_POINT_DEFINE(dropDatabaseHangBeforeInMemoryDrop);
namespace {
@@ -78,24 +78,23 @@ void _finishDropDatabase(OperationContext* opCtx,
BackgroundOperation::assertNoBgOpInProgForDb(dbName);
IndexBuildsCoordinator::get(opCtx)->assertNoBgOpInProgForDb(dbName);
+ writeConflictRetry(opCtx, "dropDatabase_database", dbName, [&] {
+ WriteUnitOfWork wunit(opCtx);
+ opCtx->getServiceContext()->getOpObserver()->onDropDatabase(opCtx, dbName);
+ wunit.commit();
+ });
+
+ if (MONGO_unlikely(dropDatabaseHangBeforeInMemoryDrop.shouldFail())) {
+ log() << "dropDatabase - fail point dropDatabaseHangBeforeInMemoryDrop enabled.";
+ dropDatabaseHangBeforeInMemoryDrop.pauseWhileSet();
+ }
+
auto databaseHolder = DatabaseHolder::get(opCtx);
databaseHolder->dropDb(opCtx, db);
dropPendingGuard.dismiss();
log() << "dropDatabase " << dbName << " - dropped " << numCollections << " collection(s)";
log() << "dropDatabase " << dbName << " - finished";
-
- if (MONGO_unlikely(dropDatabaseHangBeforeLog.shouldFail())) {
- log() << "dropDatabase - fail point dropDatabaseHangBeforeLog enabled. "
- "Blocking until fail point is disabled. ";
- dropDatabaseHangBeforeLog.pauseWhileSet();
- }
-
- writeConflictRetry(opCtx, "dropDatabase_database", dbName, [&] {
- WriteUnitOfWork wunit(opCtx);
- getGlobalServiceContext()->getOpObserver()->onDropDatabase(opCtx, dbName);
- wunit.commit();
- });
}
} // namespace