diff --git a/src/mongo/db/catalog/uncommitted_collections.cpp b/src/mongo/db/catalog/uncommitted_collections.cpp
|
index db9a6e3c97..b48b88e9d9 100644
|
--- a/src/mongo/db/catalog/uncommitted_collections.cpp
|
+++ b/src/mongo/db/catalog/uncommitted_collections.cpp
|
@@ -34,9 +34,14 @@
|
#include "mongo/db/catalog/collection_catalog.h"
|
#include "mongo/db/catalog/uncommitted_collections.h"
|
#include "mongo/db/storage/durable_catalog.h"
|
+#include "mongo/logv2/log.h"
|
#include "mongo/util/assert_util.h"
|
+#include "mongo/util/fail_point.h"
|
|
namespace mongo {
|
+
|
+MONGO_FAIL_POINT_DEFINE(hangAfterRegisteringCollection);
|
+
|
namespace {
|
const auto getUncommittedCollections =
|
OperationContext::declareDecoration<UncommittedCollections>();
|
@@ -69,9 +74,20 @@ void UncommittedCollections::addToTxn(OperationContext* opCtx,
|
|
|
opCtx->recoveryUnit()->registerPreCommitHook(
|
- [collListUnowned, uuid, createTime](OperationContext* opCtx) {
|
+ [collListUnowned, nss, uuid, createTime](OperationContext* opCtx) {
|
UncommittedCollections::commit(opCtx, uuid, createTime, collListUnowned.lock().get());
|
+
|
+ hangAfterRegisteringCollection.executeIf(
|
+ [&](const BSONObj& data) {
|
+ LOGV2(46156012, "hanging after registering collection.", "nss"_attr = nss);
|
+ hangAfterRegisteringCollection.pauseWhileSet(opCtx);
|
+ },
|
+ [&](const BSONObj& data) {
|
+ auto collElem = data["collection"];
|
+ return !collElem || collElem.str() == nss.ns();
|
+ });
|
});
|
+
|
opCtx->recoveryUnit()->onCommit(
|
[collListUnowned, collPtr, createTime](boost::optional<Timestamp> commitTs) {
|
// Verify that the collection was given a minVisibleTimestamp equal to the transactions
|