diff --git a/jstests/noPassthrough/collection_catalog_two_phase_drops.js b/jstests/noPassthrough/collection_catalog_two_phase_drops.js index a8868eb7f84..3cf64cd8365 100644 --- a/jstests/noPassthrough/collection_catalog_two_phase_drops.js +++ b/jstests/noPassthrough/collection_catalog_two_phase_drops.js @@ -9,6 +9,7 @@ * ] */ import {getUriForColl, getUriForIndex} from "jstests/disk/libs/wt_file_helper.js"; +import {Thread} from "jstests/libs/parallelTester.js"; const rst = new ReplSetTest({ nodes: 1, @@ -120,8 +121,23 @@ checkLog.containsJson(primary, 6825300, { // Perform an operation and take a checkpoint to advance the checkpoint timestamp. The ident reaper // will drop any drop pending idents earlier than the checkpoint timestamp. -assert.commandWorked(db.adminCommand({appendOplogNote: 1, data: {msg: "advance timestamp"}})); +assert.commandWorked( + primary.adminCommand({configureFailPoint: "hangInAppendOplogNoteAfterCommit", mode: "alwaysOn"})); +assert.commandWorked( + primary.adminCommand({configureFailPoint: "pauseJournalFlusherBeforeFlush", mode: "alwaysOn"})); +let thread = new Thread((mongodConn, dbName) => { + let mongo = new Mongo(mongodConn); + const db = mongo.getDB(dbName); + assert.commandWorked(db.adminCommand({appendOplogNote: 1, data: {msg: "advance timestamp"}})); +}, primary.host, dbName); +thread.start(); + assert.commandWorked(db.adminCommand({fsync: 1})); +assert.commandWorked( + primary.adminCommand({configureFailPoint: "hangInAppendOplogNoteAfterCommit", mode: "off"})); +assert.commandWorked( + primary.adminCommand({configureFailPoint: "pauseJournalFlusherBeforeFlush", mode: "off"})); +thread.join(); // "The ident was successfully dropped". checkLog.containsJson(primary, 6776600, { diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index c591e62b698..687e79ed1c4 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -75,6 +75,7 @@ namespace mongo { MONGO_FAIL_POINT_DEFINE(hangInAppendOplogNote); +MONGO_FAIL_POINT_DEFINE(hangInAppendOplogNoteAfterCommit); namespace { Status _performNoopWrite(OperationContext* opCtx, BSONObj msgObj, StringData note) { @@ -103,6 +104,8 @@ Status _performNoopWrite(OperationContext* opCtx, BSONObj msgObj, StringData not uow.commit(); }); + hangInAppendOplogNoteAfterCommit.pauseWhileSet(); + return Status::OK(); } } // namespace