From 2739eb4ecd1cf45cb49df48b03e958444c471358 Mon Sep 17 00:00:00 2001 From: auto-revert-processor Date: Thu, 13 Jan 2022 09:18:09 +0000 Subject: Revert "SERVER-62443 Add `collectionUUID` parameter to `find` command" This reverts commit eb75b6ccc62f7c8ea26a57c1b5eb96a41809396a. --- jstests/core/collection_uuid_find.js | 56 ---------------------- jstests/libs/parallelTester.js | 6 +-- .../collection_uuid_find_by_uuid.js | 18 ------- src/mongo/db/commands/SConscript | 1 - src/mongo/db/commands/find_cmd.cpp | 18 ------- src/mongo/db/query/find_command.idl | 5 -- 6 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 jstests/core/collection_uuid_find.js delete mode 100644 jstests/noPassthroughWithMongod/collection_uuid_find_by_uuid.js diff --git a/jstests/core/collection_uuid_find.js b/jstests/core/collection_uuid_find.js deleted file mode 100644 index e958bffa890..00000000000 --- a/jstests/core/collection_uuid_find.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Tests the collectionUUID parameter of the find command. - * - * @tags: [ - * featureFlagCommandsAcceptCollectionUUID, - * tenant_migration_incompatible, - * ] - */ -(function() { -'use strict'; - -const testDB = db.getSiblingDB(jsTestName()); -assert.commandWorked(testDB.dropDatabase()); - -const coll = testDB['coll']; -assert.commandWorked(coll.insert({_id: 0})); - -const uuid = - assert.commandWorked(testDB.runCommand({listCollections: 1})).cursor.firstBatch[0].info.uuid; - -// The command succeeds when the correct UUID is provided. -assert.commandWorked(testDB.runCommand({find: coll.getName(), collectionUUID: uuid})); - -// The command fails when the provided UUID does not correspond to an existing collection. -const nonexistentUUID = UUID(); -let res = assert.commandFailedWithCode( - testDB.runCommand({find: coll.getName(), collectionUUID: nonexistentUUID}), - ErrorCodes.CollectionUUIDMismatch); -assert.eq(res.collectionUUID, nonexistentUUID); -assert.eq(res.actualNamespace, ""); - -// The command fails when the provided UUID corresponds to a different collection. -const coll2 = testDB['coll_2']; -assert.commandWorked(coll2.insert({_id: 1})); -res = assert.commandFailedWithCode(testDB.runCommand({find: coll2.getName(), collectionUUID: uuid}), - ErrorCodes.CollectionUUIDMismatch); -assert.eq(res.collectionUUID, uuid); -assert.eq(res.actualNamespace, coll.getFullName()); - -// The command fails when the provided UUID corresponds to a different collection, even if the -// provided namespace does not exist. -coll2.drop(); -res = assert.commandFailedWithCode(testDB.runCommand({find: coll2.getName(), collectionUUID: uuid}), - ErrorCodes.CollectionUUIDMismatch); -assert.eq(res.collectionUUID, uuid); -assert.eq(res.actualNamespace, coll.getFullName()); - -// The command fails when the provided UUID corresponds to a different collection, even if the -// provided namespace is a view. -const view = db['view']; -assert.commandWorked(testDB.createView(view.getName(), coll.getName(), [])); -res = assert.commandFailedWithCode(testDB.runCommand({find: view.getName(), collectionUUID: uuid}), - ErrorCodes.CollectionUUIDMismatch); -assert.eq(res.collectionUUID, uuid); -assert.eq(res.actualNamespace, coll.getFullName()); -})(); diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js index 67859ae65e3..7f4365aa798 100644 --- a/jstests/libs/parallelTester.js +++ b/jstests/libs/parallelTester.js @@ -230,11 +230,7 @@ if (typeof _threadInject != "undefined") { "timeseries/timeseries_delete_hint.js", "timeseries/timeseries_update_hint.js", "timeseries/timeseries_delete_concurrent.js", - "timeseries/timeseries_update_concurrent.js", - - // TODO (SERVER-60185): Remove the collection_uuid_*.js exclusions once the feature flag - // is enabled by default. - "collection_uuid_find.js", + "timeseries/timeseries_update_concurrent.js" ]); // Get files, including files in subdirectories. diff --git a/jstests/noPassthroughWithMongod/collection_uuid_find_by_uuid.js b/jstests/noPassthroughWithMongod/collection_uuid_find_by_uuid.js deleted file mode 100644 index 26a4f56e135..00000000000 --- a/jstests/noPassthroughWithMongod/collection_uuid_find_by_uuid.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Tests that when running the find command by UUID, the collectionUUID parameter cannot also be - * specified. - */ -(function() { -'use strict'; - -const coll = db[jsTestName()]; -coll.drop(); -assert.commandWorked(coll.insert({_id: 0})); - -const uuid = assert.commandWorked(db.runCommand({listCollections: 1})) - .cursor.firstBatch.find(c => c.name === coll.getName()) - .info.uuid; - -assert.commandFailedWithCode(db.runCommand({find: uuid, collectionUUID: uuid}), - ErrorCodes.InvalidOptions); -})(); diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript index 587aaf45c24..c8e94e111c9 100644 --- a/src/mongo/db/commands/SConscript +++ b/src/mongo/db/commands/SConscript @@ -355,7 +355,6 @@ env.Library( '$BUILD_DIR/mongo/db/catalog/catalog_helpers', '$BUILD_DIR/mongo/db/catalog/collection_catalog_helper', '$BUILD_DIR/mongo/db/catalog/collection_query_info', - '$BUILD_DIR/mongo/db/catalog/collection_uuid_mismatch', '$BUILD_DIR/mongo/db/catalog/collection_validation', '$BUILD_DIR/mongo/db/catalog/database_holder', '$BUILD_DIR/mongo/db/catalog/index_key_validate', diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp index 3ab8d7d8d6a..f0eeb4fe30d 100644 --- a/src/mongo/db/commands/find_cmd.cpp +++ b/src/mongo/db/commands/find_cmd.cpp @@ -33,7 +33,6 @@ #include "mongo/db/auth/authorization_checks.h" #include "mongo/db/auth/authorization_session.h" -#include "mongo/db/catalog/collection_uuid_mismatch.h" #include "mongo/db/client.h" #include "mongo/db/clientcursor.h" #include "mongo/db/commands.h" @@ -401,11 +400,6 @@ public: !(repl::ReadConcernArgs::get(opCtx).isSpeculativeMajority() && !findCommand->getAllowSpeculativeMajorityRead())); - uassert(ErrorCodes::InvalidOptions, - "When using the find command by UUID, the collectionUUID parameter cannot also " - "be specified", - !findCommand->getNamespaceOrUUID().uuid() || !findCommand->getCollectionUUID()); - auto replCoord = repl::ReplicationCoordinator::get(opCtx); const auto txnParticipant = TransactionParticipant::get(opCtx); uassert(ErrorCodes::InvalidOptions, @@ -478,18 +472,6 @@ public: << " specified in query request not found", ctx || !findCommand->getNamespaceOrUUID().uuid()); - uassert(ErrorCodes::InvalidOptions, - "The collectionUUID parameter is not enabled", - !findCommand->getCollectionUUID() || - feature_flags::gCommandsAcceptCollectionUUID.isEnabled( - serverGlobalParams.featureCompatibility)); - - if (findCommand->getCollectionUUID() && - (!ctx->getCollection() || - findCommand->getCollectionUUID() != ctx->getCollection()->uuid())) { - uassertCollectionUUIDMismatch(opCtx, *findCommand->getCollectionUUID()); - } - // Set the namespace if a collection was found, as opposed to nothing or a view. if (ctx) { query_request_helper::refreshNSS(ctx->getNss(), findCommand.get()); diff --git a/src/mongo/db/query/find_command.idl b/src/mongo/db/query/find_command.idl index bb89213f4aa..2760dcb9c2b 100644 --- a/src/mongo/db/query/find_command.idl +++ b/src/mongo/db/query/find_command.idl @@ -239,8 +239,3 @@ commands: type: LegacyRuntimeConstants optional: true unstable: true - collectionUUID: - description: "The expected UUID of the collection." - type: uuid - optional: true - unstable: true -- cgit v1.2.1