SERVER-119395 Fix migration_fails_with_spurious_documents.js (#48782)
GitOrigin-RevId: a03988582946da0b6dab5cb3325f46e25f96df82
This commit is contained in:
committed by
MongoDB Bot
parent
4c2a44ef49
commit
c4e738bd72
@@ -387,9 +387,14 @@ assert.commandWorked(admin.runCommand({enableSharding: "test", primaryShard: st.
|
||||
);
|
||||
|
||||
// Find a chunk we can move that would conflict with our spurious document.
|
||||
const hashedValue = convertShardKeyToHashed(testUserId);
|
||||
let targetChunk = null;
|
||||
for (let chunk of hashedChunks) {
|
||||
if (chunk.shard === targetShard) {
|
||||
if (chunk.shard !== targetShard) {
|
||||
continue;
|
||||
}
|
||||
if (bsonWoCompare(chunk.min.user_id, hashedValue) <= 0 &&
|
||||
bsonWoCompare(chunk.max.user_id, hashedValue) > 0) {
|
||||
targetChunk = chunk;
|
||||
break;
|
||||
}
|
||||
@@ -404,7 +409,7 @@ assert.commandWorked(admin.runCommand({enableSharding: "test", primaryShard: st.
|
||||
let hashedMoveResult = admin.runCommand({
|
||||
moveChunk: hashedColl.getFullName(),
|
||||
bounds: [targetChunk.min, targetChunk.max],
|
||||
to: spuriousShardColl.getName().includes("rs0") ? st.shard1.shardName : st.shard0.shardName,
|
||||
to: targetShard === st.shard0.shardName ? st.shard1.shardName : st.shard0.shardName,
|
||||
_waitForDelete: true,
|
||||
});
|
||||
|
||||
@@ -433,7 +438,7 @@ assert.commandWorked(admin.runCommand({enableSharding: "test", primaryShard: st.
|
||||
hashedMoveResult = admin.runCommand({
|
||||
moveChunk: hashedColl.getFullName(),
|
||||
bounds: [targetChunk.min, targetChunk.max],
|
||||
to: spuriousShardColl.getName().includes("rs0") ? st.shard1.shardName : st.shard0.shardName,
|
||||
to: targetShard === st.shard0.shardName ? st.shard1.shardName : st.shard0.shardName,
|
||||
_waitForDelete: true,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user