summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShreyas Kalyan <shreyas.kalyan@mongodb.com>2023-05-08 15:06:05 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-10 18:47:15 +0000
commit30273fd01d125b0030d489125f064b5a2f390873 (patch)
tree0cc6aeb09e71a09008dc41a4c597157df90ba5d5
parentec56eeaf417ff42b2689f772fc9dec4193da10ff (diff)
downloadmongo-30273fd01d125b0030d489125f064b5a2f390873.tar.gz
SERVER-76086 Allow unsharded QE compact to run simultaneously on different encrypted namespaces
-rw-r--r--jstests/fle2/libs/encrypted_client_util.js12
-rw-r--r--src/mongo/db/commands/fle2_compact_cmd.cpp8
2 files changed, 9 insertions, 11 deletions
diff --git a/jstests/fle2/libs/encrypted_client_util.js b/jstests/fle2/libs/encrypted_client_util.js
index 99ddd27ace3..178147a48a6 100644
--- a/jstests/fle2/libs/encrypted_client_util.js
+++ b/jstests/fle2/libs/encrypted_client_util.js
@@ -415,7 +415,7 @@ var EncryptedClient = class {
}
};
-function runEncryptedTest(db, dbName, collName, encryptedFields, runTestsCallback) {
+function runEncryptedTest(db, dbName, collNames, encryptedFields, runTestsCallback) {
const dbTest = db.getSiblingDB(dbName);
dbTest.dropDatabase();
@@ -429,8 +429,14 @@ function runEncryptedTest(db, dbName, collName, encryptedFields, runTestsCallbac
let client = new EncryptedClient(db.getMongo(), dbName);
- assert.commandWorked(
- client.createEncryptionCollection(collName, {encryptedFields: encryptedFields}));
+ if (typeof collNames === "string") {
+ collNames = [collNames];
+ }
+
+ for (collName of collNames) {
+ assert.commandWorked(
+ client.createEncryptionCollection(collName, {encryptedFields: encryptedFields}));
+ }
let edb = client.getDB();
runTestsCallback(edb, client);
diff --git a/src/mongo/db/commands/fle2_compact_cmd.cpp b/src/mongo/db/commands/fle2_compact_cmd.cpp
index 2854dc2a196..596ca2e7059 100644
--- a/src/mongo/db/commands/fle2_compact_cmd.cpp
+++ b/src/mongo/db/commands/fle2_compact_cmd.cpp
@@ -57,11 +57,6 @@ MONGO_FAIL_POINT_DEFINE(fleCompactSkipECOCDropUnsharded);
namespace mongo {
namespace {
-/**
- * Ensures that only one compactStructuredEncryptionData can run at a given time.
- */
-Lock::ResourceMutex commandMutex("compactStructuredEncryptionDataCommandMutex");
-
CompactStats compactEncryptedCompactionCollection(OperationContext* opCtx,
const CompactStructuredEncryptionData& request) {
@@ -72,9 +67,6 @@ CompactStats compactEncryptedCompactionCollection(OperationContext* opCtx,
<< " must be run through mongos in a sharded cluster",
!ShardingState::get(opCtx)->enabled());
- // Only allow one instance of compactStructuredEncryptionData to run at a time.
- Lock::ExclusiveLock fleCompactCommandLock(opCtx, commandMutex);
-
// Since this command holds an IX lock on the DB and the global lock throughout
// the lifetime of this operation, setFCV should not be allowed to abort the transaction
// performing the compaction. Otherwise, on retry, the transaction may attempt to