summaryrefslogtreecommitdiff
path: root/jstests/hooks
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2018-06-19 12:52:33 -0400
committerJonathan Abrahams <jonathan@mongodb.com>2018-06-26 08:32:02 -0400
commitb2cbb83011c68aa44242bc4737cca1e6951e8796 (patch)
treeb3d73990b2b40c798936a1ef906bc94676400863 /jstests/hooks
parente0e452a29e3cd4c4a8dcda6d1dd7dbdd86c684b7 (diff)
downloadmongo-b2cbb83011c68aa44242bc4737cca1e6951e8796.tar.gz
SERVER-35559 Update transaction retry functions to not call abort after commit
Diffstat (limited to 'jstests/hooks')
-rw-r--r--jstests/hooks/run_check_repl_dbhash_background.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/jstests/hooks/run_check_repl_dbhash_background.js b/jstests/hooks/run_check_repl_dbhash_background.js
index 401c5af5220..2e9c6594200 100644
--- a/jstests/hooks/run_check_repl_dbhash_background.js
+++ b/jstests/hooks/run_check_repl_dbhash_background.js
@@ -227,13 +227,21 @@
{readConcern: {level: 'snapshot', atClusterTime: clusterTime}});
}
+ let commitErrorSessionId = undefined;
hasTransientError = false;
try {
const result = checkCollectionHashesForDB(dbName);
for (let session of sessions) {
- session.commitTransaction();
+ // commitTransaction() calls assert.commandWorked(), which may fail with a
+ // WriteConflict error response, which is ignored.
+ try {
+ session.commitTransaction();
+ } catch (e) {
+ commitErrorSessionId = session.getSessionId();
+ throw e;
+ }
}
for (let mismatchInfo of result) {
@@ -242,7 +250,9 @@
}
} catch (e) {
for (let session of sessions) {
- session.abortTransaction();
+ if (session.getSessionId() !== commitErrorSessionId) {
+ session.abortTransaction();
+ }
}
if (e.hasOwnProperty('errorLabels') &&