summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/drop_database.cpp
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-10-01 00:32:17 +0000
committerevergreen <evergreen@mongodb.com>2019-10-01 00:32:17 +0000
commit15c6c085126f5d459f30191ef736c10607bea3f6 (patch)
tree0b500586d8304ad7bce4833e4aae119a6be1e6e1 /src/mongo/db/catalog/drop_database.cpp
parent8e8428e17f6504fea71c93028ff9e03002d87548 (diff)
downloadmongo-15c6c085126f5d459f30191ef736c10607bea3f6.tar.gz
SERVER-43402 dropDatabase should send drop database oplog entry prior to dropping in memory state of database
Diffstat (limited to 'src/mongo/db/catalog/drop_database.cpp')
-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