From 84befbcce9ba114af5c2eef117042b449c2017a8 Mon Sep 17 00:00:00 2001 From: Yu Jin Kang Park Date: Wed, 30 Mar 2022 14:14:23 +0000 Subject: [PATCH] SERVER-64241: Make ttlMonitorSleepSecs change effective immediately. Speedup timeseries_expire.js --- .../suites/cst_jscore_passthrough.yml | 4 ---- .../timeseries_expire.js | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) rename jstests/{core/timeseries => noPassthrough}/timeseries_expire.js (71%) diff --git a/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml index ac000fef42d06..23a4531ca123d 100755 --- a/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml @@ -783,10 +783,6 @@ selector: - jstests/core/exists9.js - jstests/core/exists8.js - # Timeseries collection expireAfterSeconds option requires the TTL Monitor, - # which is disabled in this test configuration. - - jstests/core/timeseries/timeseries_expire.js - # TODO SERVER-54042 Time-series collection queries - jstests/core/timeseries/timeseries_bucket_limit_count.js - jstests/core/timeseries/timeseries_min_max.js diff --git a/jstests/core/timeseries/timeseries_expire.js b/jstests/noPassthrough/timeseries_expire.js similarity index 71% rename from jstests/core/timeseries/timeseries_expire.js rename to jstests/noPassthrough/timeseries_expire.js index 02f3020a6edb5..8f4ce8564e6e3 100644 --- a/jstests/core/timeseries/timeseries_expire.js +++ b/jstests/noPassthrough/timeseries_expire.js @@ -10,20 +10,25 @@ (function() { "use strict"; +load('jstests/libs/fixture_helpers.js'); // For 'FixtureHelpers' load("jstests/core/timeseries/libs/timeseries.js"); +const conn = MongoRunner.runMongod({setParameter: 'ttlMonitorSleepSecs=1'}); +const testDB = conn.getDB(jsTestName()); +assert.commandWorked(testDB.dropDatabase()); + TimeseriesTest.run((insert) => { - const coll = db.timeseries_expire; - const bucketsColl = db.getCollection('system.buckets.' + coll.getName()); + const coll = testDB.timeseries_expire; + const bucketsColl = testDB.getCollection('system.buckets.' + coll.getName()); coll.drop(); const timeFieldName = 'time'; - const expireAfterSeconds = NumberLong(5); - assert.commandWorked(db.createCollection( + const expireAfterSeconds = NumberLong(1); + assert.commandWorked(testDB.createCollection( coll.getName(), {timeseries: {timeField: timeFieldName}, expireAfterSeconds: expireAfterSeconds})); - assert.contains(bucketsColl.getName(), db.getCollectionNames()); + assert.contains(bucketsColl.getName(), testDB.getCollectionNames()); // Inserts a measurement with a time in the past to ensure the measurement will be removed // immediately. @@ -46,4 +51,6 @@ TimeseriesTest.run((insert) => { const bucketDocs = bucketsColl.find().sort({'control.min._id': 1}).toArray(); assert.eq(0, bucketDocs.length, bucketDocs); }); + +MongoRunner.stopMongod(conn); })();