bool BackgroundSync::shouldStopFetching() const { if (inShutdown()) { LOG(2) << "Stopping oplog fetcher due to shutdown."; return true; } // If we are transitioning to primary state, we need to stop fetching in order to go into // bgsync-stop mode. if (_replCoord->isWaitingForApplierToDrain()) { LOG(2) << "Stopping oplog fetcher because we are waiting for the applier to drain."; return true; } if (_replCoord->getMemberState().primary() && !_replCoord->isCatchingUp()) { LOG(2) << "Stopping oplog fetcher because we are primary."; return true; } // Check if we have been stopped. if (isStopped()) { LOG(2) << "Stopping oplog fetcher due to stop request."; return true; } // Check current sync source. if (getSyncTarget().empty()) { LOG(1) << "Stopping oplog fetcher; canceling oplog query because we have no valid sync " "source."; return true; } return false; }
bool BackgroundSync::shouldStopFetching() const { if (inShutdown()) { LOG(2) << "Interrupted by shutdown while checking sync source."; return true; } // If we are transitioning to primary state, we need to stop fetching in order to go into // bgsync-stop mode. if (_replCoord->isWaitingForApplierToDrain()) { LOG(2) << "Interrupted by waiting for applier to drain while checking sync source."; return true; } if (_replCoord->getMemberState().primary() && !_replCoord->isCatchingUp()) { LOG(2) << "Interrupted by becoming primary while checking sync source."; return true; } // Check if we have been stopped. if (isStopped()) { LOG(2) << "Interrupted by a stop request while checking sync source."; return true; } // Check current sync target. if (getSyncTarget().empty()) { LOG(1) << "Canceling oplog query because we have no valid sync source."; return true; } return false; }
bool BackgroundSync::_shouldChangeSyncSource(const HostAndPort& syncSource) { // is it even still around? if (getSyncTarget().empty() || syncSource.empty()) { return true; } // check other members: is any member's optime more than MaxSyncSourceLag seconds // ahead of the current sync source? return _replCoord->shouldChangeSyncSource(syncSource); }
bool BackgroundSync::shouldStopFetching() const { // Check if we have been stopped. if (getState() != ProducerState::Running) { LOG(2) << "Stopping oplog fetcher due to stop request."; return true; } // Check current sync source. if (getSyncTarget().empty()) { LOG(1) << "Stopping oplog fetcher; canceling oplog query because we have no valid sync " "source."; return true; } return false; }