diff --git a/jstests/sharding/cleanup_orphaned_incoming_and_outgoing_repro.js b/jstests/sharding/cleanup_orphaned_incoming_and_outgoing_repro.js
new file mode 100644
index 0000000000..8f26159851
--- /dev/null
+++ b/jstests/sharding/cleanup_orphaned_incoming_and_outgoing_repro.js
@@ -0,0 +1,113 @@
+(function() {
+    "use strict";
+
+    load('./jstests/libs/cleanup_orphaned_util.js');
+    load('./jstests/libs/chunk_manipulation_util.js');
+
+    TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
+
+    const dbName = "test";
+    const collName = "foo";
+    const ns = dbName + "." + collName;
+
+    // For startParallelOps to write its state
+    let staticMongod = MongoRunner.runMongod({});
+
+    // Create 2 shards with 3 replicas each.
+    let st = new ShardingTest({shards: {rs0: {nodes: 3}, rs1: {nodes: 3}, rs2: {nodes: 3}}});
+
+    // Create a sharded collection with three chunks:
+    //     [-inf, -10), [-10, 10), [10, inf)
+    assert.commandWorked(st.s.adminCommand({enableSharding: dbName}));
+    assert.commandWorked(st.s.adminCommand({movePrimary: dbName, to: st.shard0.shardName}));
+    assert.commandWorked(st.s.adminCommand({shardCollection: ns, key: {x: 1}}));
+    assert.commandWorked(st.s.adminCommand({split: ns, middle: {x: -10}}));
+    assert.commandWorked(st.s.adminCommand({split: ns, middle: {x: 10}}));
+
+    // Move chunk [10, inf) to shard1.
+    assert.commandWorked(
+        st.s.adminCommand({moveChunk: ns, find: {x: 10}, to: st.shard1.shardName}));
+
+    let testDB = st.s.getDB(dbName);
+    let testColl = testDB.foo;
+
+    // Insert 20 docs in first chunk.
+    for (var i = -100; i < -80; i++) {
+        testColl.insert({x: i});
+    }
+
+    // Insert 10 docs in second chunk.
+    for (var i = -5; i < 5; i++) {
+        testColl.insert({x: i});
+    }
+
+    // Insert 10 docs in third chunk.
+    for (var i = 15; i < 25; i++) {
+        testColl.insert({x: i});
+    }
+
+    const expectedNumDocsTotal = 40;
+    const expectedNumDocsShard0Before = 30;
+    const expectedNumDocsShard1Before = 10;
+    const expectedNumDocsShard0After = 20;
+    const expectedNumDocsShard1After = 20;
+
+    // Verify total count.
+    assert.eq(testColl.find().itcount(), expectedNumDocsTotal);
+
+    // Verify shard0 count.
+    let shard0Coll = st.shard0.getCollection(ns);
+    assert.eq(shard0Coll.find().itcount(), expectedNumDocsShard0Before);
+
+    // Verify shard1 count.
+    let shard1Coll = st.shard1.getCollection(ns);
+    assert.eq(shard1Coll.find().itcount(), expectedNumDocsShard1Before);
+
+    pauseMoveChunkAtStep(st.shard0, moveChunkStepNames.chunkDataCommitted);
+
+    let joinMoveChunk =
+        moveChunkParallel(staticMongod, st.s.host, {x: -10}, null, ns, st.shard1.shardName);
+
+    waitForMoveChunkStep(st.shard0, moveChunkStepNames.chunkDataCommitted);
+
+    // Verify shard1 count contains moved chunk even though migration hasn't committed yet.
+    assert.eq(shard1Coll.find().itcount(), expectedNumDocsShard1After);
+
+    // Now move a different chunk out of shard1 and to shard2.
+    // Move chunk [10, inf) from shard1 to shard2. When this finishes it will clear active metadata
+    // (because of repro patch), which will clear _receivingChunks from the incoming migration.
+    assert.commandWorked(
+        st.s.adminCommand({moveChunk: ns, find: {x: 100}, to: st.shard2.shardName}));
+    // Connect to new primary for shard0.
+    let shard1Primary = st.rs1.getPrimary();
+    let shard1PrimaryColl = shard1Primary.getCollection(ns);
+
+    // Run cleanup orphaned on destination. This should NOT remove documents that have already been
+    // migrated in, except there's a bug so it does.
+    const expectedNumIterations = 2;
+    cleanupOrphaned(shard1Primary, ns, expectedNumIterations);
+
+    // cleanupOrphaned erroneously removes documents that had just been migrated in.
+    assert.eq(shard1PrimaryColl.find().itcount(), 0);
+
+    // Unpause the move. The move command succeeds.
+    unpauseMoveChunkAtStep(st.shard0, moveChunkStepNames.chunkDataCommitted);
+
+    // Wait for moveChunk to complete
+    joinMoveChunk();
+
+    // Run cleanup orphaned on source since the range deleter doesn't run if
+    // forceShardFilteringMetadataRefresh fails. This is just needed for the line below to check
+    // that the migration actually migrated documents out.
+    cleanupOrphaned(st.rs0.getPrimary(), ns, expectedNumIterations);
+
+    // Shows that the data was in fact migrated out of the source shard successfully even though it
+    // was deleted from the destination.
+    assert.eq(shard0Coll.find().itcount(), expectedNumDocsShard0After);
+
+    // Docs are gone!
+    assert.neq(testColl.find().itcount(), expectedNumDocsTotal);
+
+    st.stop();
+    MongoRunner.stopMongod(staticMongod);
+})();
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index e292320ba5..5eb13317b5 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -500,7 +500,8 @@ Status MigrationSourceManager::commitChunkMetadataOnConfig(OperationContext* opC
     // and subsequent callers will try to do a full refresh.
     const auto refreshStatus = [&] {
         try {
-            forceShardFilteringMetadataRefresh(opCtx, getNss(), true);
+            uasserted(ErrorCodes::InternalError, "repro");
+            // forceShardFilteringMetadataRefresh(opCtx, getNss(), true);
             return Status::OK();
         } catch (const DBException& ex) {
             return ex.toStatus();
