summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenis Grebennicov <denis.grebennicov@mongodb.com>2022-07-15 14:27:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-15 15:36:46 +0000
commit6af105aa73b7e3ed88186a14a5e832434af65863 (patch)
tree9f4f8375af23d60aad7ae38a167c74b25b40b54b /src
parentbee3babbf2ef6b75667fe4e8b00219d84fdd1136 (diff)
downloadmongo-6af105aa73b7e3ed88186a14a5e832434af65863.tar.gz
SERVER-67386 Remove featureFlagChangeStreamPreAndPostImages
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp31
-rw-r--r--src/mongo/db/catalog/collection_options.cpp4
-rw-r--r--src/mongo/db/catalog/create_collection.cpp10
-rw-r--r--src/mongo/db/commands/create_command.cpp18
-rw-r--r--src/mongo/db/commands/dbcommands.cpp18
-rw-r--r--src/mongo/db/pipeline/document_source_change_stream.cpp18
-rw-r--r--src/mongo/db/pipeline/document_source_change_stream_add_post_image.cpp9
-rw-r--r--src/mongo/db/pipeline/document_source_change_stream_test.cpp39
-rw-r--r--src/mongo/db/query/query_feature_flags.idl11
-rw-r--r--src/mongo/db/repl/oplog_applier_impl_test.cpp2
10 files changed, 25 insertions, 135 deletions
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index 56011cd73e1..e731c39c0db 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -832,30 +832,17 @@ Status _collModInternal(OperationContext* opCtx,
const CollectionOptions& oldCollOptions = coll->getCollectionOptions();
- // TODO SERVER-58584: remove the feature flag.
- if (feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabled(
- serverGlobalParams.featureCompatibility)) {
- // If 'changeStreamPreAndPostImagesOptions' are enabled, 'recordPreImages' must be set
- // to false. If 'recordPreImages' is set to true, 'changeStreamPreAndPostImagesOptions'
- // must be disabled.
- if (cmrNew.changeStreamPreAndPostImagesOptions &&
- cmrNew.changeStreamPreAndPostImagesOptions->getEnabled()) {
- cmrNew.recordPreImages = false;
- }
-
- if (cmrNew.recordPreImages) {
- cmrNew.changeStreamPreAndPostImagesOptions =
- ChangeStreamPreAndPostImagesOptions(false);
- }
- } else {
- // If the FCV has changed while executing the command to the version, where the feature
- // flag is disabled, specifying changeStreamPreAndPostImagesOptions is not allowed.
- if (cmrNew.changeStreamPreAndPostImagesOptions) {
- return Status(ErrorCodes::InvalidOptions,
- "The 'changeStreamPreAndPostImages' is an unknown field.");
- }
+ // If 'changeStreamPreAndPostImagesOptions' are enabled, 'recordPreImages' must be set
+ // to false. If 'recordPreImages' is set to true, 'changeStreamPreAndPostImagesOptions'
+ // must be disabled.
+ if (cmrNew.changeStreamPreAndPostImagesOptions &&
+ cmrNew.changeStreamPreAndPostImagesOptions->getEnabled()) {
+ cmrNew.recordPreImages = false;
}
+ if (cmrNew.recordPreImages) {
+ cmrNew.changeStreamPreAndPostImagesOptions = ChangeStreamPreAndPostImagesOptions(false);
+ }
if (cmrNew.cappedSize || cmrNew.cappedMax) {
// If the current capped collection size exceeds the newly set limits, future document
// inserts will prompt document deletion.
diff --git a/src/mongo/db/catalog/collection_options.cpp b/src/mongo/db/catalog/collection_options.cpp
index 49dbe398ec7..eb7a9d4cf3c 100644
--- a/src/mongo/db/catalog/collection_options.cpp
+++ b/src/mongo/db/catalog/collection_options.cpp
@@ -439,9 +439,7 @@ void CollectionOptions::appendBSON(BSONObjBuilder* builder,
builder->appendBool(CreateCommand::kRecordPreImagesFieldName, true);
}
- // TODO SERVER-58584: remove the feature flag.
- if (feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabledAndIgnoreFCV() &&
- changeStreamPreAndPostImagesOptions.getEnabled() &&
+ if (changeStreamPreAndPostImagesOptions.getEnabled() &&
shouldAppend(CreateCommand::kChangeStreamPreAndPostImagesFieldName)) {
builder->append(CreateCommand::kChangeStreamPreAndPostImagesFieldName,
changeStreamPreAndPostImagesOptions.toBSON());
diff --git a/src/mongo/db/catalog/create_collection.cpp b/src/mongo/db/catalog/create_collection.cpp
index 5a6c1f4856d..90323d8dc82 100644
--- a/src/mongo/db/catalog/create_collection.cpp
+++ b/src/mongo/db/catalog/create_collection.cpp
@@ -480,16 +480,6 @@ Status _createCollection(OperationContext* opCtx,
return status;
}
- // If the FCV has changed while executing the command to the version, where the feature flag
- // is disabled, enabling changeStreamPreAndPostImagesOptions is not allowed.
- // TODO SERVER-58584: remove the feature flag.
- if (!feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabled(
- serverGlobalParams.featureCompatibility) &&
- collectionOptions.changeStreamPreAndPostImagesOptions.getEnabled()) {
- return Status(ErrorCodes::InvalidOptions,
- "The 'changeStreamPreAndPostImages' is an unknown field.");
- }
-
if (!collectionOptions.clusteredIndex && collectionOptions.expireAfterSeconds) {
return Status(ErrorCodes::InvalidOptions,
"'expireAfterSeconds' requires clustering to be enabled");
diff --git a/src/mongo/db/commands/create_command.cpp b/src/mongo/db/commands/create_command.cpp
index 27a871ba489..6355709b39d 100644
--- a/src/mongo/db/commands/create_command.cpp
+++ b/src/mongo/db/commands/create_command.cpp
@@ -317,19 +317,11 @@ public:
const auto isChangeStreamPreAndPostImagesEnabled =
(cmd.getChangeStreamPreAndPostImages() &&
cmd.getChangeStreamPreAndPostImages()->getEnabled());
-
- if (feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabled(
- serverGlobalParams.featureCompatibility)) {
- const auto isRecordPreImagesEnabled = cmd.getRecordPreImages().get_value_or(false);
- uassert(ErrorCodes::InvalidOptions,
- "'recordPreImages' and 'changeStreamPreAndPostImages.enabled' can not be "
- "set to true simultaneously",
- !(isChangeStreamPreAndPostImagesEnabled && isRecordPreImagesEnabled));
- } else {
- uassert(ErrorCodes::InvalidOptions,
- "BSON field 'changeStreamPreAndPostImages' is an unknown field.",
- !cmd.getChangeStreamPreAndPostImages().has_value());
- }
+ const auto isRecordPreImagesEnabled = cmd.getRecordPreImages().get_value_or(false);
+ uassert(ErrorCodes::InvalidOptions,
+ "'recordPreImages' and 'changeStreamPreAndPostImages.enabled' can not be "
+ "set to true simultaneously",
+ !(isChangeStreamPreAndPostImagesEnabled && isRecordPreImagesEnabled));
OperationShardingState::ScopedAllowImplicitCollectionCreate_UNSAFE
unsafeCreateCollection(opCtx);
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 263ae9146bd..54fca604321 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -566,19 +566,11 @@ public:
const auto isChangeStreamPreAndPostImagesEnabled =
(cmd->getChangeStreamPreAndPostImages() &&
cmd->getChangeStreamPreAndPostImages()->getEnabled());
-
- if (feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabled(
- serverGlobalParams.featureCompatibility)) {
- const auto isRecordPreImagesEnabled = cmd->getRecordPreImages().get_value_or(false);
- uassert(ErrorCodes::InvalidOptions,
- "'recordPreImages' and 'changeStreamPreAndPostImages.enabled' can not be set "
- "to true simultaneously",
- !(isChangeStreamPreAndPostImagesEnabled && isRecordPreImagesEnabled));
- } else {
- uassert(ErrorCodes::InvalidOptions,
- "BSON field 'changeStreamPreAndPostImages' is an unknown field.",
- !cmd->getChangeStreamPreAndPostImages().has_value());
- }
+ const auto isRecordPreImagesEnabled = cmd->getRecordPreImages().get_value_or(false);
+ uassert(ErrorCodes::InvalidOptions,
+ "'recordPreImages' and 'changeStreamPreAndPostImages.enabled' can not be set "
+ "to true simultaneously",
+ !(isChangeStreamPreAndPostImagesEnabled && isRecordPreImagesEnabled));
// Updating granularity on sharded time-series collections is not allowed.
if (Grid::get(opCtx)->catalogClient() && cmd->getTimeseries() &&
diff --git a/src/mongo/db/pipeline/document_source_change_stream.cpp b/src/mongo/db/pipeline/document_source_change_stream.cpp
index ec29b0b264d..82caea4c82c 100644
--- a/src/mongo/db/pipeline/document_source_change_stream.cpp
+++ b/src/mongo/db/pipeline/document_source_change_stream.cpp
@@ -404,24 +404,6 @@ void DocumentSourceChangeStream::assertIsLegalSpecification(
<< (spec.getAllowToRunOnSystemNS() ? " through mongos" : ""),
!expCtx->ns.isSystem() || (spec.getAllowToRunOnSystemNS() && !expCtx->inMongos));
- // TODO SERVER-58584: remove the feature flag.
- if (!feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabled(
- serverGlobalParams.featureCompatibility)) {
- const bool shouldAddPreImage =
- (spec.getFullDocumentBeforeChange() != FullDocumentBeforeChangeModeEnum::kOff);
- uassert(51771,
- "the 'fullDocumentBeforeChange' option is not supported in a sharded cluster",
- !(shouldAddPreImage && (expCtx->inMongos || expCtx->needsMerge)));
-
- uassert(ErrorCodes::BadValue,
- str::stream() << "Specified value '"
- << FullDocumentMode_serializer(spec.getFullDocument())
- << "' is not a valid option for the 'fullDocument' parameter of the "
- "$changeStream stage",
- spec.getFullDocument() == FullDocumentModeEnum::kDefault ||
- spec.getFullDocument() == FullDocumentModeEnum::kUpdateLookup);
- }
-
uassert(31123,
"Change streams from mongos may not show migration events",
!(expCtx->inMongos && spec.getShowMigrationEvents()));
diff --git a/src/mongo/db/pipeline/document_source_change_stream_add_post_image.cpp b/src/mongo/db/pipeline/document_source_change_stream_add_post_image.cpp
index 822e41f3352..756bf9b8219 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_add_post_image.cpp
+++ b/src/mongo/db/pipeline/document_source_change_stream_add_post_image.cpp
@@ -85,15 +85,6 @@ DocumentSource::GetNextResult DocumentSourceChangeStreamAddPostImage::doGetNext(
return input;
}
- // TODO SERVER-58584: remove the feature flag.
- if (_fullDocumentMode != FullDocumentModeEnum::kUpdateLookup) {
- tassert(5869000,
- str::stream() << "Feature flag must be enabled for fullDocument: "
- << FullDocumentMode_serializer(_fullDocumentMode),
- feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabled(
- serverGlobalParams.featureCompatibility));
- }
-
// Create a mutable output document from the input document.
MutableDocument output(input.releaseDocument());
const auto postImageDoc = (_fullDocumentMode == FullDocumentModeEnum::kUpdateLookup
diff --git a/src/mongo/db/pipeline/document_source_change_stream_test.cpp b/src/mongo/db/pipeline/document_source_change_stream_test.cpp
index bc1707620e4..7875d039809 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_test.cpp
+++ b/src/mongo/db/pipeline/document_source_change_stream_test.cpp
@@ -417,10 +417,6 @@ bool getCSRewriteFeatureFlagValue() {
return feature_flags::gFeatureFlagChangeStreamsRewrite.isEnabledAndIgnoreFCV();
}
-bool isChangeStreamPreAndPostImagesEnabled() {
- return feature_flags::gFeatureFlagChangeStreamPreAndPostImages.isEnabledAndIgnoreFCV();
-}
-
TEST_F(ChangeStreamStageTest, ShouldRejectNonObjectArg) {
auto expCtx = getExpCtx();
@@ -477,41 +473,6 @@ TEST_F(ChangeStreamStageTest, ShouldRejectUnrecognizedFullDocumentOption) {
ErrorCodes::BadValue);
}
-TEST_F(ChangeStreamStageTest, ShouldRejectUnsupportedFullDocumentOption) {
- auto expCtx = getExpCtx();
-
- // New modes that are supposed to be working only when pre-/post-images feature flag is on.
- FullDocumentModeEnum modes[] = {FullDocumentModeEnum::kWhenAvailable,
- FullDocumentModeEnum::kRequired};
-
- for (const auto& mode : modes) {
- auto spec =
- BSON("$changeStream: " << DocumentSourceChangeStreamAddPostImageSpec(mode).toBSON());
-
- // TODO SERVER-58584: remove the feature flag.
- {
- RAIIServerParameterControllerForTest controller(
- "featureFlagChangeStreamPreAndPostImages", false);
- ASSERT_FALSE(isChangeStreamPreAndPostImagesEnabled());
-
- // 'DSChangeStream' is not allowed to be instantiated with new document modes when
- // pre-/post-images feature flag is disabled.
- ASSERT_THROWS_CODE(DSChangeStream::createFromBson(spec.firstElement(), expCtx),
- AssertionException,
- ErrorCodes::BadValue);
- }
- {
- RAIIServerParameterControllerForTest controller(
- "featureFlagChangeStreamPreAndPostImages", true);
- ASSERT(isChangeStreamPreAndPostImagesEnabled());
-
- // 'DSChangeStream' is allowed to be instantiated with new document modes when
- // pre-/post-images feature flag is enabled.
- DSChangeStream::createFromBson(spec.firstElement(), expCtx);
- }
- }
-}
-
TEST_F(ChangeStreamStageTest, ShouldRejectBothStartAtOperationTimeAndResumeAfterOptions) {
auto expCtx = getExpCtx();
diff --git a/src/mongo/db/query/query_feature_flags.idl b/src/mongo/db/query/query_feature_flags.idl
index e714b0f7e54..ef0cefb2c2d 100644
--- a/src/mongo/db/query/query_feature_flags.idl
+++ b/src/mongo/db/query/query_feature_flags.idl
@@ -48,11 +48,10 @@ feature_flags:
default: true
version: 5.1
- featureFlagChangeStreamPreAndPostImages:
- description: "Feature flag for allowing usage of point-in-time pre- and post-images of documents in change streams"
- cpp_varname: gFeatureFlagChangeStreamPreAndPostImages
- default: true
- version: 6.0
+ featureFlagSbePlanCache:
+ description: "Feature flag for enabling use of the SBE plan cache"
+ cpp_varname: gFeatureFlagSbePlanCache
+ default: false
featureFlagChangeStreamsFurtherEnrichedEvents:
description: "Feature flag for enabling the reshardCollection and refineCollectionShardKey events, as well as enhancements to the updateDescription field for update events"
@@ -65,7 +64,7 @@ feature_flags:
cpp_varname: gFeatureFlagLocf
default: true
version: 5.2
-
+
featureFlagCommonQueryFramework:
description: "Feature flag for allowing use of Cascades-based query optimizer"
cpp_varname: gFeatureFlagCommonQueryFramework
diff --git a/src/mongo/db/repl/oplog_applier_impl_test.cpp b/src/mongo/db/repl/oplog_applier_impl_test.cpp
index 24a0c66659b..2b96b39ef52 100644
--- a/src/mongo/db/repl/oplog_applier_impl_test.cpp
+++ b/src/mongo/db/repl/oplog_applier_impl_test.cpp
@@ -402,8 +402,6 @@ TEST_F(OplogApplierImplTest, applyOplogEntryOrGroupedInsertsDeleteDocumentCollec
TEST_F(OplogApplierImplTest, applyOplogEntryToRecordChangeStreamPreImages) {
// Setup the pre-images collection.
- RAIIServerParameterControllerForTest changeStreamPreAndPostImages{
- "featureFlagChangeStreamPreAndPostImages", true};
createChangeStreamPreImagesCollection(_opCtx.get());
// Create the collection.