summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2021-06-06 21:51:18 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-07 18:50:09 +0000
commit335c011f5e48416ec22eebe415a66a1d9ddb1216 (patch)
treebbc421d69c6d711557eee6f7651853f236b6204e /jstests
parent19a7a6ea85055ad43aca38e843081a278f513c3f (diff)
downloadmongo-335c011f5e48416ec22eebe415a66a1d9ddb1216.tar.gz
SERVER-56518: Only record preimages for findAndModify deletes in multi-statement transactions when the recordPreImage collection option is set.
(cherry picked from commit a2f2a57609308271b2fce1cab9bbf7f08a5eda18)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/txn_writes_during_movechunk.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/jstests/sharding/txn_writes_during_movechunk.js b/jstests/sharding/txn_writes_during_movechunk.js
index 8ad9237f24c..75432ed818c 100644
--- a/jstests/sharding/txn_writes_during_movechunk.js
+++ b/jstests/sharding/txn_writes_during_movechunk.js
@@ -15,6 +15,7 @@ assert.commandWorked(st.s0.adminCommand({shardCollection: 'test.user', key: {_id
let coll = st.s.getDB('test').user;
assert.commandWorked(coll.insert({_id: 'updateMe'}));
assert.commandWorked(coll.insert({_id: 'deleteMe'}));
+assert.commandWorked(coll.insert({_id: 'deleteMeUsingFindAndModify'}));
pauseMigrateAtStep(st.shard1, migrateStepNames.deletedPriorDataInRange);
@@ -31,6 +32,7 @@ session.startTransaction();
sessionColl.insert({_id: 'insertMe'});
sessionColl.update({_id: 'updateMe'}, {$inc: {y: 1}});
sessionColl.remove({_id: 'deleteMe'});
+sessionColl.findAndModify({query: {_id: 'deleteMeUsingFindAndModify'}, remove: true});
pauseMoveChunkAtStep(st.shard0, moveChunkStepNames.reachedSteadyState);
unpauseMigrateAtStep(st.shard1, migrateStepNames.deletedPriorDataInRange);
@@ -40,6 +42,8 @@ let recipientColl = st.rs1.getPrimary().getDB('test').user;
assert.eq(null, recipientColl.findOne({_id: 'insertMe'}));
assert.eq({_id: 'updateMe'}, recipientColl.findOne({_id: 'updateMe'}));
assert.eq({_id: 'deleteMe'}, recipientColl.findOne({_id: 'deleteMe'}));
+assert.eq({_id: 'deleteMeUsingFindAndModify'},
+ recipientColl.findOne({_id: 'deleteMeUsingFindAndModify'}));
assert.commandWorked(session.commitTransaction_forTesting());
@@ -49,6 +53,7 @@ joinMoveChunk();
assert.eq({_id: 'insertMe'}, recipientColl.findOne({_id: 'insertMe'}));
assert.eq({_id: 'updateMe', y: 1}, recipientColl.findOne({_id: 'updateMe'}));
assert.eq(null, recipientColl.findOne({_id: 'deleteMe'}));
+assert.eq(null, recipientColl.findOne({_id: 'deleteMeUsingFindAndModify'}));
assert.eq(null, recipientColl.findOne({x: 1}));