summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/bgsync.cpp
diff options
context:
space:
mode:
authorWilliam Schultz <william.schultz@mongodb.com>2019-12-05 21:26:56 +0000
committerevergreen <evergreen@mongodb.com>2019-12-05 21:26:56 +0000
commitf5a2d477761f5d954ea63a8c8a6cfa02d124e4a7 (patch)
tree3baac8c880b31610e3d17fbd455594fe3bf51854 /src/mongo/db/repl/bgsync.cpp
parent43ba884d27f7174f440cb75774ef8458c1976bc2 (diff)
downloadmongo-f5a2d477761f5d954ea63a8c8a6cfa02d124e4a7.tar.gz
SERVER-43766 Speed up initial syncs and awaitLastStableRecoveryTimestamp in ReplSetTest initiate
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r--src/mongo/db/repl/bgsync.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 5c243642026..556bce587ec 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -144,6 +144,9 @@ size_t getSize(const BSONObj& o) {
// Failpoint which causes rollback to hang before starting.
MONGO_FAIL_POINT_DEFINE(rollbackHangBeforeStart);
+// Failpoint to override the time to sleep before retrying sync source selection.
+MONGO_FAIL_POINT_DEFINE(forceBgSyncSyncSourceRetryWaitMS);
+
BackgroundSync::BackgroundSync(
ReplicationCoordinator* replicationCoordinator,
ReplicationCoordinatorExternalState* replicationCoordinatorExternalState,
@@ -390,11 +393,16 @@ void BackgroundSync::_produce() {
log() << "failed to find sync source, received error "
<< syncSourceResp.syncSourceStatus.getStatus();
}
+
+ long long sleepMS = 1000;
+ forceBgSyncSyncSourceRetryWaitMS.execute(
+ [&](const BSONObj& data) { sleepMS = data["sleepMS"].numberInt(); });
+
// No sync source found.
- LOG(1) << "Could not find a sync source. Sleeping for 1 second before trying again.";
+ LOG(1) << "Could not find a sync source. Sleeping for " << sleepMS
+ << "ms before trying again.";
numTimesCouldNotFindSyncSource.increment(1);
-
- sleepsecs(1);
+ mongo::sleepmillis(sleepMS);
return;
}