コード例 #1
0
bool DataReplicatorExternalStateMock::shouldStopFetching(const HostAndPort& source,
                                                         const rpc::ReplSetMetadata& metadata) {
    lastSyncSourceChecked = source;
    syncSourceLastOpTime = metadata.getLastOpVisible();
    syncSourceHasSyncSource = metadata.getSyncSourceIndex() != -1;
    return shouldStopFetchingResult;
}
コード例 #2
0
bool DataReplicatorExternalStateImpl::shouldStopFetching(const HostAndPort& source,
                                                         const rpc::ReplSetMetadata& metadata) {
    // Re-evaluate quality of sync target.
    if (_replicationCoordinator->shouldChangeSyncSource(source, metadata)) {
        LOG(1) << "Canceling oplog query because we have to choose a sync source. Current source: "
               << source << ", OpTime " << metadata.getLastOpVisible()
               << ", its sync source index:" << metadata.getSyncSourceIndex();
        return true;
    }
    return false;
}
コード例 #3
0
bool DataReplicatorExternalStateMock::shouldStopFetching(
    const HostAndPort& source,
    const rpc::ReplSetMetadata& replMetadata,
    boost::optional<rpc::OplogQueryMetadata> oqMetadata) {
    lastSyncSourceChecked = source;

    // If OplogQueryMetadata was provided, use its values, otherwise use the ones in
    // ReplSetMetadata.
    if (oqMetadata) {
        syncSourceLastOpTime = oqMetadata->getLastOpApplied();
        syncSourceHasSyncSource = oqMetadata->getSyncSourceIndex() != -1;
    } else {
        syncSourceLastOpTime = replMetadata.getLastOpVisible();
        syncSourceHasSyncSource = replMetadata.getSyncSourceIndex() != -1;
    }
    return shouldStopFetchingResult;
}
コード例 #4
0
bool DataReplicatorExternalStateImpl::shouldStopFetching(
    const HostAndPort& source,
    const rpc::ReplSetMetadata& replMetadata,
    boost::optional<rpc::OplogQueryMetadata> oqMetadata) {
    // Re-evaluate quality of sync target.
    if (_replicationCoordinator->shouldChangeSyncSource(source, replMetadata, oqMetadata)) {
        // If OplogQueryMetadata was provided, its values were used to determine if we should
        // change sync sources.
        if (oqMetadata) {
            log() << "Canceling oplog query due to OplogQueryMetadata. We have to choose a new "
                     "sync source. Current source: "
                  << source << ", OpTime " << oqMetadata->getLastOpApplied()
                  << ", its sync source index:" << oqMetadata->getSyncSourceIndex();

        } else {
            log() << "Canceling oplog query due to ReplSetMetadata. We have to choose a new sync "
                     "source. Current source: "
                  << source << ", OpTime " << replMetadata.getLastOpVisible()
                  << ", its sync source index:" << replMetadata.getSyncSourceIndex();
        }
        return true;
    }
    return false;
}