forked from mongodb/mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SERVER-65644: Add test to validate batched deletes during resharding
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
})(); |