diff options
author | William Schultz <william.schultz@mongodb.com> | 2017-06-05 14:28:12 -0400 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2017-06-05 14:55:07 -0400 |
commit | 2daa02b7294412f2d5f2b7f224ef94f290f12f12 (patch) | |
tree | 03b296cec41d688514218ed95aab7fa2dc6281ec /src | |
parent | 153c4a036ac1db27e7cbc51b9a8730359b60a7a8 (diff) | |
download | mongo-2daa02b7294412f2d5f2b7f224ef94f290f12f12.tar.gz |
SERVER-29240 Add test to ensure valid index creation for capped collections during
initial sync
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/collection_cloner.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp index d695ca1c3e7..2c573b95d68 100644 --- a/src/mongo/db/repl/collection_cloner.cpp +++ b/src/mongo/db/repl/collection_cloner.cpp @@ -76,6 +76,10 @@ MONGO_EXPORT_SERVER_PARAMETER(numInitialSyncCollectionFindAttempts, int, 3); // collection 'namespace'. MONGO_FP_DECLARE(initialSyncHangDuringCollectionClone); +// Failpoint which causes initial sync to hang after the initial 'find' command of collection +// cloning, for a specific collection. +MONGO_FP_DECLARE(initialSyncHangCollectionClonerAfterInitialFind); + CollectionCloner::CollectionCloner(executor::TaskExecutor* executor, OldThreadPool* dbWorkThreadPool, const HostAndPort& source, @@ -432,6 +436,20 @@ void CollectionCloner::_findCallback(const StatusWith<Fetcher::QueryResponse>& f return; } + MONGO_FAIL_POINT_BLOCK(initialSyncHangCollectionClonerAfterInitialFind, nssData) { + const BSONObj& data = nssData.getData(); + auto nss = data["nss"].str(); + // Only hang when cloning the specified collection. + if (_destNss.toString() == nss) { + while (MONGO_FAIL_POINT(initialSyncHangCollectionClonerAfterInitialFind) && + !_isShuttingDown()) { + log() << "initialSyncHangCollectionClonerAfterInitialFind fail point enabled for " + << nss << ". Blocking until fail point is disabled."; + mongo::sleepsecs(1); + } + } + } + if (!lastBatch) { invariant(getMoreBob); getMoreBob->append("getMore", batchData.cursorId); |