diff options
4 files changed, 75 insertions, 0 deletions
diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml index ec618e5d03f..95c712d59dd 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_kill_primary.yml @@ -163,6 +163,7 @@ selector: - jstests/concurrency/fsm_workloads/view_catalog.js - jstests/concurrency/fsm_workloads/view_catalog_cycle_with_drop.js - jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js + - jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js ## # Denylists specific to this suite diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml index 4cf2b0f8721..5d734d13c1c 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_terminate_primary.yml @@ -163,6 +163,7 @@ selector: - jstests/concurrency/fsm_workloads/view_catalog.js - jstests/concurrency/fsm_workloads/view_catalog_cycle_with_drop.js - jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js + - jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js ## # Denylists specific to this suite diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml index e65701ed958..7f22963a6c8 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_stepdowns.yml @@ -146,6 +146,7 @@ selector: - jstests/concurrency/fsm_workloads/view_catalog.js - jstests/concurrency/fsm_workloads/view_catalog_cycle_with_drop.js - jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js + - jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js ## # Denylists specific to this suite diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js b/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js new file mode 100644 index 00000000000..d1c95834941 --- /dev/null +++ b/jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_deletes.js @@ -0,0 +1,72 @@ +/** + * Extends random_moveChunk_timeseries_inserts.js workload with delete stage. Tests deletes in the + * presence of concurrent insert and moveChunk commands. + * @tags: [ + * requires_sharding, + * assumes_balancer_off, + * requires_non_retryable_writes, + * ] + */ +'use strict'; + +load('jstests/core/timeseries/libs/timeseries.js'); // For 'TimeseriesTest' helpers. +// Load parent workload for extending below. +load('jstests/concurrency/fsm_workloads/random_moveChunk_timeseries_inserts.js'); + +var $config = extendWorkload($config, function($config, $super) { + $config.data.generateMetaFieldValueForInitialInserts = () => { + let meta = {}; + // Insert a document with a field for every thread to test concurrent deletes of the + // same document. + for (let i = 0; i < $config.threadCount; i++) { + meta["tid" + i] = Random.randInt($config.data.numMetaCount); + } + return meta; + }; + + $config.data.generateMetaFieldValueForInsertStage = (tid) => { + // After the initial stage, each thread will insert documents containing only fields with + // this thread's id. This ensures we do not run into concurrency issues with concurrent + // inserts and deletes. + // NOTE: This problem does not exist for the initial set of documents, since they are + // inserted before any delete operation is issued. + return {["tid" + tid]: Random.randInt($config.data.numMetaCount)}; + }; + + $config.states.init = function init(db, collName, connCache) { + $super.states.init.call(this, db, collName, connCache); + + this.featureFlagDisabled = this.featureFlagDisabled || + !TimeseriesTest.timeseriesUpdatesAndDeletesEnabled(db) || + !TimeseriesTest.shardedTimeseriesUpdatesAndDeletesEnabled(db); + if (this.featureFlagDisabled) { + jsTestLog( + "Skipping executing this test as the requisite feature flags are not enabled."); + } + }; + + $config.states.doDelete = function doDelete(db, collName, connCache) { + if (this.featureFlagDisabled) { + return; + } + + const filter = { + m: { + ["tid" + this.tid]: { + $gte: Random.randInt($config.data.numMetaCount), + }, + }, + }; + assertAlways.commandWorked(db[collName].deleteMany(filter)); + assertAlways.commandWorked(db[this.nonShardCollName].deleteMany(filter)); + }; + + $config.transitions = { + init: {insert: 1}, + insert: {insert: 3, doDelete: 3, moveChunk: 1}, + doDelete: {insert: 3, doDelete: 3, moveChunk: 1}, + moveChunk: {insert: 1, doDelete: 1, moveChunk: 0}, + }; + + return $config; +}); |