diff options
author | David Wang <david.wang@mongodb.com> | 2022-08-19 14:35:42 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-19 15:50:40 +0000 |
commit | 36e1574c92a0d89844c55d678e0aea5f3e4cc891 (patch) | |
tree | c0535dbd577878680225f6e270238ef511cb1c1f /jstests/noPassthroughWithMongod | |
parent | 4f09355fd05895a9d7e702469d9f52eb206f1680 (diff) | |
download | mongo-36e1574c92a0d89844c55d678e0aea5f3e4cc891.tar.gz |
SERVER-66698 Clear BucketCatalog namespaces lazily using clear registry
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r-- | jstests/noPassthroughWithMongod/timeseries_large_measurements_max_size.js | 80 | ||||
-rw-r--r-- | jstests/noPassthroughWithMongod/timeseries_server_status_measurements.js | 69 |
2 files changed, 0 insertions, 149 deletions
diff --git a/jstests/noPassthroughWithMongod/timeseries_large_measurements_max_size.js b/jstests/noPassthroughWithMongod/timeseries_large_measurements_max_size.js deleted file mode 100644 index 34039e5f281..00000000000 --- a/jstests/noPassthroughWithMongod/timeseries_large_measurements_max_size.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Tests that buckets which are kept open until the number of measurements reaches the threshold - * (timeseriesBucketMinCount) are closed when the bucket is close to the max BSON size limit. - * - * @tags: [ - * requires_collstats, - * requires_fcv_61, - * ] - */ -(function() { -"use strict"; - -load("jstests/core/timeseries/libs/timeseries.js"); // For 'TimeseriesTest'. - -const coll = db.getCollection(jsTestName()); -const bucketColl = db.getCollection("system.buckets." + jsTestName()); - -const timeFieldName = "time"; -const resetCollection = (() => { - coll.drop(); - assert.commandWorked( - db.createCollection(jsTestName(), {timeseries: {timeField: timeFieldName}})); -}); - -const areTimeseriesScalabilityImprovementsEnabled = - TimeseriesTest.timeseriesScalabilityImprovementsEnabled(db); - -const numMeasurements = 4; -const checkBucketSize = (() => { - const timeseriesStats = assert.commandWorked(coll.stats()).timeseries; - - if (areTimeseriesScalabilityImprovementsEnabled) { - // Buckets with large measurements are kept open after exceeding timeseriesBucketMaxSize - // until they have 10 measurements. However, if the bucket size were to exceed 12MB, it gets - // closed regardless. - const bucketDocs = bucketColl.find().sort({'control.min._id': 1}).toArray(); - assert.eq(2, bucketDocs.length, bucketDocs); - - // First bucket should be full with three documents. - assert.eq(0, bucketDocs[0].control.min._id); - assert.eq(2, bucketDocs[0].control.max._id); - - // Second bucket should contain the remaining document. - assert.eq(numMeasurements - 1, bucketDocs[1].control.min._id); - assert.eq(numMeasurements - 1, bucketDocs[1].control.max._id); - - assert.eq(1, timeseriesStats.numBucketsClosedDueToSize); - assert.eq(1, timeseriesStats.numBucketsKeptOpenDueToLargeMeasurements); - } else { - // Only one measurement per bucket without time-series scalability improvements. - const bucketDocs = bucketColl.find().sort({'control.min._id': 1}).toArray(); - assert.eq(numMeasurements, bucketDocs.length, bucketDocs); - - assert(!timeseriesStats.hasOwnProperty("numBucketsKeptOpenDueToLargeMeasurements")); - } -}); - -const measurementValueLength = 2 * 1024 * 1024; - -jsTestLog("Testing single inserts"); -resetCollection(); - -for (let i = 0; i < numMeasurements; i++) { - const doc = {_id: i, [timeFieldName]: ISODate(), value: "a".repeat(measurementValueLength)}; - assert.commandWorked(coll.insert(doc)); -} -checkBucketSize(); - -jsTestLog("Testing batched inserts"); -resetCollection(); - -let batch = []; -for (let i = 0; i < numMeasurements; i++) { - const doc = {_id: i, [timeFieldName]: ISODate(), value: "a".repeat(measurementValueLength)}; - batch.push(doc); -} -assert.commandWorked(coll.insertMany(batch)); - -checkBucketSize(); -}()); diff --git a/jstests/noPassthroughWithMongod/timeseries_server_status_measurements.js b/jstests/noPassthroughWithMongod/timeseries_server_status_measurements.js deleted file mode 100644 index 2d666ebf609..00000000000 --- a/jstests/noPassthroughWithMongod/timeseries_server_status_measurements.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Tests that buckets which need to be closed due to size (timeseriesBucketMaxSize) are kept open - * until the number of measurements reaches the threshold (timeseriesBucketMinCount). - * - * @tags: [ - * requires_collstats, - * requires_fcv_61, - * ] - */ -(function() { -"use strict"; - -load("jstests/core/timeseries/libs/timeseries.js"); // For 'TimeseriesTest'. - -const coll = db.getCollection(jsTestName()); - -const timeFieldName = "localTime"; -const metaFieldName = "host"; -const resetCollection = (() => { - coll.drop(); - assert.commandWorked(db.createCollection( - jsTestName(), {timeseries: {timeField: timeFieldName, metaField: metaFieldName}})); -}); - -const areTimeseriesScalabilityImprovementsEnabled = - TimeseriesTest.timeseriesScalabilityImprovementsEnabled(db); - -const numMeasurements = 50; -const checkBucketSize = (() => { - const timeseriesStats = assert.commandWorked(coll.stats()).timeseries; - - if (areTimeseriesScalabilityImprovementsEnabled) { - // Need at least 10 measurements before closing buckets exceeding timeseriesBucketMaxSize. - assert.eq(numMeasurements / 10, timeseriesStats.bucketCount); - - assert(timeseriesStats.hasOwnProperty("numBucketsKeptOpenDueToLargeMeasurements")); - assert.eq(numMeasurements / 10, timeseriesStats.numBucketsKeptOpenDueToLargeMeasurements); - } else { - // After accounting for the control.min and control.max summaries, one measurement of server - // status exceeds the bucket max size. Which means we'll only have one measurement per - // bucket. - assert.eq(numMeasurements, timeseriesStats.bucketCount); - - assert(!timeseriesStats.hasOwnProperty("numBucketsKeptOpenDueToLargeMeasurements")); - } -}); - -jsTestLog("Testing single inserts"); -resetCollection(); - -for (let i = 0; i < numMeasurements; i++) { - const doc = assert.commandWorked(db.runCommand({serverStatus: 1})); - assert.commandWorked(coll.insert(doc)); -} - -checkBucketSize(); - -jsTestLog("Testing batched inserts"); -resetCollection(); - -let batch = []; -for (let i = 0; i < numMeasurements; i++) { - const doc = assert.commandWorked(db.runCommand({serverStatus: 1})); - batch.push(doc); -} -assert.commandWorked(coll.insertMany(batch)); - -checkBucketSize(); -}()); |