summaryrefslogtreecommitdiff
path: root/jstests/concurrency/fsm_workloads/update_simple.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/concurrency/fsm_workloads/update_simple.js')
-rw-r--r--jstests/concurrency/fsm_workloads/update_simple.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/jstests/concurrency/fsm_workloads/update_simple.js b/jstests/concurrency/fsm_workloads/update_simple.js
index ae694ace309..85f877e6090 100644
--- a/jstests/concurrency/fsm_workloads/update_simple.js
+++ b/jstests/concurrency/fsm_workloads/update_simple.js
@@ -8,7 +8,9 @@
* - whether to $set or $unset its field
* - what value to $set the field to
*/
-load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongod and isMMAPv1
+
+// For isMongod and supportsDocumentLevelConcurrency.
+load('jstests/concurrency/fsm_workload_helpers/server_types.js');
var $config = (function() {
@@ -55,13 +57,16 @@ var $config = (function() {
assertResult: function assertResult(db, res) {
assertAlways.eq(0, res.nUpserted, tojson(res));
- if (isMongod(db) && !isMMAPv1(db)) {
- // For non-mmap storage engines we can have a strong assertion that exactly one
- // doc will be modified.
+ if (isMongod(db) && supportsDocumentLevelConcurrency(db)) {
+ // Storage engines which support document-level concurrency will automatically
+ // retry any operations when there are conflicts, so we should always see a
+ // matching document.
assertWhenOwnColl.eq(res.nMatched, 1, tojson(res));
} else {
- // Zero matches are possible for MMAP v1 because the update will skip a document
- // that was invalidated during a yield.
+ // On storage engines that do not support document-level concurrency, it is
+ // possible that the query will not find the document. This can happen if
+ // another thread updated the target document during a yield, triggering an
+ // invalidation.
assertWhenOwnColl.contains(res.nMatched, [0, 1], tojson(res));
}