From f7bed566056ba8cc13f765a1f8eb00c798ffc405 Mon Sep 17 00:00:00 2001 From: Geert Bosch Date: Tue, 28 Mar 2017 17:35:25 -0400 Subject: SERVER-28531 Fix convert-to-capped to use new UUID. --- src/mongo/db/catalog/capped_utils.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/mongo/db/catalog/capped_utils.cpp') diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp index 5d4ac36c168..0a01329fc5c 100644 --- a/src/mongo/db/catalog/capped_utils.cpp +++ b/src/mongo/db/catalog/capped_utils.cpp @@ -134,18 +134,18 @@ Status cloneCollectionAsCapped(OperationContext* opCtx, // create new collection MONGO_WRITE_CONFLICT_RETRY_LOOP_BEGIN { - const auto fromOptions = - fromCollection->getCatalogEntry()->getCollectionOptions(opCtx).toBSON(); - OldClientContext ctx(opCtx, toNs); - BSONObjBuilder spec; - spec.appendBool("capped", true); - spec.append("size", size); + auto options = fromCollection->getCatalogEntry()->getCollectionOptions(opCtx); + // The capped collection will get its own new unique id, as the conversion isn't reversible, + // so it can't be rolled back. + options.uuid.reset(); + options.capped = true; + options.cappedSize = size; if (temp) - spec.appendBool("temp", true); - spec.appendElementsUnique(fromOptions); + options.temp = true; + OldClientContext ctx(opCtx, toNs); WriteUnitOfWork wunit(opCtx); - Status status = userCreateNS(opCtx, ctx.db(), toNs, spec.done()); + Status status = userCreateNS(opCtx, ctx.db(), toNs, options.toBSON()); if (!status.isOK()) return status; wunit.commit(); -- cgit v1.2.1