diff options
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index a81b0ebbb11..52d8ef2e718 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -338,7 +338,7 @@ void BackgroundSync::_produce() { numSyncSourceSelections.increment(1); - if (syncSourceResp.syncSourceStatus == ErrorCodes::OplogStartMissing) { + if (syncSourceResp.syncSourceStatus == ErrorCodes::TooStaleToSyncFromSource) { // All (accessible) sync sources are too far ahead of us. if (_replCoord->getMemberState().primary()) { LOGV2_WARNING(21115, @@ -560,12 +560,13 @@ void BackgroundSync::_produce() { return; } + Seconds blacklistDuration(60); if (fetcherReturnStatus.code() == ErrorCodes::OplogOutOfOrder) { // This is bad because it means that our source // has not returned oplog entries in ascending ts order, and they need to be. LOGV2_WARNING( - 21120, "{error}", "Fetcher returned error", "error"_attr = redact(fetcherReturnStatus)); + 21120, "Oplog fetcher returned error", "error"_attr = redact(fetcherReturnStatus)); // Do not blacklist the server here, it will be blacklisted when we try to reuse it, // if it can't return a matching oplog start from the last fetch oplog ts field. return; @@ -581,19 +582,27 @@ void BackgroundSync::_produce() { mongo::sleepmillis(100); } } + } else if (fetcherReturnStatus.code() == ErrorCodes::TooStaleToSyncFromSource) { + LOGV2_WARNING( + 2806800, + "Oplog fetcher discovered we are too stale to sync from sync source. Blacklisting " + "sync source", + "syncSource"_attr = source, + "blacklistDuration"_attr = blacklistDuration); + _replCoord->blacklistSyncSource(source, Date_t::now() + blacklistDuration); } else if (fetcherReturnStatus == ErrorCodes::InvalidBSON) { - Seconds blacklistDuration(60); - LOGV2_WARNING(21121, - "Fetcher got invalid BSON while querying oplog. Blacklisting sync source " - "{syncSource} for {blacklistDuration}.", - "Fetcher got invalid BSON while querying oplog. Blacklisting sync source", - "syncSource"_attr = source, - "blacklistDuration"_attr = blacklistDuration); + LOGV2_WARNING( + 21121, + "Oplog fetcher got invalid BSON while querying oplog. Blacklisting sync source " + "{syncSource} for {blacklistDuration}.", + "Oplog fetcher got invalid BSON while querying oplog. Blacklisting sync source", + "syncSource"_attr = source, + "blacklistDuration"_attr = blacklistDuration); _replCoord->blacklistSyncSource(source, Date_t::now() + blacklistDuration); } else if (!fetcherReturnStatus.isOK()) { LOGV2_WARNING(21122, - "Fetcher stopped querying remote oplog with error: {error}", - "Fetcher stopped querying remote oplog with error", + "Oplog fetcher stopped querying remote oplog with error: {error}", + "Oplog fetcher stopped querying remote oplog with error", "error"_attr = redact(fetcherReturnStatus)); } } |