Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
diff --git a/repro_resharding_write_before_temp_ns_refresh.js b/repro_resharding_write_before_temp_ns_refresh.js
new file mode 100644
index 0000000000..7012fae165
--- /dev/null
+++ b/repro_resharding_write_before_temp_ns_refresh.js
@@ -0,0 +1,33 @@
+(function() {
+"use strict";
+
+load("jstests/sharding/libs/resharding_test_fixture.js");
+
+const reshardingTest = new ReshardingTest({numDonors: 2, numRecipients: 2, reshardInPlace: true});
+reshardingTest.setup();
+
+const donorShardNames = reshardingTest.donorShardNames;
+const sourceCollection = reshardingTest.createShardedCollection({
+ ns: "reshardingDb.coll",
+ shardKeyPattern: {oldKey: 1},
+ chunks: [
+ {min: {oldKey: MinKey}, max: {oldKey: 10}, shard: donorShardNames[0]},
+ {min: {oldKey: 10}, max: {oldKey: MaxKey}, shard: donorShardNames[1]},
+ ],
+});
+
+const recipientShardNames = reshardingTest.recipientShardNames;
+reshardingTest.withReshardingInBackground( + {
+ newShardKeyPattern: {newKey: 1},
+ newChunks: [
+ {min: {newKey: MinKey}, max: {newKey: 10}, shard: recipientShardNames[0]},
+ {min: {newKey: 10}, max: {newKey: MaxKey}, shard: recipientShardNames[1]},
+ ],
+ },
+ () => {
+ assert.commandWorked(sourceCollection.insert({_id: 0, oldKey: 5, newKey: 15}));
+ });
+
+reshardingTest.teardown();
+})();
diff --git a/src/mongo/db/s/resharding/resharding_donor_service.cpp b/src/mongo/db/s/resharding/resharding_donor_service.cpp
index 2a7200f38e..6ba5aa0973 100644
--- a/src/mongo/db/s/resharding/resharding_donor_service.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_service.cpp
@@ -263,6 +263,8 @@ void ReshardingDonorService::DonorStateMachine::
->assertNoIndexBuildInProgForCollection(_donorDoc.getExistingUUID());
}
+ sleepsecs(10);
+