summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
authorjinichu <jinnybyun@gmail.com>2018-07-25 14:14:54 -0400
committerjinichu <jinnybyun@gmail.com>2018-07-25 14:14:54 -0400
commit925cfae906b8b335bd657752d4b6a9297dafaaca (patch)
tree6f3d74029a63199865ae493d89e87ffb945db5c5 /jstests/sharding
parent47a7e08012f57e471dff60d1933192786b54e50d (diff)
downloadmongo-925cfae906b8b335bd657752d4b6a9297dafaaca.tar.gz
SERVER-35174 Added readConcern and readTimestamp to CurOp's transaction sub-document
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/aggregation_currentop.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/jstests/sharding/aggregation_currentop.js b/jstests/sharding/aggregation_currentop.js
index d0055e56237..ba4f94fb4de 100644
--- a/jstests/sharding/aggregation_currentop.js
+++ b/jstests/sharding/aggregation_currentop.js
@@ -720,10 +720,14 @@ TestData.skipAwaitingReplicationOnShardsBeforeCheckingUUIDs = true;
// disabled, even with 'allUsers:false'.
const session = shardAdminDB.getMongo().startSession();
+ // Run an operation prior to starting the transaction and save its operation time.
+ const sessionDB = session.getDatabase(shardTestDB.getName());
+ const res = assert.commandWorked(sessionDB.runCommand({insert: "test", documents: [{x: 1}]}));
+ const operationTime = res.operationTime;
+
const timeBeforeTransactionStarts = new ISODate();
// Start but do not complete a transaction.
- const sessionDB = session.getDatabase(shardTestDB.getName());
assert.commandWorked(sessionDB.runCommand({
insert: "test",
documents: [{_id: `txn-insert-no-auth`}],
@@ -758,6 +762,8 @@ TestData.skipAwaitingReplicationOnShardsBeforeCheckingUUIDs = true;
.toArray();
let transactionDocument = currentOp[0].transaction;
assert.eq(transactionDocument.parameters.autocommit, false);
+ assert.eq(transactionDocument.parameters.readConcern, {level: "snapshot"});
+ assert.gte(transactionDocument.readTimestamp, operationTime);
assert.gte(ISODate(transactionDocument.startWallClockTime), timeBeforeTransactionStarts);
assert.gt(transactionDocument.timeOpenMicros,
(timeBeforeCurrentOp - timeAfterTransactionStarts) * 1000);