diff options
author | Louis Williams <louis.williams@mongodb.com> | 2021-06-30 17:17:56 -0400 |
---|---|---|
committer | Louis Williams <louis.williams@mongodb.com> | 2021-07-01 13:25:23 -0400 |
commit | 83220457e522e007a5ab9dd6e690ee3b96f879e7 (patch) | |
tree | 88f67301a6617165e8dde365752c0577bd8fe4b1 /jstests | |
parent | 6d9e84f1309183faf35e33bff9d59cf264e7c707 (diff) | |
download | mongo-83220457e522e007a5ab9dd6e690ee3b96f879e7.tar.gz |
SERVER-58186 Temporarily disallow collMod from changing timeseries
collection granularity
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/timeseries/bucket_granularity.js | 55 | ||||
-rw-r--r-- | jstests/core/timeseries/bucket_timestamp_rounding.js | 30 |
2 files changed, 45 insertions, 40 deletions
diff --git a/jstests/core/timeseries/bucket_granularity.js b/jstests/core/timeseries/bucket_granularity.js index a090e7e5684..b14f56e4e7f 100644 --- a/jstests/core/timeseries/bucket_granularity.js +++ b/jstests/core/timeseries/bucket_granularity.js @@ -102,20 +102,21 @@ assert.commandWorked(coll.insert({t: ISODate("2021-04-22T21:00:00.000Z")})); assert.eq(2, db.system.buckets.granularitySecondsToMinutes.find().itcount()); + // TODO SERVER-58171: Re-enable these tests: // Now let's bump to minutes and make sure we get the expected behavior - assert.commandWorked( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'minutes'}})); + // assert.commandWorked( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'minutes'}})); // All measurements land in the same bucket. - assert.commandWorked(coll.insert({t: ISODate("2021-04-23T20:00:00.000Z")})); - assert.commandWorked(coll.insert({t: ISODate("2021-04-23T20:22:02.000Z")})); - assert.commandWorked(coll.insert({t: ISODate("2021-04-23T20:59:59.999Z")})); - assert.eq(2, db.system.buckets.granularitySecondsToMinutes.find().itcount()); + // assert.commandWorked(coll.insert({t: ISODate("2021-04-23T20:00:00.000Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-04-23T20:22:02.000Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-04-23T20:59:59.999Z")})); + // assert.eq(2, db.system.buckets.granularitySecondsToMinutes.find().itcount()); // Expect bucket max span to be one day. A new measurement outside of this range should create // a new bucket. - assert.commandWorked(coll.insert({t: ISODate("2021-04-23T21:00:00.000Z")})); - assert.eq(3, db.system.buckets.granularitySecondsToMinutes.find().itcount()); + // assert.commandWorked(coll.insert({t: ISODate("2021-04-23T21:00:00.000Z")})); + // assert.eq(3, db.system.buckets.granularitySecondsToMinutes.find().itcount()); })(); (function testIncreasingMinutesToHours() { @@ -138,41 +139,43 @@ assert.commandWorked(coll.insert({t: ISODate("2021-04-23T20:00:00.000Z")})); assert.eq(2, db.system.buckets.granularityMinutesToHours.find().itcount()); - assert.commandWorked( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'hours'}})); + // TODO SERVER-58171: Re-enable these tests: + // assert.commandWorked( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'hours'}})); // All measurements land in the same bucket. - assert.commandWorked(coll.insert({t: ISODate("2021-05-23T00:00:00.000Z")})); - assert.commandWorked(coll.insert({t: ISODate("2021-05-23T18:11:03.000Z")})); - assert.commandWorked(coll.insert({t: ISODate("2021-05-23T19:59:59.999Z")})); - assert.eq(2, db.system.buckets.granularityMinutesToHours.find().itcount()); + // assert.commandWorked(coll.insert({t: ISODate("2021-05-23T00:00:00.000Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-05-23T18:11:03.000Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-05-23T19:59:59.999Z")})); + // assert.eq(2, db.system.buckets.granularityMinutesToHours.find().itcount()); // Expect bucket max span to be 30 days. A new measurement outside of this range should create // a new bucket. - assert.commandWorked(coll.insert({t: ISODate("2021-05-23T20:00:00.001Z")})); - assert.eq(3, db.system.buckets.granularityMinutesToHours.find().itcount()); + // assert.commandWorked(coll.insert({t: ISODate("2021-05-23T20:00:00.001Z")})); + // assert.eq(3, db.system.buckets.granularityMinutesToHours.find().itcount()); })(); (function testReducingGranularityFails() { let coll = db.granularityMinutesToHours; coll.drop(); - assert.commandWorked(db.createCollection( - coll.getName(), {timeseries: {timeField: 't', granularity: 'minutes'}})); + // TODO SERVER-58171: Re-enable these tests: + // assert.commandWorked(db.createCollection( + // coll.getName(), {timeseries: {timeField: 't', granularity: 'minutes'}})); // Decreasing minutes -> seconds shouldn't work. - assert.commandFailed( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'seconds'}})); + // assert.commandFailed( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'seconds'}})); // Increasing minutes -> hours should work fine. - assert.commandWorked( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'hours'}})); + // assert.commandWorked( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'hours'}})); // Decreasing hours -> minutes shouldn't work. - assert.commandFailed( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'minutes'}})); + // assert.commandFailed( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'minutes'}})); // Decreasing hours -> seconds shouldn't work either. - assert.commandFailed( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'seconds'}})); + // assert.commandFailed( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'seconds'}})); })(); })(); diff --git a/jstests/core/timeseries/bucket_timestamp_rounding.js b/jstests/core/timeseries/bucket_timestamp_rounding.js index d3bcf8ef33c..62d584a365b 100644 --- a/jstests/core/timeseries/bucket_timestamp_rounding.js +++ b/jstests/core/timeseries/bucket_timestamp_rounding.js @@ -86,18 +86,19 @@ assert.eq(1, buckets.length); assert.eq(buckets[0].control.min.t, ISODate("2021-04-22T20:10:00.000Z")); + // TODO SERVER-58171: Re-enable these tests // Now let's bump to minutes and make sure we get the expected behavior - assert.commandWorked( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'minutes'}})); + // assert.commandWorked( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'minutes'}})); // Open a new bucket and ensure min time is rounded down to nearest hour. - assert.commandWorked(coll.insert({t: ISODate("2021-04-24T20:10:14.134Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-04-24T20:10:14.134Z")})); // And that going backwards, but after the rounding point, doesn't open another new bucket. - assert.commandWorked(coll.insert({t: ISODate("2021-04-24T20:05:00.000Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-04-24T20:05:00.000Z")})); - buckets = db.system.buckets.granularitySecondsToMinutes.find().toArray(); - assert.eq(2, buckets.length); - assert.eq(buckets[1].control.min.t, ISODate("2021-04-24T20:00:00.000Z")); + // buckets = db.system.buckets.granularitySecondsToMinutes.find().toArray(); + // assert.eq(2, buckets.length); + // assert.eq(buckets[1].control.min.t, ISODate("2021-04-24T20:00:00.000Z")); })(); (function testMinutesToHours() { @@ -116,17 +117,18 @@ assert.eq(1, buckets.length); assert.eq(buckets[0].control.min.t, ISODate("2021-04-22T20:00:00.000Z")); + // TODO SERVER-58171: Re-enable these tests // Now let's bump to minutes and make sure we get the expected behavior - assert.commandWorked( - db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'hours'}})); + // assert.commandWorked( + // db.runCommand({collMod: coll.getName(), timeseries: {granularity: 'hours'}})); // Open a new bucket and ensure min time is rounded down to nearest day. - assert.commandWorked(coll.insert({t: ISODate("2021-06-24T20:10:14.134Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-06-24T20:10:14.134Z")})); // And that going backwards, but after the rounding point, doesn't open another new bucket. - assert.commandWorked(coll.insert({t: ISODate("2021-06-24T10:00:00.000Z")})); + // assert.commandWorked(coll.insert({t: ISODate("2021-06-24T10:00:00.000Z")})); - buckets = db.system.buckets.granularityMinutesToHours.find().toArray(); - assert.eq(2, buckets.length); - assert.eq(buckets[1].control.min.t, ISODate("2021-06-24T00:00:00.000Z")); + // buckets = db.system.buckets.granularityMinutesToHours.find().toArray(); + // assert.eq(2, buckets.length); + // assert.eq(buckets[1].control.min.t, ISODate("2021-06-24T00:00:00.000Z")); })(); })(); |