Skip to content

Commit

Permalink
SERVER-64241: Make ttlMonitorSleepSecs change effective immediately. …
Browse files Browse the repository at this point in the history
…Speedup timeseries_expire.js
  • Loading branch information
ykangpark authored and Evergreen Agent committed Mar 30, 2022
1 parent b52ac90 commit 84befbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 0 additions & 4 deletions buildscripts/resmokeconfig/suites/cst_jscore_passthrough.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
})();

0 comments on commit 84befbc

Please sign in to comment.