From b521f722e9f0555c230f338bcc78c99c220beacb Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Wed, 10 Feb 2021 20:33:49 +0000 Subject: SERVER-54453 Backup and restore to exercise time-series collections --- .../concurrency_sharded_causal_consistency.yml | 3 + ...ncy_sharded_causal_consistency_and_balancer.yml | 3 + ...currency_sharded_kill_primary_with_balancer.yml | 3 + ...ncy_sharded_local_read_write_multi_stmt_txn.yml | 3 + ...cal_read_write_multi_stmt_txn_with_balancer.yml | 3 + .../suites/concurrency_sharded_multi_stmt_txn.yml | 3 + ...urrency_sharded_multi_stmt_txn_kill_primary.yml | 3 + ...cy_sharded_multi_stmt_txn_terminate_primary.yml | 3 + ...rrency_sharded_multi_stmt_txn_with_balancer.yml | 3 + ...rency_sharded_multi_stmt_txn_with_stepdowns.yml | 3 + .../suites/concurrency_sharded_replication.yml | 3 + ...ncurrency_sharded_replication_with_balancer.yml | 3 + ...ncy_sharded_terminate_primary_with_balancer.yml | 3 + .../suites/concurrency_sharded_with_stepdowns.yml | 3 + ...urrency_sharded_with_stepdowns_and_balancer.yml | 3 + .../fsm_workloads/create_timeseries_collection.js | 87 ++++++++++++++++++++++ 16 files changed, 132 insertions(+) create mode 100644 jstests/concurrency/fsm_workloads/create_timeseries_collection.js diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml index 5949fb48075..416dfbdc455 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency.yml @@ -95,6 +95,9 @@ selector: # Inserts directly into system.views using applyOps, which is not available on mongos. - jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - does_not_support_causal_consistency - assumes_balancer_on diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml index 40ae7b4ac69..9cda586c400 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_causal_consistency_and_balancer.yml @@ -104,6 +104,9 @@ selector: # Inserts directly into system.views using applyOps, which is not available on mongos. - jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - does_not_support_causal_consistency # This suite uses secondary read preference, which isn't currently compatible with transactions. diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml index faa1dce843e..b8fa833ba31 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_kill_primary_with_balancer.yml @@ -182,6 +182,9 @@ selector: - jstests/concurrency/fsm_workloads/snapshot_read_kill_op_only.js - jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - assumes_balancer_off - requires_replication diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml index c4044f40d88..e0f42dcb076 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn.yml @@ -130,6 +130,9 @@ selector: - jstests/concurrency/fsm_workloads/update_rename.js - jstests/concurrency/fsm_workloads/update_rename_noindex.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - does_not_support_causal_consistency - requires_replication diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml index ec96f2431d9..e0514612b06 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_local_read_write_multi_stmt_txn_with_balancer.yml @@ -133,6 +133,9 @@ selector: # SERVER-44160 Modify cleanupOrphaned to wait for overlapping ranges to finish - jstests/concurrency/fsm_workloads/cleanupOrphanedWhileMigrating.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - assumes_balancer_off - does_not_support_causal_consistency diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml index eb6a8f754f4..b34c8b7546c 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn.yml @@ -133,6 +133,9 @@ selector: # SERVER-44160 Modify cleanupOrphaned to wait for overlapping ranges to finish - jstests/concurrency/fsm_workloads/cleanupOrphanedWhileMigrating.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - does_not_support_causal_consistency - requires_replication 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 8aa0ee3784d..d0c6aa054d2 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 @@ -201,6 +201,9 @@ selector: - jstests/concurrency/fsm_workloads/remove_where.js - jstests/concurrency/fsm_workloads/update_where.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - requires_replication # Snapshot reads in transactions are banned on capped collections. 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 6c8c02121ae..d7d94c87166 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 @@ -201,6 +201,9 @@ selector: - jstests/concurrency/fsm_workloads/remove_where.js - jstests/concurrency/fsm_workloads/update_where.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - requires_replication # Snapshot reads in transactions are banned on capped collections. diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml index 294342b192c..a1f9ee9714e 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_multi_stmt_txn_with_balancer.yml @@ -133,6 +133,9 @@ selector: # SERVER-44160 Modify cleanupOrphaned to wait for overlapping ranges to finish - jstests/concurrency/fsm_workloads/cleanupOrphanedWhileMigrating.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - assumes_balancer_off - does_not_support_causal_consistency 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 885f6c865de..69908b4b9c7 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 @@ -178,6 +178,9 @@ selector: - jstests/concurrency/fsm_workloads/remove_where.js - jstests/concurrency/fsm_workloads/update_where.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - does_not_support_causal_consistency - requires_replication diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml index 71bf7634897..dfb0186f934 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication.yml @@ -108,6 +108,9 @@ selector: # Inserts directly into system.views using applyOps, which is not available on mongos. - jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - requires_replication - assumes_balancer_on diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml index 8a8c863d129..a6dd21ba613 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_replication_with_balancer.yml @@ -113,6 +113,9 @@ selector: # Inserts directly into system.views using applyOps, which is not available on mongos. - jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - assumes_balancer_off - requires_replication diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml index fa6c78b2ee5..eb4173987bf 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_terminate_primary_with_balancer.yml @@ -182,6 +182,9 @@ selector: - jstests/concurrency/fsm_workloads/snapshot_read_kill_op_only.js - jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - assumes_balancer_off - requires_replication diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml index a65c5d559c1..7f6b314d8d1 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns.yml @@ -169,6 +169,9 @@ selector: - jstests/concurrency/fsm_workloads/snapshot_read_kill_op_only.js - jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - requires_replication - requires_non_retryable_writes diff --git a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml index 413fa17a469..2b96783d814 100644 --- a/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml +++ b/buildscripts/resmokeconfig/suites/concurrency_sharded_with_stepdowns_and_balancer.yml @@ -177,6 +177,9 @@ selector: # SERVER-44160 Modify cleanupOrphaned to wait for overlapping ranges to finish - jstests/concurrency/fsm_workloads/cleanupOrphanedWhileMigrating.js + # Time-series collections are not supported on mongos. + - jstests/concurrency/fsm_workloads/create_timeseries_collection.js + exclude_with_any_tags: - assumes_balancer_off - requires_replication diff --git a/jstests/concurrency/fsm_workloads/create_timeseries_collection.js b/jstests/concurrency/fsm_workloads/create_timeseries_collection.js new file mode 100644 index 00000000000..ed28e29966c --- /dev/null +++ b/jstests/concurrency/fsm_workloads/create_timeseries_collection.js @@ -0,0 +1,87 @@ +"use strict"; + +load("jstests/core/timeseries/libs/timeseries.js"); + +/** + * Repeatedly creates a time-series collection, inserts data and drops it. + * + * @tags: [ + * assumes_no_implicit_collection_creation_after_drop, + * does_not_support_stepdowns, + * requires_fcv_49, + * sbe_incompatible, + * ] + */ +var $config = (function() { + var data = {prefix: "create_timeseries_collection", supportsTimeseriesCollections: false}; + + var states = (function() { + function getCollectionName(prefix, collName, tid) { + return prefix + "_" + collName + "_" + tid; + } + + function init(db, collName) { + this.num = 0; + + if (TimeseriesTest.timeseriesCollectionsEnabled(db.getMongo())) { + this.supportsTimeseriesCollections = true; + return; + } + + jsTestLog("Skipping test because the time-series collection feature flag is disabled"); + } + + function create(db, collName) { + if (!this.supportsTimeseriesCollections) { + return; + } + + collName = getCollectionName(this.prefix, collName, this.tid); + + const timeFieldName = "time"; + assertAlways.commandWorked( + db.createCollection(collName, {timeseries: {timeField: timeFieldName}})); + } + + function insert(db, collName) { + if (!this.supportsTimeseriesCollections) { + return; + } + + collName = getCollectionName(this.prefix, collName, this.tid); + + const coll = db.getCollection(collName); + assertAlways.commandWorked(coll.insert({ + _id: this.num, + measurement: "measurement", + time: ISODate(), + })); + } + + function drop(db, collName) { + if (!this.supportsTimeseriesCollections) { + return; + } + + collName = getCollectionName(this.prefix, collName, this.tid); + db.getCollection(collName).drop(); + } + + return {init: init, create: create, insert: insert, drop: drop}; + })(); + + var transitions = { + init: {create: 1}, + create: {insert: 0.8, drop: 0.2}, + insert: {insert: 0.8, drop: 0.2}, + drop: {create: 1} + }; + + return { + threadCount: 4, + iterations: 1000, + data: data, + states: states, + transitions: transitions, + }; +})(); -- cgit v1.2.1