summaryrefslogtreecommitdiff
path: root/src/mongo/db/cloner.h
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-10-25 16:23:41 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-10-28 19:06:49 -0400
commit8ac6f69b0879df0e69b8d9929badb472772a3bca (patch)
treec5599a45f24b4c27241dfd88ebffd7b9bd82c900 /src/mongo/db/cloner.h
parenta5b160b566c7921be4c1908bd3707c8d694239e9 (diff)
downloadmongo-8ac6f69b0879df0e69b8d9929badb472772a3bca.tar.gz
SERVER-26764 Do not defer creation of _id index for replicated collections
Diffstat (limited to 'src/mongo/db/cloner.h')
-rw-r--r--src/mongo/db/cloner.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mongo/db/cloner.h b/src/mongo/db/cloner.h
index 510ac7736e3..a7f8bdcd50d 100644
--- a/src/mongo/db/cloner.h
+++ b/src/mongo/db/cloner.h
@@ -81,18 +81,30 @@ public:
StatusWith<std::vector<BSONObj>> filterCollectionsForClone(
const CloneOptions& opts, const std::list<BSONObj>& initialCollections);
- // Executes 'createCollection' for each collection specified in 'collections', in 'dbName'.
+ struct CreateCollectionParams {
+ std::string collectionName;
+ BSONObj collectionInfo;
+ BSONObj idIndexSpec;
+ };
+
+ // Executes 'createCollection' for each collection described in 'createCollectionParams', in
+ // 'dbName'.
Status createCollectionsForDb(OperationContext* txn,
- const std::vector<BSONObj>& collections,
+ const std::vector<CreateCollectionParams>& createCollectionParams,
const std::string& dbName);
+ /*
+ * Returns the _id index spec from 'indexSpecs', or an empty BSONObj if none is found.
+ */
+ static BSONObj getIdIndexSpec(const std::list<BSONObj>& indexSpecs);
+
private:
void copy(OperationContext* txn,
const std::string& toDBName,
const NamespaceString& from_ns,
const BSONObj& from_opts,
+ const BSONObj& from_id_index,
const NamespaceString& to_ns,
- bool masterSameProcess,
const CloneOptions& opts,
Query q);
@@ -100,9 +112,8 @@ private:
const std::string& toDBName,
const NamespaceString& from_ns,
const BSONObj& from_opts,
- const NamespaceString& to_ns,
- bool masterSameProcess,
- bool slaveOk);
+ const std::list<BSONObj>& from_indexes,
+ const NamespaceString& to_ns);
struct Fun;
std::unique_ptr<DBClientBase> _conn;