diff options
author | David Percy <david.percy@mongodb.com> | 2022-02-18 19:04:56 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-23 17:35:53 +0000 |
commit | 687a404519f8c83e494aa3523aed7ef9d0784bff (patch) | |
tree | cef7cf62afb6b2327134dd7ca09e4bdda66c75bb | |
parent | 4fbd687691a4d6c2ab8c82f8023f6e7f1e504355 (diff) | |
download | mongo-687a404519f8c83e494aa3523aed7ef9d0784bff.tar.gz |
SERVER-63841 Disable time-series metric indexes
This reverts commit f44d4a644c49e2370d4dfe1792dda5855d5d67ad.
This reverts commit 0d6e7a4a1a035b57178458c341578260f956977c.
(cherry picked from commit 239052f6e878dcf0892a8ae33b9e69c30a6ffc6d)
-rw-r--r-- | src/mongo/db/catalog/multi_index_block.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_parameters.idl | 3 | ||||
-rw-r--r-- | src/mongo/db/timeseries/timeseries_index_schema_conversion_functions_test.cpp | 77 |
3 files changed, 36 insertions, 49 deletions
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp index 84dd6a29067..1ad98278b22 100644 --- a/src/mongo/db/catalog/multi_index_block.cpp +++ b/src/mongo/db/catalog/multi_index_block.cpp @@ -52,7 +52,6 @@ #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/repl/tenant_migration_conflict_info.h" #include "mongo/db/storage/storage_options.h" -#include "mongo/db/storage/storage_parameters_gen.h" #include "mongo/db/storage/write_unit_of_work.h" #include "mongo/db/timeseries/timeseries_constants.h" #include "mongo/db/timeseries/timeseries_index_schema_conversion_functions.h" @@ -272,10 +271,10 @@ StatusWith<std::vector<BSONObj>> MultiIndexBlock::init( info = statusWithInfo.getValue(); indexInfoObjs.push_back(info); + // TODO SERVER-54592: Remove FCV check once feature flag is enabled. boost::optional<TimeseriesOptions> options = collection->getTimeseriesOptions(); if (options && - feature_flags::gTimeseriesMetricIndexes.isEnabled( - serverGlobalParams.featureCompatibility) && + serverGlobalParams.featureCompatibility.isFCVUpgradingToOrAlreadyLatest() && timeseries::doesBucketsIndexIncludeMeasurement( opCtx, collection->ns(), *options, info)) { invariant(collection->getTimeseriesBucketsMayHaveMixedSchemaData()); diff --git a/src/mongo/db/storage/storage_parameters.idl b/src/mongo/db/storage/storage_parameters.idl index 5b2366d6eae..c6b658e249b 100644 --- a/src/mongo/db/storage/storage_parameters.idl +++ b/src/mongo/db/storage/storage_parameters.idl @@ -129,8 +129,7 @@ feature_flags: featureFlagTimeseriesMetricIndexes: description: "When enabled, support secondary indexes on time-series measurements" cpp_varname: feature_flags::gTimeseriesMetricIndexes - default: true - version: 5.3 + default: false featureFlagTimeseriesBucketCompression: description: "Enable bucket compression on time-series collections" cpp_varname: feature_flags::gTimeseriesBucketCompression diff --git a/src/mongo/db/timeseries/timeseries_index_schema_conversion_functions_test.cpp b/src/mongo/db/timeseries/timeseries_index_schema_conversion_functions_test.cpp index 88a2fd76b7d..49b08dc4fc6 100644 --- a/src/mongo/db/timeseries/timeseries_index_schema_conversion_functions_test.cpp +++ b/src/mongo/db/timeseries/timeseries_index_schema_conversion_functions_test.cpp @@ -49,10 +49,8 @@ const std::string kControlMinTimeFieldName(timeseries::kControlMinFieldNamePrefi const std::string kControlMaxTimeFieldName(timeseries::kControlMaxFieldNamePrefix + kTimeseriesTimeFieldName); const std::string kTimeseriesSomeDataFieldName("somedatafield"); -const std::string kControlMinSomeDataFieldName(timeseries::kControlMinFieldNamePrefix + - kTimeseriesSomeDataFieldName); -const std::string kControlMaxSomeDataFieldName(timeseries::kControlMaxFieldNamePrefix + - kTimeseriesSomeDataFieldName); +const std::string kBucketsSomeDataFieldName(timeseries::kBucketDataFieldName + "." + + kTimeseriesSomeDataFieldName); /** * Constructs a TimeseriesOptions object for testing. @@ -155,16 +153,14 @@ TEST(TimeseriesIndexSchemaConversionTest, DescendingTimeIndexSpecConversion) { testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); } -// {tm.subfield1: 1} <=> {control.min.tm.subfield1: 1, control.max.tm.subfield1: 1} -// This case is probably not useful, because 'tm' is always a Date, which can't have subfields. -// Presumably it works because we treat 'tm' similarly to other non-metadata fields. -TEST(TimeseriesIndexSchemaConversionTest, TimeSubFieldIndexSpecConversion) { +// {tm.subfield1: 1} <=> {tm.subfield1: 1} +TEST(TimeseriesIndexSchemaConversionTest, TimeSubFieldIndexSpecConversionFails) { TimeseriesOptions timeseriesOptions = makeTimeseriesOptions(); BSONObj timeseriesIndexSpec = BSON(kTimeseriesTimeFieldName + kSubField1Name << 1); - BSONObj bucketsIndexSpec = BSON(kControlMinTimeFieldName + kSubField1Name - << 1 << kControlMaxTimeFieldName + kSubField1Name << 1); + BSONObj bucketsIndexSpec = BSON(kTimeseriesTimeFieldName + kSubField1Name << 1); - testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); + testBothWaysIndexSpecConversion( + timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec, false /* testShouldSucceed */); } // {mm: 1} <=> {meta: 1} @@ -220,69 +216,62 @@ TEST(TimeseriesIndexSchemaConversionTest, MetadataAndTimeCompoundIndexSpecConver testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); } -// {somedatafield: 1} <=> {control.min.somedatafield: 1, control.max.somedatafield: 1} -TEST(TimeseriesIndexSchemaConversionTest, DataIndexSpecConversion) { +// {somedatafield: 1} <=> {data.somedatafield: 1} +TEST(TimeseriesIndexSchemaConversionTest, DataIndexSpecConversionFails) { TimeseriesOptions timeseriesOptions = makeTimeseriesOptions(); BSONObj timeseriesIndexSpec = BSON(kTimeseriesSomeDataFieldName << 1); - BSONObj bucketsIndexSpec = - BSON(kControlMinSomeDataFieldName << 1 << kControlMaxSomeDataFieldName << 1); + BSONObj bucketsIndexSpec = BSON(kBucketsSomeDataFieldName << 1); - testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); + testBothWaysIndexSpecConversion( + timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec, false /* testShouldSucceed */); } -// {tm: 1, somedatafield: 1} <=> -// {control.min.tm: 1, control.max.tm: 1, -// control.min.somedatafield: 1, control.max.somedatafield: 1} -TEST(TimeseriesIndexSchemaConversionTest, TimeAndDataCompoundIndexSpecConversion) { +// {tm: 1, somedatafield: 1} <=> {control.min.tm: 1, control.max.tm: 1, data.somedatafield: 1} +TEST(TimeseriesIndexSchemaConversionTest, TimeAndDataCompoundIndexSpecConversionFails) { TimeseriesOptions timeseriesOptions = makeTimeseriesOptions(); BSONObj timeseriesIndexSpec = BSON(kTimeseriesTimeFieldName << 1 << kTimeseriesSomeDataFieldName << 1); BSONObj bucketsIndexSpec = BSON(kControlMinTimeFieldName << 1 << kControlMaxTimeFieldName << 1 - << kControlMinSomeDataFieldName << 1 - << kControlMaxSomeDataFieldName << 1); + << kBucketsSomeDataFieldName << 1); - testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); + testBothWaysIndexSpecConversion( + timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec, false /* testShouldSucceed */); } -// {somedatafield: 1, tm: 1} <=> -// {control.min.somedatafield: 1, control.max.somedatafield: 1, -// control.min.tm: 1, control.max.tm: 1} -TEST(TimeseriesIndexSchemaConversionTest, DataAndTimeCompoundIndexSpecConversion) { +// {somedatafield: 1, tm: 1} <=> {data.somedatafield: 1, control.min.tm: 1, control.max.tm: 1} +TEST(TimeseriesIndexSchemaConversionTest, DataAndTimeCompoundIndexSpecConversionFails) { TimeseriesOptions timeseriesOptions = makeTimeseriesOptions(); BSONObj timeseriesIndexSpec = BSON(kTimeseriesSomeDataFieldName << 1 << kTimeseriesTimeFieldName << 1); - BSONObj bucketsIndexSpec = - BSON(kControlMinSomeDataFieldName << 1 << kControlMaxSomeDataFieldName << 1 - << kControlMinTimeFieldName << 1 - << kControlMaxTimeFieldName << 1); + BSONObj bucketsIndexSpec = BSON(kBucketsSomeDataFieldName << 1 << kControlMinTimeFieldName << 1 + << kControlMaxTimeFieldName << 1); - testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); + testBothWaysIndexSpecConversion( + timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec, false /* testShouldSucceed */); } -// {mm: 1, somedatafield: 1} <=> {meta: 1, control.min.somedatafield: 1, control.max.somedatafield: -// 1} -TEST(TimeseriesIndexSchemaConversionTest, MetadataAndDataCompoundIndexSpecConversion) { +// {mm: 1, somedatafield: 1} <=> {meta: 1, data.somedatafield: 1} +TEST(TimeseriesIndexSchemaConversionTest, MetadataAndDataCompoundIndexSpecConversionFails) { TimeseriesOptions timeseriesOptions = makeTimeseriesOptions(); BSONObj timeseriesIndexSpec = BSON(kTimeseriesMetaFieldName << 1 << kTimeseriesSomeDataFieldName << 1); BSONObj bucketsIndexSpec = - BSON(timeseries::kBucketMetaFieldName << 1 << kControlMinSomeDataFieldName << 1 - << kControlMaxSomeDataFieldName << 1); + BSON(timeseries::kBucketMetaFieldName << 1 << kBucketsSomeDataFieldName << 1); - testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); + testBothWaysIndexSpecConversion( + timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec, false /* testShouldSucceed */); } -// {somedatafield: 1, mm: 1} <=> -// {control.min.somedatafield: 1, control.max.somedatafield: 1, meta: 1} -TEST(TimeseriesIndexSchemaConversionTest, DataAndMetadataCompoundIndexSpecConversion) { +// {somedatafield: 1, mm: 1} <=> {data.somedatafield: 1, meta: 1} +TEST(TimeseriesIndexSchemaConversionTest, DataAndMetadataCompoundIndexSpecConversionFails) { TimeseriesOptions timeseriesOptions = makeTimeseriesOptions(); BSONObj timeseriesIndexSpec = BSON(kTimeseriesSomeDataFieldName << 1 << kTimeseriesMetaFieldName << 1); BSONObj bucketsIndexSpec = - BSON(kControlMinSomeDataFieldName << 1 << kControlMaxSomeDataFieldName << 1 - << timeseries::kBucketMetaFieldName << 1); + BSON(kBucketsSomeDataFieldName << 1 << timeseries::kBucketMetaFieldName << 1); - testBothWaysIndexSpecConversion(timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec); + testBothWaysIndexSpecConversion( + timeseriesOptions, timeseriesIndexSpec, bucketsIndexSpec, false /* testShouldSucceed */); } // {mm.subfield1: 1, mm.subfield2: 1, mm.foo:1, mm.bar: 1, mm.baz: 1, tm: 1} <=> |