diff options
author | Ben Judd <ben.judd@10gen.com> | 2018-06-07 16:52:18 -0400 |
---|---|---|
committer | Ben Judd <ben.judd@10gen.com> | 2018-06-18 15:54:16 -0400 |
commit | 62b7707c8dc29f786f26fd1762066efe4b64cd37 (patch) | |
tree | d23dc803dd57b2fd32f42aa21b5860958ea73d00 /src/mongo/db/repair_database_and_check_version.cpp | |
parent | 570c2570a728a646a953cee6abedeaa3517f8215 (diff) | |
download | mongo-62b7707c8dc29f786f26fd1762066efe4b64cd37.tar.gz |
SERVER-35134 Remove UUID fixup code, instead fail fast for collections
without UUIDS. By 4.0 all collections should have them.
Diffstat (limited to 'src/mongo/db/repair_database_and_check_version.cpp')
-rw-r--r-- | src/mongo/db/repair_database_and_check_version.cpp | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/mongo/db/repair_database_and_check_version.cpp b/src/mongo/db/repair_database_and_check_version.cpp index e57bfe58840..7eb1ad2d917 100644 --- a/src/mongo/db/repair_database_and_check_version.cpp +++ b/src/mongo/db/repair_database_and_check_version.cpp @@ -136,7 +136,6 @@ Status restoreMissingFeatureCompatibilityVersionDocument(OperationContext* opCtx Status ensureAllCollectionsHaveUUIDs(OperationContext* opCtx, const std::vector<std::string>& dbNames) { bool isMmapV1 = opCtx->getServiceContext()->getStorageEngine()->isMmapV1(); - std::vector<NamespaceString> nonReplicatedCollNSSsWithoutUUIDs; for (const auto& dbName : dbNames) { Database* db = DatabaseHolder::getDatabaseHolder().openDb(opCtx, dbName); invariant(db); @@ -175,31 +174,12 @@ Status ensureAllCollectionsHaveUUIDs(OperationContext* opCtx, continue; } + // We expect all collections to have UUIDs in MongoDB 4.2 if (!coll->uuid()) { - if (!coll->ns().isReplicated()) { - nonReplicatedCollNSSsWithoutUUIDs.push_back(coll->ns()); - continue; - } - - // We expect all collections to have UUIDs starting in FCV 3.6, so if we are missing - // a UUID then the user never upgraded to FCV 3.6 and this startup attempt is - // illegal. return {ErrorCodes::MustDowngrade, mustDowngradeErrorMsg}; } } } - - // Non-replicated collections are very easy to fix since they don't require a replication or - // sharding solution. So, regardless of what the cause might have been, we go ahead and add - // UUIDs to them to ensure UUID dependent code works. - // - // Note: v3.6 arbiters do not have UUIDs, so this code is necessary to add them on upgrade to - // v4.0. - for (const auto& collNSS : nonReplicatedCollNSSsWithoutUUIDs) { - uassertStatusOK( - collModForUUIDUpgrade(opCtx, collNSS, BSON("collMod" << collNSS.coll()), UUID::gen())); - } - return Status::OK(); } |