diff options
Diffstat (limited to 'src/mongo/db/commands/fle2_compact.cpp')
-rw-r--r-- | src/mongo/db/commands/fle2_compact.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/commands/fle2_compact.cpp b/src/mongo/db/commands/fle2_compact.cpp index 60516d19330..7e5aa58e7d8 100644 --- a/src/mongo/db/commands/fle2_compact.cpp +++ b/src/mongo/db/commands/fle2_compact.cpp @@ -38,7 +38,6 @@ #include "mongo/crypto/encryption_fields_gen.h" #include "mongo/crypto/fle_stats.h" #include "mongo/db/catalog/collection_catalog.h" -#include "mongo/db/commands/fle2_compact_gen.h" #include "mongo/db/commands/server_status.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/pipeline/aggregate_command_gen.h" @@ -487,6 +486,16 @@ void validateCompactRequest(const CompactStructuredEncryptionData& request, cons CompactionHelpers::validateCompactionTokens(efc, request.getCompactionTokens()); } +void validateCleanupRequest(const CleanupStructuredEncryptionData& request, const Collection& edc) { + uassert(7294901, + "Target namespace is not an encrypted collection", + edc.getCollectionOptions().encryptedFieldConfig); + + // Validate the request contains a compaction token for each encrypted field + const auto& efc = edc.getCollectionOptions().encryptedFieldConfig.value(); + CompactionHelpers::validateCleanupTokens(efc, request.getCleanupTokens()); +} + const PrfBlock& FLECompactESCDeleteSet::at(size_t index) const { if (index >= size()) { throw std::out_of_range("out of range"); |