diff options
author | Geert Bosch <geert@mongodb.com> | 2017-03-28 17:35:25 -0400 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2017-03-29 11:55:01 -0400 |
commit | f7bed566056ba8cc13f765a1f8eb00c798ffc405 (patch) | |
tree | 95f8d6b25e54b4b77d0a3c80e57b040c1059588a /src/mongo/db/catalog/capped_utils.cpp | |
parent | 29816153660280601d96289dc3ef0da2ee46d6ff (diff) | |
download | mongo-f7bed566056ba8cc13f765a1f8eb00c798ffc405.tar.gz |
SERVER-28531 Fix convert-to-capped to use new UUID.
Diffstat (limited to 'src/mongo/db/catalog/capped_utils.cpp')
-rw-r--r-- | src/mongo/db/catalog/capped_utils.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
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(); |