diff --git a/jstests/concurrency/fsm_workloads/internal_transactions_sharded_from_mongod.js b/jstests/concurrency/fsm_workloads/internal_transactions_sharded_from_mongod.js index 7bff3de2795..5cff0aefb2b 100644 --- a/jstests/concurrency/fsm_workloads/internal_transactions_sharded_from_mongod.js +++ b/jstests/concurrency/fsm_workloads/internal_transactions_sharded_from_mongod.js @@ -108,15 +108,6 @@ export const $config = extendWorkload($baseConfig, function($config, $super) { print("Starting new sessions after internal transaction error: " + tojsononeline(e)); this.startSessions(defaultDb); - // When causal consistency is required, the verifyDocuments state would perform - // reads against mongos with afterClusterTime equal to the max of the clusterTimes - // of all sessions that it has created on the shard that it uses to run internal - // transactions from. Bump the clusterTime on the mongos after the shard has - // recovered so that the mongos can gossip the clusterTime correctly to the other - // shard; otherwise when the next state is the verifyDocuments state, the - // afterClusterTime in the command could be higher than the clusterTime known to - // that shard and that would cause the command to fail. - this.bumpClusterTime(defaultDb, collName); return; } throw e; diff --git a/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js b/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js index 790ba9f074f..5b84be4e691 100644 --- a/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js +++ b/jstests/concurrency/fsm_workloads/internal_transactions_unsharded.js @@ -639,6 +639,14 @@ export function extendWithInternalTransactionsUnsharded($config, $super) { // The read below should not be done inside a transaction (and use readConcern level // "snapshot"). fsm.forceRunningOutsideTransaction(this); + const session = db.getMongo().startSession(); + const sessionDb = session.getDatabase(db.getName()); + for (const s of this.sessions) { + if (s.getClusterTime() !== undefined) + session.advanceClusterTime(s.getClusterTime()); + if (s.getClusterTime() !== undefined) + session.advanceOperationTime(s.getOperationTime()); + } const numDocsExpected = Object.keys(this.expectedCounters).length; const findCmdObj = { @@ -652,7 +660,7 @@ export function extendWithInternalTransactionsUnsharded($config, $super) { findCmdObj.readConcern.level = "majority"; } } - const docs = assert.commandWorked(db.runCommand(findCmdObj)).cursor.firstBatch; + const docs = assert.commandWorked(sessionDb.runCommand(findCmdObj)).cursor.firstBatch; print("verifyDocuments " + tojsononeline( {findCmdObj, numDocsFound: docs.length, numDocsExpected: numDocsExpected}));