summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/set_feature_compatibility_version_command.cpp')
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
index e7789ea0eea..58c5121c2dd 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -499,10 +499,9 @@ private:
if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
_cleanupConfigVersionOnUpgrade(opCtx, requestedVersion);
_createSchemaOnConfigSettings(opCtx, requestedVersion);
- } else if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) {
- } else {
- return;
}
+
+ _removeRecordPreImagesCollectionOption(opCtx);
}
// TODO SERVER-68889 remove once 7.0 becomes last LTS
@@ -592,6 +591,33 @@ private:
}
}
+ // Removes collection option "recordPreImages" from all collection definitions.
+ // TODO SERVER-74036: Remove once FCV 7.0 becomes last-LTS.
+ void _removeRecordPreImagesCollectionOption(OperationContext* opCtx) {
+ for (const auto& dbName : DatabaseHolder::get(opCtx)->getNames()) {
+ Lock::DBLock dbLock(opCtx, dbName, MODE_IX);
+ catalog::forEachCollectionFromDb(
+ opCtx,
+ dbName,
+ MODE_X,
+ [&](const CollectionPtr& collection) {
+ // To remove collection option "recordPreImages" from persistent storage, issue
+ // the "collMod" command with none of the parameters set.
+ BSONObjBuilder responseBuilder;
+ uassertStatusOK(processCollModCommand(
+ opCtx, collection->ns(), CollMod{collection->ns()}, &responseBuilder));
+ LOGV2(7383300,
+ "Removed 'recordPreImages' collection option",
+ "ns"_attr = collection->ns(),
+ "collModResponse"_attr = responseBuilder.obj());
+ return true;
+ },
+ [&](const CollectionPtr& collection) {
+ return collection->getCollectionOptions().recordPreImagesOptionUsed;
+ });
+ }
+ }
+
// _runUpgrade performs all the upgrade specific code for setFCV. Any new feature specific
// upgrade code should be placed in the _runUpgrade helper functions:
// * _prepareForUpgrade: for any upgrade actions that should be done before taking the FCV full