summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/auth/change_stream_pre_image_coll_role_auth.js1
-rw-r--r--jstests/change_streams/change_stream_pre_image_lookup_whole_db_whole_cluster.js33
-rw-r--r--jstests/change_streams/change_streams_lookup_preimage_with_chunk_migration.js1
-rw-r--r--jstests/change_streams/lookup_pit_pre_and_post_image.js17
-rw-r--r--jstests/change_streams/lookup_pit_pre_and_post_image_in_transaction.js4
-rw-r--r--jstests/change_streams/lookup_pre_image.js28
-rw-r--r--jstests/core/write_change_stream_pit_preimage.js1
-rw-r--r--jstests/libs/change_stream_util.js10
-rw-r--r--jstests/noPassthrough/change_stream_preimages_fail_on_mongos.js48
-rw-r--r--jstests/noPassthrough/change_stream_preimages_standalone_mode.js1
-rw-r--r--jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js1
-rw-r--r--jstests/noPassthrough/change_streams_pre_image_removal_job.js1
-rw-r--r--jstests/noPassthrough/write_change_stream_pit_preimage_in_transaction.js9
-rw-r--r--jstests/replsets/change_stream_pit_pre_image_deletion_asymmetric.js1
-rw-r--r--jstests/replsets/change_stream_pit_pre_images.js1
-rw-r--r--jstests/sharding/change_streams/change_stream_lookup_preimage_with_resharding.js1
-rw-r--r--jstests/sharding/internal_txns/retryable_findAndModify_change_stream_images_enabled.js1
-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
27 files changed, 38 insertions, 281 deletions
diff --git a/jstests/auth/change_stream_pre_image_coll_role_auth.js b/jstests/auth/change_stream_pre_image_coll_role_auth.js
index 3057b34fb46..fcbeec157b6 100644
--- a/jstests/auth/change_stream_pre_image_coll_role_auth.js
+++ b/jstests/auth/change_stream_pre_image_coll_role_auth.js
@@ -4,7 +4,6 @@
* Verify that if pre-image for the collection has been deleted by the 'root' user.
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* uses_change_streams,
* assumes_read_preference_unchanged,
* requires_replication,
diff --git a/jstests/change_streams/change_stream_pre_image_lookup_whole_db_whole_cluster.js b/jstests/change_streams/change_stream_pre_image_lookup_whole_db_whole_cluster.js
index 4e8feacada3..4087ab65f73 100644
--- a/jstests/change_streams/change_stream_pre_image_lookup_whole_db_whole_cluster.js
+++ b/jstests/change_streams/change_stream_pre_image_lookup_whole_db_whole_cluster.js
@@ -11,45 +11,22 @@
(function() {
"use strict";
-load("jstests/libs/change_stream_util.js"); // For isChangeStreamPreAndPostImagesEnabled.
-load("jstests/libs/fixture_helpers.js"); // For FixtureHelpers.
+load("jstests/libs/fixture_helpers.js"); // For FixtureHelpers.
const testDB = db.getSiblingDB(jsTestName());
const adminDB = db.getSiblingDB("admin");
const collWithPreImageName = "coll_with_pre_images";
const collWithNoPreImageName = "coll_with_no_pre_images";
-const canRecordPreImagesInConfigDb = isChangeStreamPreAndPostImagesEnabled(testDB);
-
-if (!canRecordPreImagesInConfigDb && FixtureHelpers.isMongos(db)) {
- jsTestLog("Skipping test as pre image lookup is not supported in sharded cluster with feature" +
- "flag 'featureFlagChangeStreamPreAndPostImages' disabled.");
- return;
-}
-
-if (canRecordPreImagesInConfigDb &&
- (jsTestOptions().shardMixedBinVersions || jsTestOptions().mixedBinVersions)) {
- jsTestLog("Skipping test because multiversion test-suite is unsupported when flag " +
- "'featureFlagChangeStreamPreAndPostImages' enabled");
- return;
-}
assert.commandWorked(testDB.dropDatabase());
// Create one collection that has pre-image recording enabled...
-if (!canRecordPreImagesInConfigDb) {
- assert.commandWorked(testDB.createCollection(collWithPreImageName, {recordPreImages: true}));
-} else {
- assert.commandWorked(testDB.createCollection(collWithPreImageName,
- {changeStreamPreAndPostImages: {enabled: true}}));
-}
+assert.commandWorked(
+ testDB.createCollection(collWithPreImageName, {changeStreamPreAndPostImages: {enabled: true}}));
//... and one collection which has pre-images disabled.
-if (!canRecordPreImagesInConfigDb) {
- assert.commandWorked(testDB.createCollection(collWithNoPreImageName, {recordPreImages: false}));
-} else {
- assert.commandWorked(testDB.createCollection(collWithNoPreImageName,
- {changeStreamPreAndPostImages: {enabled: false}}));
-}
+assert.commandWorked(testDB.createCollection(collWithNoPreImageName,
+ {changeStreamPreAndPostImages: {enabled: false}}));
const collWithPreImages = testDB.coll_with_pre_images;
const collWithNoPreImages = testDB.coll_with_no_pre_images;
diff --git a/jstests/change_streams/change_streams_lookup_preimage_with_chunk_migration.js b/jstests/change_streams/change_streams_lookup_preimage_with_chunk_migration.js
index dd7fa9588e2..95edadfebf5 100644
--- a/jstests/change_streams/change_streams_lookup_preimage_with_chunk_migration.js
+++ b/jstests/change_streams/change_streams_lookup_preimage_with_chunk_migration.js
@@ -4,7 +4,6 @@
*
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* requires_sharding,
* uses_change_streams,
* change_stream_does_not_expect_txns,
diff --git a/jstests/change_streams/lookup_pit_pre_and_post_image.js b/jstests/change_streams/lookup_pit_pre_and_post_image.js
index 30f8a4658a7..42fd387caaa 100644
--- a/jstests/change_streams/lookup_pit_pre_and_post_image.js
+++ b/jstests/change_streams/lookup_pit_pre_and_post_image.js
@@ -1,30 +1,13 @@
// Tests that the point-in-time pre- and post-images are loaded correctly in $changeStream running
// with different arguments for collections with 'changeStreamPreAndPostImages' being enabled.
-// @tags: [
-// requires_fcv_52,
-// ]
(function() {
"use strict";
load("jstests/libs/collection_drop_recreate.js"); // For assertDropAndRecreateCollection.
-load("jstests/libs/change_stream_util.js"); // For isChangeStreamPreAndPostImagesEnabled.
const testDB = db.getSiblingDB(jsTestName());
const collName = "test";
-if (!isChangeStreamPreAndPostImagesEnabled(testDB)) {
- const coll = assertDropAndRecreateCollection(testDB, collName);
-
- // If feature flag is off, creating changeStream with new fullDocument arguments should throw.
- assert.throwsWithCode(() => coll.watch([], {fullDocument: 'whenAvailable'}),
- ErrorCodes.BadValue);
- assert.throwsWithCode(() => coll.watch([], {fullDocument: 'required'}), ErrorCodes.BadValue);
-
- jsTestLog(
- "Skipping test because pre-image recording capability in 'system.preimages' is not enabled.");
- return;
-}
-
const originalDoc = {
_id: 1,
x: 1
diff --git a/jstests/change_streams/lookup_pit_pre_and_post_image_in_transaction.js b/jstests/change_streams/lookup_pit_pre_and_post_image_in_transaction.js
index 6f868c377c2..0db693f55ba 100644
--- a/jstests/change_streams/lookup_pit_pre_and_post_image_in_transaction.js
+++ b/jstests/change_streams/lookup_pit_pre_and_post_image_in_transaction.js
@@ -3,15 +3,13 @@
* performed in a transaction and non-atomic "applyOps" command.
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* uses_transactions,
* ]
*/
(function() {
"use strict";
-load("jstests/libs/change_stream_util.js"); // For isChangeStreamPreAndPostImagesEnabled and
- // ChangeStreamTest.
+load("jstests/libs/change_stream_util.js"); // For ChangeStreamTest.
load("jstests/libs/collection_drop_recreate.js"); // For assertDropAndRecreateCollection.
load("jstests/libs/fixture_helpers.js"); // For FixtureHelpers.isMongos.
load("jstests/libs/transactions_util.js"); // For TransactionsUtil.runInTransaction.
diff --git a/jstests/change_streams/lookup_pre_image.js b/jstests/change_streams/lookup_pre_image.js
index 7afba2009b0..a3357a3a994 100644
--- a/jstests/change_streams/lookup_pre_image.js
+++ b/jstests/change_streams/lookup_pre_image.js
@@ -2,7 +2,6 @@
* Tests the behaviour of the 'fullDocumentBeforeChange' argument to the $changeStream stage.
*
* @tags: [
- * requires_fcv_52,
* assumes_unsharded_collection,
* do_not_wrap_aggregations_in_facets,
* uses_multiple_connections,
@@ -11,29 +10,16 @@
(function() {
"use strict";
-load("jstests/libs/change_stream_util.js"); // For ChangeStreamTest and
- // isChangeStreamPreAndPostImagesEnabled.
+load("jstests/libs/change_stream_util.js"); // For ChangeStreamTest.
load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection.
load("jstests/libs/fixture_helpers.js"); // For FixtureHelpers.
-const canRecordPreImagesInConfigDb = isChangeStreamPreAndPostImagesEnabled(db);
-
-if (!canRecordPreImagesInConfigDb && FixtureHelpers.isMongos(db)) {
- jsTestLog("Skipping test as pre image lookup is not supported in sharded cluster with feature" +
- "flag 'featureFlagChangeStreamPreAndPostImages' disabled.");
- return;
-}
-
const coll = assertDropAndRecreateCollection(db, "change_stream_pre_images");
const cst = new ChangeStreamTest(db);
// Enable pre-image recording on the test collection.
-if (!canRecordPreImagesInConfigDb) {
- assert.commandWorked(db.runCommand({collMod: coll.getName(), recordPreImages: true}));
-} else {
- assert.commandWorked(
- db.runCommand({collMod: coll.getName(), changeStreamPreAndPostImages: {enabled: true}}));
-}
+assert.commandWorked(
+ db.runCommand({collMod: coll.getName(), changeStreamPreAndPostImages: {enabled: true}}));
// Open three streams on the collection, one for each "fullDocumentBeforeChange" mode.
const csNoPreImages = cst.startWatchingChanges({
@@ -110,12 +96,8 @@ assert.docEq(latestChange, cst.getOneChange(csPreImageWhenAvailableCursor));
assert.docEq(latestChange, cst.getOneChange(csPreImageRequiredCursor));
// Now disable pre-image generation on the test collection and re-test.
-if (!canRecordPreImagesInConfigDb) {
- assert.commandWorked(db.runCommand({collMod: coll.getName(), recordPreImages: false}));
-} else {
- assert.commandWorked(
- db.runCommand({collMod: coll.getName(), changeStreamPreAndPostImages: {enabled: false}}));
-}
+assert.commandWorked(
+ db.runCommand({collMod: coll.getName(), changeStreamPreAndPostImages: {enabled: false}}));
// Test pre-image lookup for an insertion. No pre-image exists on any cursor.
assert.commandWorked(coll.insert({_id: "y"}));
diff --git a/jstests/core/write_change_stream_pit_preimage.js b/jstests/core/write_change_stream_pit_preimage.js
index 9dd44886abe..a1cfd730fe4 100644
--- a/jstests/core/write_change_stream_pit_preimage.js
+++ b/jstests/core/write_change_stream_pit_preimage.js
@@ -2,7 +2,6 @@
// collections with 'changeStreamPreAndPostImages' being enabled.
// @tags: [
// requires_fcv_60,
-// featureFlagChangeStreamPreAndPostImages,
// assumes_against_mongod_not_mongos,
// requires_capped,
// requires_replication,
diff --git a/jstests/libs/change_stream_util.js b/jstests/libs/change_stream_util.js
index e57188d8d0d..40c8ee7b6bb 100644
--- a/jstests/libs/change_stream_util.js
+++ b/jstests/libs/change_stream_util.js
@@ -25,16 +25,6 @@ function tojsonMaybeTruncate(jsonObj) {
}
/**
- * Returns true if feature flag 'featureFlagChangeStreamPreAndPostImages' is enabled, false
- * otherwise.
- */
-function isChangeStreamPreAndPostImagesEnabled(db) {
- const getParam = db.adminCommand({getParameter: 1, featureFlagChangeStreamPreAndPostImages: 1});
- return getParam.hasOwnProperty("featureFlagChangeStreamPreAndPostImages") &&
- getParam.featureFlagChangeStreamPreAndPostImages.value;
-}
-
-/**
* Returns true if feature flag 'featureFlagChangeStreamsRewrite' is enabled, false otherwise.
*/
function isChangeStreamsRewriteEnabled(db) {
diff --git a/jstests/noPassthrough/change_stream_preimages_fail_on_mongos.js b/jstests/noPassthrough/change_stream_preimages_fail_on_mongos.js
deleted file mode 100644
index dd871885c6c..00000000000
--- a/jstests/noPassthrough/change_stream_preimages_fail_on_mongos.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Test that mongoS rejects change streams which request 'fullDocumentBeforeChange' pre-images.
- *
- * @tags: [uses_change_streams, requires_replication]
- */
-(function() {
-'use strict';
-
-load("jstests/libs/change_stream_util.js"); // For isChangeStreamPreAndPostImagesEnabled.
-
-const st = new ShardingTest({
- shards: 1,
- mongos: 1,
- config: 1,
-});
-
-const shard = st.shard0;
-const mongos = st.s;
-
-if (isChangeStreamPreAndPostImagesEnabled(mongos.getDB("test"))) {
- jsTestLog(
- "Skipping test as pre-image lookup is supported in sharded clusters with feature flag " +
- "'featureFlagChangeStreamPreAndPostImages' enabled.");
- st.stop();
- return;
-}
-
-// Test that we cannot create a collection with pre-images enabled in a sharded cluster.
-assert.commandFailed(shard.getDB("test").runCommand({create: "test", recordPreImages: true}));
-
-// Test that attempting to run $changeStream with {fullDocumentBeforeChange: "whenAvailable"} fails.
-assert.commandFailedWithCode(mongos.getDB("test").runCommand({
- aggregate: 1,
- pipeline: [{$changeStream: {fullDocumentBeforeChange: "whenAvailable"}}],
- cursor: {}
-}),
- 51771);
-
-// Test that attempting to run $changeStream with {fullDocumentBeforeChange: "required"} fails.
-assert.commandFailedWithCode(mongos.getDB("test").runCommand({
- aggregate: 1,
- pipeline: [{$changeStream: {fullDocumentBeforeChange: "required"}}],
- cursor: {}
-}),
- 51771);
-
-st.stop();
-}());
diff --git a/jstests/noPassthrough/change_stream_preimages_standalone_mode.js b/jstests/noPassthrough/change_stream_preimages_standalone_mode.js
index bc2b746c8a5..c36d03433e6 100644
--- a/jstests/noPassthrough/change_stream_preimages_standalone_mode.js
+++ b/jstests/noPassthrough/change_stream_preimages_standalone_mode.js
@@ -9,7 +9,6 @@
* # test suite that turns journaling off.
* requires_replication,
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* ]
*/
diff --git a/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js b/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js
index 0ee617fd1cb..cd7b5e16bd7 100644
--- a/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js
+++ b/jstests/noPassthrough/change_streams_pre_and_post_images_in_create_and_collmod.js
@@ -4,7 +4,6 @@
* 'config' databases as well as on view collections.
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* requires_replication,
* ]
*/
diff --git a/jstests/noPassthrough/change_streams_pre_image_removal_job.js b/jstests/noPassthrough/change_streams_pre_image_removal_job.js
index 6888f89e84f..09b37951157 100644
--- a/jstests/noPassthrough/change_streams_pre_image_removal_job.js
+++ b/jstests/noPassthrough/change_streams_pre_image_removal_job.js
@@ -3,7 +3,6 @@
// periodic job.
// @tags: [
// requires_fcv_60,
-// featureFlagChangeStreamPreAndPostImages,
// assumes_against_mongod_not_mongos,
// change_stream_does_not_expect_txns,
// requires_replication,
diff --git a/jstests/noPassthrough/write_change_stream_pit_preimage_in_transaction.js b/jstests/noPassthrough/write_change_stream_pit_preimage_in_transaction.js
index 4000a318405..439835b6082 100644
--- a/jstests/noPassthrough/write_change_stream_pit_preimage_in_transaction.js
+++ b/jstests/noPassthrough/write_change_stream_pit_preimage_in_transaction.js
@@ -3,7 +3,6 @@
* transactions and for non-atomic "applyOps" command.
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* requires_replication,
* no_selinux,
* requires_majority_read_concern,
@@ -14,12 +13,8 @@
load("jstests/core/txns/libs/prepare_helpers.js"); // For PrepareHelpers.prepareTransaction.
load("jstests/libs/collection_drop_recreate.js"); // For assertDropAndRecreateCollection.
-load(
- "jstests/libs/change_stream_util.js"); // For
- // assertChangeStreamPreAndPostImagesCollectionOptionIsEnabled,
- // assertChangeStreamPreAndPostImagesCollectionOptionIsAbsent,
- // preImagesForOps.
-load("jstests/libs/transactions_util.js"); // For TransactionsUtil.runInTransaction.
+load("jstests/libs/change_stream_util.js"); // For preImagesForOps.
+load("jstests/libs/transactions_util.js"); // For TransactionsUtil.runInTransaction.
const rst = new ReplSetTest({
nodes: [
diff --git a/jstests/replsets/change_stream_pit_pre_image_deletion_asymmetric.js b/jstests/replsets/change_stream_pit_pre_image_deletion_asymmetric.js
index fea020be7f6..d014b3e0981 100644
--- a/jstests/replsets/change_stream_pit_pre_image_deletion_asymmetric.js
+++ b/jstests/replsets/change_stream_pit_pre_image_deletion_asymmetric.js
@@ -5,7 +5,6 @@
*
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* ]
*/
(function() {
diff --git a/jstests/replsets/change_stream_pit_pre_images.js b/jstests/replsets/change_stream_pit_pre_images.js
index 154ae1a6c04..5434b5a3d4d 100644
--- a/jstests/replsets/change_stream_pit_pre_images.js
+++ b/jstests/replsets/change_stream_pit_pre_images.js
@@ -6,7 +6,6 @@
*
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* # The test waits for the Checkpointer, but this process runs only for on-disk storage engines.
* requires_persistence,
* ]
diff --git a/jstests/sharding/change_streams/change_stream_lookup_preimage_with_resharding.js b/jstests/sharding/change_streams/change_stream_lookup_preimage_with_resharding.js
index 3b366b35145..4ae9d2f55d6 100644
--- a/jstests/sharding/change_streams/change_stream_lookup_preimage_with_resharding.js
+++ b/jstests/sharding/change_streams/change_stream_lookup_preimage_with_resharding.js
@@ -4,7 +4,6 @@
* stream events - ones that happened before, during, and after resharding of the collection.
*
* @tags: [
- * featureFlagChangeStreamPreAndPostImages,
* requires_fcv_60,
* uses_change_streams,
* assumes_unsharded_collection,
diff --git a/jstests/sharding/internal_txns/retryable_findAndModify_change_stream_images_enabled.js b/jstests/sharding/internal_txns/retryable_findAndModify_change_stream_images_enabled.js
index 9932825e219..171477e3f57 100644
--- a/jstests/sharding/internal_txns/retryable_findAndModify_change_stream_images_enabled.js
+++ b/jstests/sharding/internal_txns/retryable_findAndModify_change_stream_images_enabled.js
@@ -4,7 +4,6 @@
*
* @tags: [
* requires_fcv_60,
- * featureFlagChangeStreamPreAndPostImages,
* uses_transactions,
* ]
*/
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.