diff options
15 files changed, 48 insertions, 96 deletions
diff --git a/jstests/concurrency/fsm_workload_helpers/server_types.js b/jstests/concurrency/fsm_workload_helpers/server_types.js index 1207d43e9de..7487bd53561 100644 --- a/jstests/concurrency/fsm_workload_helpers/server_types.js +++ b/jstests/concurrency/fsm_workload_helpers/server_types.js @@ -71,15 +71,6 @@ function isEphemeral(db) { } /** - * Returns true if the current storage engine supports document-level concurrency, and false - * otherwise. - */ -function supportsDocumentLevelConcurrency(db) { - var engine = getStorageEngineName(db); - return ['wiredTiger', 'rocksdb', 'inMemory'].indexOf(engine) !== -1; -} - -/** * Returns true if the current storage engine supports committed reads. * * Throws an error if db is connected to a mongos, or if there is no reported storage engine. diff --git a/jstests/concurrency/fsm_workloads/findAndModify_inc.js b/jstests/concurrency/fsm_workloads/findAndModify_inc.js index 501aed05be6..4b823bfb9c3 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_inc.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_inc.js @@ -11,7 +11,7 @@ * This workload was designed to reproduce SERVER-15892. */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -38,11 +38,11 @@ var $config = (function() { // If the document was invalidated during a yield, then we wouldn't have modified it. // The "findAndModify" command returns a null value in this case. See SERVER-22002 for // more details. - if (isMongod(db) && supportsDocumentLevelConcurrency(db)) { - // For storage engines that support document-level concurrency, if the document is - // modified by another thread during a yield, then the operation is retried - // internally. We never expect to see a null value returned by the "findAndModify" - // command when it is known that a matching document exists in the collection. + if (isMongod(db)) { + // If the document is modified by another thread during a yield, then the operation + // is retried internally. We never expect to see a null value returned by the + // "findAndModify" command when it is known that a matching document exists in the + // collection. assertWhenOwnColl(res.value !== null, 'query spec should have matched a document'); } diff --git a/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js b/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js index 9be47a02525..4faefca2fd1 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js @@ -18,7 +18,7 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js'); // for $config -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = extendWorkload($config, function($config, $super) { @@ -40,11 +40,9 @@ var $config = extendWorkload($config, function($config, $super) { assertAlways.commandWorked(res); var doc = res.value; - if (isMongod(db) && supportsDocumentLevelConcurrency(db)) { - // Storage engines which do not support document-level concurrency will not - // automatically retry if there was a conflict, so it is expected that it may return - // null in the case of a conflict. All other storage engines should automatically - // retry the operation, and thus should never return null. + if (isMongod(db)) { + // Storage engines should automatically retry the operation, and thus should never + // return null. assertWhenOwnColl.neq(doc, null, 'findAndModify should have found a matching document'); } if (doc !== null) { diff --git a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js index 8066810489f..6c49a7cc249 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js @@ -11,7 +11,7 @@ * This workload was designed to reproduce SERVER-18304. */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -62,11 +62,9 @@ var $config = (function() { assertAlways.commandWorked(res); var doc = res.value; - if (isMongod(db) && supportsDocumentLevelConcurrency(db)) { - // Storage engines which do not support document-level concurrency will not - // automatically retry if there was a conflict, so it is expected that it may return - // null in the case of a conflict. All other storage engines should automatically - // retry the operation, and thus should never return null. + if (isMongod(db)) { + // Storage engines should automatically retry the operation, and thus should never + // return null. assertWhenOwnColl.neq( doc, null, 'findAndModify should have found and removed a matching document'); } @@ -108,11 +106,10 @@ var $config = (function() { var ownedDB = db.getSiblingDB(db.getName() + this.uniqueDBName); if (this.opName === 'removed') { - if (isMongod(db) && supportsDocumentLevelConcurrency(db)) { - // On storage engines which support document-level concurrency, each findAndModify - // should be internally retried until it removes exactly one document. Since - // this.numDocs == this.iterations * this.threadCount, there should not be any - // documents remaining. + if (isMongod(db)) { + // Each findAndModify should be internally retried until it removes exactly one + // document. Since this.numDocs == this.iterations * this.threadCount, there should + // not be any documents remaining. assertWhenOwnColl.eq(db[collName].find().itcount(), 0, 'Expected all documents to have been removed'); diff --git a/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js b/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js index 550ad25c809..6937756ed0f 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js @@ -14,7 +14,7 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js'); // for $config -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = extendWorkload($config, function($config, $super) { @@ -45,11 +45,9 @@ var $config = extendWorkload($config, function($config, $super) { assertAlways.commandWorked(res); var doc = res.value; - if (isMongod(db) && supportsDocumentLevelConcurrency(db)) { - // Storage engines which do not support document-level concurrency will not - // automatically retry if there was a conflict, so it is expected that it may - // return null in the case of a conflict. All other storage engines should - // automatically retry the operation, and thus should never return null. + if (isMongod(db)) { + // Storage engines should automatically retry the operation, and thus should never + // return null. assertWhenOwnColl.neq( doc, null, 'findAndModify should have found and updated a matching document'); } diff --git a/jstests/concurrency/fsm_workloads/update_array.js b/jstests/concurrency/fsm_workloads/update_array.js index 661656e829d..457392279fd 100644 --- a/jstests/concurrency/fsm_workloads/update_array.js +++ b/jstests/concurrency/fsm_workloads/update_array.js @@ -10,7 +10,7 @@ * update and the find, because thread ids are unique. */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -21,10 +21,8 @@ var $config = (function() { function assertUpdateSuccess(db, res, nModifiedPossibilities) { assertAlways.eq(0, res.nUpserted, tojson(res)); - if (isMongod(db) && supportsDocumentLevelConcurrency(db)) { - // Storage engines which support document-level concurrency will automatically retry - // any operations when there are conflicts, so the update should have succeeded if - // a matching document existed. + if (isMongod(db)) { + // The update should have succeeded if a matching document existed. assertWhenOwnColl.contains(1, nModifiedPossibilities, tojson(res)); if (db.getMongo().writeMode() === 'commands') { assertWhenOwnColl.contains(res.nModified, nModifiedPossibilities, tojson(res)); diff --git a/jstests/concurrency/fsm_workloads/update_inc.js b/jstests/concurrency/fsm_workloads/update_inc.js index 5eedadeedbf..25098d46d4b 100644 --- a/jstests/concurrency/fsm_workloads/update_inc.js +++ b/jstests/concurrency/fsm_workloads/update_inc.js @@ -9,7 +9,7 @@ * of increments performed. */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -36,10 +36,9 @@ var $config = (function() { var res = db[collName].update({_id: this.id}, updateDoc); assertAlways.eq(0, res.nUpserted, tojson(res)); - 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. + if (isMongod(db)) { + // Storage engines will automatically retry any operations when there are conflicts, + // so we should always see a matching document. assertWhenOwnColl.eq(res.nMatched, 1, tojson(res)); if (db.getMongo().writeMode() === 'commands') { assertWhenOwnColl.eq(res.nModified, 1, tojson(res)); diff --git a/jstests/concurrency/fsm_workloads/update_multifield.js b/jstests/concurrency/fsm_workloads/update_multifield.js index cd1d0dd172e..25be0291c5a 100644 --- a/jstests/concurrency/fsm_workloads/update_multifield.js +++ b/jstests/concurrency/fsm_workloads/update_multifield.js @@ -7,7 +7,7 @@ * The collection has an index for each field, and a compound index for all fields. */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -78,10 +78,9 @@ var $config = (function() { assertResult: function(res, db, collName, query) { assertAlways.eq(0, res.nUpserted, tojson(res)); - 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. + if (isMongod(db)) { + // Storage engines will automatically retry any operations when there are + // conflicts, so we should always see a matching document. assertWhenOwnColl.eq(res.nMatched, 1, tojson(res)); if (db.getMongo().writeMode() === 'commands') { assertWhenOwnColl.eq(res.nModified, 1, tojson(res)); diff --git a/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js b/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js index 06c2c2907ba..863a9deac7c 100644 --- a/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js +++ b/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js @@ -11,7 +11,7 @@ * Uses an ordered, bulk operation to perform the updates. */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -45,10 +45,9 @@ var $config = (function() { // our collection scan or index scan. assertWhenOwnColl.eq(this.docCount, docs.length); - if (isMongod(db) && supportsDocumentLevelConcurrency(db)) { - // Storage engines which support document-level concurrency will automatically retry - // any operations when there are conflicts, so we should have updated all matching - // documents. + if (isMongod(db)) { + // Storage engines will automatically retry any operations when there are conflicts, + // so we should have updated all matching documents. docs.forEach(function(doc) { assertWhenOwnColl.eq(this.count, doc[this.fieldName]); }, this); diff --git a/jstests/concurrency/fsm_workloads/update_replace.js b/jstests/concurrency/fsm_workloads/update_replace.js index 882e5faaa4a..c52c12f05a9 100644 --- a/jstests/concurrency/fsm_workloads/update_replace.js +++ b/jstests/concurrency/fsm_workloads/update_replace.js @@ -7,7 +7,7 @@ * The collection has indexes on some but not all fields. */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -15,10 +15,9 @@ var $config = (function() { function assertResult(db, res) { assertAlways.eq(0, res.nUpserted, tojson(res)); - 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. + if (isMongod(db)) { + // Storage engines 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 { // On storage engines that do not support document-level concurrency, it is possible diff --git a/jstests/concurrency/fsm_workloads/update_simple.js b/jstests/concurrency/fsm_workloads/update_simple.js index 75614cc4ddd..2d6754ec93a 100644 --- a/jstests/concurrency/fsm_workloads/update_simple.js +++ b/jstests/concurrency/fsm_workloads/update_simple.js @@ -9,7 +9,7 @@ * - what value to $set the field to */ -// For isMongod and supportsDocumentLevelConcurrency. +// For isMongod. load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { @@ -53,10 +53,9 @@ var $config = (function() { assertResult: function assertResult(db, res) { assertAlways.eq(0, res.nUpserted, tojson(res)); - 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. + if (isMongod(db)) { + // Storage engines 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 { // On storage engines that do not support document-level concurrency, it is diff --git a/jstests/replsets/apply_ops_concurrent_non_atomic_different_db.js b/jstests/replsets/apply_ops_concurrent_non_atomic_different_db.js index a5444cb51cb..cfd905e8f1b 100644 --- a/jstests/replsets/apply_ops_concurrent_non_atomic_different_db.js +++ b/jstests/replsets/apply_ops_concurrent_non_atomic_different_db.js @@ -3,9 +3,5 @@ load('jstests/replsets/libs/apply_ops_concurrent_non_atomic.js'); -new ApplyOpsConcurrentNonAtomicTest({ - ns1: 'test1.coll1', - ns2: 'test2.coll2', - requiresDocumentLevelConcurrency: false, -}).run(); +new ApplyOpsConcurrentNonAtomicTest({ns1: 'test1.coll1', ns2: 'test2.coll2'}).run(); }()); diff --git a/jstests/replsets/apply_ops_concurrent_non_atomic_same_collection.js b/jstests/replsets/apply_ops_concurrent_non_atomic_same_collection.js index d6346e95a3a..8fee43697cf 100644 --- a/jstests/replsets/apply_ops_concurrent_non_atomic_same_collection.js +++ b/jstests/replsets/apply_ops_concurrent_non_atomic_same_collection.js @@ -3,9 +3,5 @@ load('jstests/replsets/libs/apply_ops_concurrent_non_atomic.js'); -new ApplyOpsConcurrentNonAtomicTest({ - ns1: 'test.coll', - ns2: 'test.coll', - requiresDocumentLevelConcurrency: true, -}).run(); +new ApplyOpsConcurrentNonAtomicTest({ns1: 'test.coll', ns2: 'test.coll'}).run(); }()); diff --git a/jstests/replsets/apply_ops_concurrent_non_atomic_same_db.js b/jstests/replsets/apply_ops_concurrent_non_atomic_same_db.js index 5553aa1341a..2f4aa37199c 100644 --- a/jstests/replsets/apply_ops_concurrent_non_atomic_same_db.js +++ b/jstests/replsets/apply_ops_concurrent_non_atomic_same_db.js @@ -3,9 +3,5 @@ load('jstests/replsets/libs/apply_ops_concurrent_non_atomic.js'); -new ApplyOpsConcurrentNonAtomicTest({ - ns1: 'test.coll1', - ns2: 'test.coll2', - requiresDocumentLevelConcurrency: false, -}).run(); +new ApplyOpsConcurrentNonAtomicTest({ns1: 'test.coll1', ns2: 'test.coll2'}).run(); }()); diff --git a/jstests/replsets/libs/apply_ops_concurrent_non_atomic.js b/jstests/replsets/libs/apply_ops_concurrent_non_atomic.js index 97de2677de5..811735573c2 100644 --- a/jstests/replsets/libs/apply_ops_concurrent_non_atomic.js +++ b/jstests/replsets/libs/apply_ops_concurrent_non_atomic.js @@ -8,7 +8,6 @@ * { * ns1: <string>, * ns1: <string>, - * requiresDocumentLevelConcurrency: <bool>, * } * * ns1: @@ -19,10 +18,6 @@ * ns2: * Fully qualified namespace of second set of CRUD operations. This may be the same namespace as * ns1. As with ns1, only insert operations will be used. - * - * requiresDocumentLevelConcurrency: - * Set to true if this test case can only be run with a storage engine that supports document - * level concurrency. */ var ApplyOpsConcurrentNonAtomicTest = function(options) { 'use strict'; @@ -153,14 +148,6 @@ var ApplyOpsConcurrentNonAtomicTest = function(options) { const primary = replTest.getPrimary(); const adminDb = primary.getDB('admin'); - if (options.requiresDocumentLevelConcurrency && - !supportsDocumentLevelConcurrency(adminDb)) { - testLog('Skipping test because storage engine does not support document level ' + - 'concurrency.'); - replTest.stopSet(); - return; - } - const coll1 = primary.getCollection(options.ns1); const db1 = coll1.getDB(); const coll2 = primary.getCollection(options.ns2); |