summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorJason Zhang <jason.zhang@mongodb.com>2020-12-15 18:54:49 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-12-16 19:06:21 +0000
commite8e23f7eda37e3736cd833a57db77c51b8166c22 (patch)
treea4e5230602401b91c3d5ca9d70cae2b3f1cd8017 /jstests
parent04401a326046babcb390cc444f52699f732b3b2f (diff)
downloadmongo-e8e23f7eda37e3736cd833a57db77c51b8166c22.tar.gz
SERVER-53368 Fix indexing in the retry logic in tenant migration passthrough suite
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/override_methods/inject_tenant_prefix.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/jstests/libs/override_methods/inject_tenant_prefix.js b/jstests/libs/override_methods/inject_tenant_prefix.js
index c12220e605c..ca2130a7e10 100644
--- a/jstests/libs/override_methods/inject_tenant_prefix.js
+++ b/jstests/libs/override_methods/inject_tenant_prefix.js
@@ -346,6 +346,8 @@ Mongo.prototype.runCommand = function(dbName, cmdObj, options) {
if (resObj.upserted) {
for (let upsert of resObj.upserted) {
+ let currentUpsertedIndex = upsert.index;
+
// Set the entry's index to the write's index in the original cmdObj.
upsert.index = indexMap[upsert.index];
@@ -353,7 +355,7 @@ Mongo.prototype.runCommand = function(dbName, cmdObj, options) {
upserted.push(upsert);
// This write will not need to be retried, so remove it from 'indexMap'.
- delete indexMap[upsert.index];
+ delete indexMap[currentUpsertedIndex];
}
}
if (resObj.writeErrors) {
@@ -364,6 +366,8 @@ Mongo.prototype.runCommand = function(dbName, cmdObj, options) {
break;
}
+ let currentWriteErrorIndex = writeError.index;
+
// Set the entry's index to the write's index in the original cmdObj.
writeError.index = indexMap[writeError.index];
@@ -371,7 +375,7 @@ Mongo.prototype.runCommand = function(dbName, cmdObj, options) {
nonRetryableWriteErrors.push(writeError);
// This write will not need to be retried, so remove it from 'indexMap'.
- delete indexMap[writeError.index];
+ delete indexMap[currentWriteErrorIndex];
}
}
}