diff options
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/find_and_modify.cpp | 13 | ||||
-rw-r--r-- | src/mongo/db/commands/fle_compact_test.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/commands/set_feature_compatibility_version_command.cpp | 44 | ||||
-rw-r--r-- | src/mongo/db/commands/write_commands.cpp | 6 |
4 files changed, 31 insertions, 41 deletions
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index 00203a4c485..abbc0d834fd 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -636,10 +636,15 @@ write_ops::FindAndModifyCommandReply CmdFindAndModify::Invocation::typedRun( // Collect metrics. CmdFindAndModify::collectMetrics(req); - boost::optional<DisableDocumentValidation> maybeDisableValidation; - if (req.getBypassDocumentValidation().value_or(false)) { - maybeDisableValidation.emplace(opCtx); - } + auto disableDocumentValidation = req.getBypassDocumentValidation().value_or(false); + auto fleCrudProcessed = + write_ops_exec::getFleCrudProcessed(opCtx, req.getEncryptionInformation()); + + DisableDocumentSchemaValidationIfTrue docSchemaValidationDisabler(opCtx, + disableDocumentValidation); + + DisableSafeContentValidationIfTrue safeContentValidationDisabler( + opCtx, disableDocumentValidation, fleCrudProcessed); const auto inTransaction = opCtx->inMultiDocumentTransaction(); uassert(50781, diff --git a/src/mongo/db/commands/fle_compact_test.cpp b/src/mongo/db/commands/fle_compact_test.cpp index 18c52f548ef..26153aadcc8 100644 --- a/src/mongo/db/commands/fle_compact_test.cpp +++ b/src/mongo/db/commands/fle_compact_test.cpp @@ -395,8 +395,13 @@ void FleCompactTest::doSingleInsert(int id, BSONObj encryptedFieldsObj) { auto efc = generateEncryptedFieldConfig(encryptedFieldsObj.getFieldNames<std::set<std::string>>()); - uassertStatusOK(processInsert( - _queryImpl.get(), _namespaces.edcNss, serverPayload, efc, kUninitializedTxnNumber, result)); + uassertStatusOK(processInsert(_queryImpl.get(), + _namespaces.edcNss, + serverPayload, + efc, + kUninitializedTxnNumber, + result, + false)); } void FleCompactTest::doSingleDelete(int id, BSONObj encryptedFieldsObj) { 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 c63a2978e11..73933d1abe2 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -66,7 +66,6 @@ #include "mongo/db/repl/tenant_migration_recipient_service.h" #include "mongo/db/s/active_migrations_registry.h" #include "mongo/db/s/balancer/balancer.h" -#include "mongo/db/s/collection_sharding_state.h" #include "mongo/db/s/config/configsvr_coordinator_service.h" #include "mongo/db/s/config/sharding_catalog_manager.h" #include "mongo/db/s/migration_coordinator_document_gen.h" @@ -75,11 +74,11 @@ #include "mongo/db/s/resharding/coordinator_document_gen.h" #include "mongo/db/s/resharding/resharding_coordinator_service.h" #include "mongo/db/s/resharding/resharding_donor_recipient_common.h" -#include "mongo/db/s/shard_metadata_util.h" +#include "mongo/db/s/shard_filtering_metadata_refresh.h" #include "mongo/db/s/sharding_ddl_coordinator_service.h" +#include "mongo/db/s/sharding_state.h" #include "mongo/db/s/sharding_util.h" #include "mongo/db/s/transaction_coordinator_service.h" -#include "mongo/db/s/type_shard_collection.h" #include "mongo/db/server_feature_flags_gen.h" #include "mongo/db/server_options.h" #include "mongo/db/session_catalog.h" @@ -91,6 +90,7 @@ #include "mongo/logv2/log.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/catalog/sharding_catalog_client.h" +#include "mongo/s/catalog_cache_loader.h" #include "mongo/s/pm2423_feature_flags_gen.h" #include "mongo/s/pm2583_feature_flags_gen.h" #include "mongo/s/refine_collection_shard_key_coordinator_feature_flags_gen.h" @@ -225,20 +225,6 @@ void uassertStatusOKIgnoreNSNotFound(Status status) { uassertStatusOK(status); } -void clearFilteringMetadataOnSecondaries(OperationContext* opCtx, const NamespaceString& collName) { - Status signalStatus = shardmetadatautil::updateShardCollectionsEntry( - opCtx, - BSON(ShardCollectionType::kNssFieldName << collName.ns()), - BSON("$inc" << BSON(ShardCollectionType::kEnterCriticalSectionCounterFieldName << 1)), - false /*upsert*/); - - uassertStatusOKWithContext( - signalStatus, - str::stream() - << "Failed to persist signal to clear the filtering metadata on secondaries for nss " - << collName.ns()); -} - /** * Sets the minimum allowed feature compatibility version for the cluster. The cluster should not * use any new features introduced in binary versions that are newer than the feature compatibility @@ -564,26 +550,18 @@ public: } } - if (requestedVersion == multiversion::FeatureCompatibilityVersion::kVersion_5_3 || - requestedVersion == multiversion::FeatureCompatibilityVersion::kVersion_6_0) { + if (requestedVersion == multiversion::FeatureCompatibilityVersion::kVersion_6_0 && + ShardingState::get(opCtx)->enabled()) { const auto colls = CollectionShardingState::getCollectionNames(opCtx); for (const auto& collName : colls) { - try { - if (!collName.isSystemDotViews()) { - { - AutoGetCollection coll(opCtx, collName, MODE_IX); - CollectionShardingState::get(opCtx, collName) - ->clearFilteringMetadata_DoNotUseIt(opCtx); - } - clearFilteringMetadataOnSecondaries(opCtx, collName); - } - } catch (const ExceptionFor<ErrorCodes::CommandNotSupportedOnView>&) { - // Nothing to do since collName is a view - } + onShardVersionMismatch(opCtx, collName, boost::none); + CatalogCacheLoader::get(opCtx).waitForCollectionFlush(opCtx, collName); } - // Wait until the signals to clear the filtering metadata on secondary nodes are - // majority committed. + repl::ReplClientInfo::forClient(opCtx->getClient()) + .setLastOpToSystemLastOpTime(opCtx); + + // Wait until the changes on config.cache.* are majority committed. WriteConcernResult ignoreResult; auto latestOpTime = repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); uassertStatusOK(waitForWriteConcern(opCtx, diff --git a/src/mongo/db/commands/write_commands.cpp b/src/mongo/db/commands/write_commands.cpp index 9e6d189b4a3..0254baca47d 100644 --- a/src/mongo/db/commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands.cpp @@ -529,7 +529,8 @@ public: write_ops::InsertCommandReply typedRun(OperationContext* opCtx) final try { transactionChecks(opCtx, ns()); - if (request().getEncryptionInformation().has_value()) { + if (request().getEncryptionInformation().has_value() && + !request().getEncryptionInformation()->getCrudProcessed()) { write_ops::InsertCommandReply insertReply; auto batch = processFLEInsert(opCtx, request(), &insertReply); if (batch == FLEBatchResult::kProcessed) { @@ -1456,7 +1457,8 @@ public: write_ops::UpdateCommandReply updateReply; OperationSource source = OperationSource::kStandard; - if (request().getEncryptionInformation().has_value()) { + if (request().getEncryptionInformation().has_value() && + !request().getEncryptionInformation().get().getCrudProcessed()) { return processFLEUpdate(opCtx, request()); } |