Skip to content

Commit

Permalink
SERVER-65644: Add test to validate batched deletes during resharding
Browse files Browse the repository at this point in the history
  • Loading branch information
ykangpark authored and Evergreen Agent committed May 16, 2022
1 parent fbdcf79 commit 263beef
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions jstests/sharding/resharding_with_multi_deletes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Test the correctness of multi deletes during resharding.
*
* @tags: [
* requires_sharding,
* ]
*/

(function() {
"use strict";

load("jstests/sharding/libs/resharding_test_fixture.js");

const reshardingTest = new ReshardingTest();

reshardingTest.setup();

const donorShardNames = reshardingTest.donorShardNames;
const sourceCollection = reshardingTest.createShardedCollection({
ns: "reshardingDb.coll",
shardKeyPattern: {oldKey: 1},
chunks: [{min: {oldKey: MinKey}, max: {oldKey: MaxKey}, shard: donorShardNames[0]}],
});

assert.commandWorked(sourceCollection.insert([{x: 1}, {x: 3}, {x: 3}, {x: 1}]));

const recipientShardNames = reshardingTest.recipientShardNames;
reshardingTest.withReshardingInBackground(
{
newShardKeyPattern: {newKey: 1},
newChunks: [{min: {newKey: MinKey}, max: {newKey: MaxKey}, shard: recipientShardNames[0]}],
},
() => {
// We wait until cloneTimestamp has been chosen to guarantee that any subsequent writes will
// be applied by the ReshardingOplogApplier.
reshardingTest.awaitCloneTimestampChosen();

assert.commandWorked(sourceCollection.remove({x: 1}, {justOne: false}));
});
reshardingTest.teardown();
})();

0 comments on commit 263beef

Please sign in to comment.