diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2021-04-12 15:13:18 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-12 15:39:09 +0000 |
commit | c7e7552a49d83a8c0db07208f6e69c541a1b9432 (patch) | |
tree | b20dcceb1da97d06706387f29ae410bcbf333601 | |
parent | d35e2a364d8ae1f71fbdf0077d918f5e1e3cdf16 (diff) | |
download | mongo-c7e7552a49d83a8c0db07208f6e69c541a1b9432.tar.gz |
SERVER-56009: Use w: majority for the initial write in read_at_cluster_time_outside_transactions.js
-rw-r--r-- | jstests/replsets/read_at_cluster_time_outside_transactions.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/jstests/replsets/read_at_cluster_time_outside_transactions.js b/jstests/replsets/read_at_cluster_time_outside_transactions.js index 1d19cca776c..31a1bc0bead 100644 --- a/jstests/replsets/read_at_cluster_time_outside_transactions.js +++ b/jstests/replsets/read_at_cluster_time_outside_transactions.js @@ -35,11 +35,15 @@ rst.nodes.forEach(conn => { assert.commandWorked(collection.insert({_id: 1, comment: "should be seen by find command"})); assert.commandWorked(collection.insert({_id: 3, comment: "should be seen by find command"})); -const earlierClusterTime = db.getSession().getOperationTime(); - -assert.commandWorked(collection.insert({_id: 5, comment: "should be seen by getMore command"})); - -const clusterTime = db.getSession().getOperationTime(); +// Insert with w: majority so that the insert timestamp is majority committed and can be used as the +// $_internalReadAtClusterTime for dbHash. +const clusterTime = assert + .commandWorked(db.runCommand({ + insert: collName, + documents: [{_id: 5, comment: "should be seen by getMore command"}], + writeConcern: {w: "majority"} + })) + .operationTime; let res = assert.commandWorked(db.runCommand({dbHash: 1})); const hashAfterOriginalInserts = { |