diff --git a/jstests/replsets/recovery.js b/jstests/replsets/recovery.js
new file mode 100644
index 0000000000..87c8b16670
--- /dev/null
+++ b/jstests/replsets/recovery.js
@@ -0,0 +1,51 @@
+let rst = new ReplSetTest({nodes: 2, nodeOptions: {syncdelay: 1}});
+rst.startSet();
+rst.initiate();
+
+let primary = rst.getPrimary();
+let secondary = rst.getSecondary();
+let coll = primary.getDB("test")["test"];
+
+jsTestLog("Inserting docs in primary");
+assert.commandWorked(coll.insert({x: 1}));
+assert.commandWorked(coll.insert({x: 2}));
+assert.commandWorked(coll.insert({x: 3}));
+rst.awaitReplication();
+var replSetStatus = assert.commandWorked(primary.getDB("admin").runCommand({replSetGetStatus: 1}));
+var connStatus = replSetStatus.members.filter(m => m.self)[0];
+var opTime = connStatus.optime;
+var ts = opTime.ts;
+
+// Wait for a stable checkpoint.
+sleep(3000);
+
+assert.commandWorked(secondary.adminCommand({
+    "configureFailPoint": 'holdStableTimestampAtSpecificTimestamp',
+    "mode": 'alwaysOn',
+    "data": {"timestamp": ts}
+}));
+
+jsTestLog("Holding stable timestamp at: " + tojson(ts));
+
+assert.commandWorked(secondary.adminCommand({
+    "configureFailPoint": 'pauseAfterSetOplogTruncateAfterPoint',
+    "mode": 'alwaysOn',
+}));
+
+jsTestLog("Inserting one more doc");
+assert.commandWorked(coll.insert({x: 4}));
+
+// Wait for the failpoint to be hit.
+sleep(1000);
+
+jsTestLog("Restarting node");
+rst.stop(1, 9, {allowedExitCode: MongoRunner.EXIT_SIGKILL}, {forRestart: true});
+rst.start(1, {}, true);
+
+rst.awaitSecondaryNodes();
+
+jsTestLog("Printing docs");
+let docs = rst.getSecondary().getDB("test")["test"].find().toArray();
+jsTestLog(docs);
+
+rst.stopSet();
\ No newline at end of file
diff --git a/src/mongo/db/repl/oplog_applier_impl.cpp b/src/mongo/db/repl/oplog_applier_impl.cpp
index 8bdd717926..2b2e61873d 100644
--- a/src/mongo/db/repl/oplog_applier_impl.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl.cpp
@@ -58,6 +58,7 @@ namespace {
 MONGO_FAIL_POINT_DEFINE(pauseBatchApplicationBeforeCompletion);
 MONGO_FAIL_POINT_DEFINE(pauseBatchApplicationAfterWritingOplogEntries);
 MONGO_FAIL_POINT_DEFINE(hangAfterRecordingOpApplicationStartTime);
+MONGO_FAIL_POINT_DEFINE(pauseAfterSetOplogTruncateAfterPoint);
 
 // The oplog entries applied
 Counter64 opsAppliedStats;
@@ -567,6 +568,12 @@ void scheduleWritesToOplog(OperationContext* opCtx,
             fassert(40141,
                     storageInterface->insertDocuments(
                         opCtx.get(), NamespaceString::kRsOplogNamespace, docs));
+            if (MONGO_unlikely(pauseAfterSetOplogTruncateAfterPoint.shouldFail())) {
+                LOGV2(2123101,
+                      "pauseAfterSetOplogTruncateAfterPoint fail point enabled. Blocking "
+                      "until fail point is disabled");
+                pauseAfterSetOplogTruncateAfterPoint.pauseWhileSet(opCtx.get());
+            }
         };
     };
 
diff --git a/src/mongo/db/repl/replication_consistency_markers_impl.cpp b/src/mongo/db/repl/replication_consistency_markers_impl.cpp
index 4c7fc04517..720a0650d9 100644
--- a/src/mongo/db/repl/replication_consistency_markers_impl.cpp
+++ b/src/mongo/db/repl/replication_consistency_markers_impl.cpp
@@ -380,7 +380,7 @@ void ReplicationConsistencyMarkersImpl::_upsertOplogTruncateAfterPointDocument(
 void ReplicationConsistencyMarkersImpl::setOplogTruncateAfterPoint(OperationContext* opCtx,
                                                                    const Timestamp& timestamp) {
     LOGV2_DEBUG(21296,
-                3,
+                0,
                 "setting oplog truncate after point to: {oplogTruncateAfterPoint}",
                 "Setting oplog truncate after point",
                 "oplogTruncateAfterPoint"_attr = timestamp.toBSON());
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 8f9fd45483..daa18cd84c 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -2008,6 +2008,7 @@ void WiredTigerRecordStore::cappedTruncateAfter(OperationContext* opCtx,
         // that is being deleted.
         record = cursor->next();
         if (!record) {
+            logd("No records to delete for truncation.");
             return;  // No records to delete.
         }
         lastKeptId = end;
