diff options
author | Denis Grebennicov <denis.grebennicov@mongodb.com> | 2022-07-15 14:27:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-07-15 15:36:46 +0000 |
commit | 6af105aa73b7e3ed88186a14a5e832434af65863 (patch) | |
tree | 9f4f8375af23d60aad7ae38a167c74b25b40b54b /src/mongo/db/catalog | |
parent | bee3babbf2ef6b75667fe4e8b00219d84fdd1136 (diff) | |
download | mongo-6af105aa73b7e3ed88186a14a5e832434af65863.tar.gz |
SERVER-67386 Remove featureFlagChangeStreamPreAndPostImages
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r-- | src/mongo/db/catalog/coll_mod.cpp | 31 | ||||
-rw-r--r-- | src/mongo/db/catalog/collection_options.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/catalog/create_collection.cpp | 10 |
3 files changed, 10 insertions, 35 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"); |