diff options
author | Geert Bosch <geert@mongodb.com> | 2017-03-02 14:07:32 -0500 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2017-03-08 10:07:17 -0500 |
commit | 78052771af75f9c6fdff10796c82a38167274a6f (patch) | |
tree | 7fcfa87c45775dc86c86898501b2e06541ecd21b /src/mongo/db/cloner.cpp | |
parent | 54f3fff857ac66be0cdca5a4ddce9f87a0d80e6a (diff) | |
download | mongo-78052771af75f9c6fdff10796c82a38167274a6f.tar.gz |
SERVER-27987 Create and persist UUIDs for newly created collections
Diffstat (limited to 'src/mongo/db/cloner.cpp')
-rw-r--r-- | src/mongo/db/cloner.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 439d3ac574c..20455ad7c22 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -170,11 +170,13 @@ struct Cloner::Fun { opCtx->checkForInterrupt(); WriteUnitOfWork wunit(opCtx); + const bool createDefaultIndexes = true; Status s = userCreateNS(opCtx, db, to_collection.toString(), from_options, - true, + CollectionOptions::parseForCommand, + createDefaultIndexes, fixIndexSpec(to_collection.db().toString(), from_id_index)); verify(s.isOK()); wunit.commit(); @@ -390,12 +392,14 @@ void Cloner::copyIndexes(OperationContext* opCtx, opCtx->checkForInterrupt(); WriteUnitOfWork wunit(opCtx); + const bool createDefaultIndexes = true; Status s = userCreateNS( opCtx, db, to_collection.toString(), from_opts, - true, + CollectionOptions::parseForCommand, + createDefaultIndexes, fixIndexSpec(to_collection.db().toString(), getIdIndexSpec(from_indexes))); invariant(s.isOK()); collection = db->getCollection(to_collection); @@ -490,7 +494,14 @@ bool Cloner::copyCollection(OperationContext* opCtx, opCtx->checkForInterrupt(); WriteUnitOfWork wunit(opCtx); - Status status = userCreateNS(opCtx, db, ns, options, true, idIndexSpec); + const bool createDefaultIndexes = true; + Status status = userCreateNS(opCtx, + db, + ns, + options, + CollectionOptions::parseForCommand, + createDefaultIndexes, + idIndexSpec); if (!status.isOK()) { errmsg = status.toString(); // abort write unit of work @@ -528,7 +539,8 @@ StatusWith<std::vector<BSONObj>> Cloner::filterCollectionsForClone( BSONElement collectionOptions = collection["options"]; if (collectionOptions.isABSONObj()) { - auto parseOptionsStatus = CollectionOptions().parse(collectionOptions.Obj()); + auto parseOptionsStatus = CollectionOptions().parse(collectionOptions.Obj(), + CollectionOptions::parseForCommand); if (!parseOptionsStatus.isOK()) { return parseOptionsStatus; } @@ -578,12 +590,14 @@ Status Cloner::createCollectionsForDb( opCtx->checkForInterrupt(); WriteUnitOfWork wunit(opCtx); + const bool createDefaultIndexes = true; Status createStatus = userCreateNS(opCtx, db, nss.ns(), options, - true, + CollectionOptions::parseForCommand, + createDefaultIndexes, fixIndexSpec(nss.db().toString(), params.idIndexSpec)); if (!createStatus.isOK()) { return createStatus; |