summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2022-04-28 14:39:22 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-28 15:58:38 +0000
commite8d7622148929030c03e6d5b7b4a7c9c3b2f3e76 (patch)
treeb54340b1775917c7c28a30b33d8355a1fd99a0a9
parentcdee5f5d2222b8cc56132a7e089b0f0f54880f63 (diff)
downloadmongo-e8d7622148929030c03e6d5b7b4a7c9c3b2f3e76.tar.gz
SERVER-66033 All newly created time-series collections default to timeseriesBucketsMayHaveMixedSchemaData=false
-rw-r--r--jstests/multiVersion/targetedTestsLastLtsFeatures/timeseries_index.js24
-rw-r--r--src/mongo/db/storage/durable_catalog_impl.cpp15
2 files changed, 28 insertions, 11 deletions
diff --git a/jstests/multiVersion/targetedTestsLastLtsFeatures/timeseries_index.js b/jstests/multiVersion/targetedTestsLastLtsFeatures/timeseries_index.js
new file mode 100644
index 00000000000..a6bca60df1a
--- /dev/null
+++ b/jstests/multiVersion/targetedTestsLastLtsFeatures/timeseries_index.js
@@ -0,0 +1,24 @@
+/**
+ * Tests that time-series measurement indexes can be created in FCV 6.0.
+ */
+(function() {
+"use strict";
+
+const rst = new ReplSetTest({nodes: 1});
+rst.startSet();
+rst.initiate();
+
+const primary = rst.getPrimary();
+
+const dbName = "test";
+const collName = "coll";
+
+const db = primary.getDB(dbName);
+
+assert.commandWorked(db.adminCommand({setFeatureCompatibilityVersion: lastLTSFCV}));
+assert.commandWorked(db.createCollection(collName, {timeseries: {timeField: "t", metaField: "m"}}));
+assert.commandWorked(db.coll.insert({t: ISODate(), m: 1}));
+assert.commandWorked(db.coll.createIndex({a: 1, t: 1}));
+
+rst.stopSet();
+}());
diff --git a/src/mongo/db/storage/durable_catalog_impl.cpp b/src/mongo/db/storage/durable_catalog_impl.cpp
index 13b86f9af07..b379c3be729 100644
--- a/src/mongo/db/storage/durable_catalog_impl.cpp
+++ b/src/mongo/db/storage/durable_catalog_impl.cpp
@@ -288,17 +288,10 @@ StatusWith<DurableCatalog::Entry> DurableCatalogImpl::_addEntry(OperationContext
md.ns = nss.ns();
md.options = options;
- // (Generic FCV reference): TODO SERVER-60912: When kLastLTS is 6.0, remove this FCV-gated
- // upgrade code.
- if (options.timeseries &&
- (serverGlobalParams.featureCompatibility.getVersion() ==
- multiversion::GenericFCV::kUpgradingFromLastLTSToLatest ||
- serverGlobalParams.featureCompatibility.getVersion() ==
- multiversion::GenericFCV::kLatest)) {
- // When upgrading FCV from kLastLTS to kLatest, all newly created catalog entries for
- // time-series collections will have this flag set to false by default as mixed-schema
- // data is only possible in versions 5.1 and earlier. We do not have to wait for FCV to
- // be fully upgraded to start this process.
+ if (options.timeseries) {
+ // All newly created catalog entries for time-series collections will have this flag set
+ // to false by default as mixed-schema data is only possible in versions 5.1 and
+ // earlier.
md.timeseriesBucketsMayHaveMixedSchemaData = false;
}
b.append("md", md.toBSON());