SERVER-114075 Log reason for OplogFetcher failure in BackgroundSync::_produce (#44654)

GitOrigin-RevId: 08f5c73c8e0d63f1d51b5e025d599ff2d551e47e
This commit is contained in:
gitpushjoe 2025-12-15 15:12:01 -05:00 committed by MongoDB Bot
parent 2668f1ebc0
commit 6b3f4e62d6
1 changed files with 10 additions and 5 deletions

View File

@ -558,12 +558,15 @@ void BackgroundSync::_produce() {
} }
Milliseconds denylistDuration(60000); Milliseconds denylistDuration(60000);
if (!fetcherReturnStatus.isOK()) {
LOGV2_WARNING(21120,
"Oplog fetcher returned error",
"error"_attr = redact(fetcherReturnStatus),
"code"_attr = fetcherReturnStatus.code());
}
if (fetcherReturnStatus.code() == ErrorCodes::OplogOutOfOrder) { if (fetcherReturnStatus.code() == ErrorCodes::OplogOutOfOrder) {
// This is bad because it means that our source // This is bad because it means that our source
// has not returned oplog entries in ascending ts order, and they need to be. // has not returned oplog entries in ascending ts order, and they need to be.
LOGV2_WARNING(
21120, "Oplog fetcher returned error", "error"_attr = redact(fetcherReturnStatus));
// Do not denylist the server here, it will be denylisted when we try to reuse it, // Do not denylist the server here, it will be denylisted when we try to reuse it,
// if it can't return a matching oplog start from the last fetch oplog ts field. // if it can't return a matching oplog start from the last fetch oplog ts field.
return; return;
@ -584,14 +587,16 @@ void BackgroundSync::_produce() {
"Oplog fetcher discovered we are too stale to sync from sync source. Denylisting " "Oplog fetcher discovered we are too stale to sync from sync source. Denylisting "
"sync source", "sync source",
"syncSource"_attr = source, "syncSource"_attr = source,
"denylistDuration"_attr = denylistDuration); "denylistDuration"_attr = denylistDuration,
"errorCode"_attr = fetcherReturnStatus.code());
_replCoord->denylistSyncSource(source, Date_t::now() + denylistDuration); _replCoord->denylistSyncSource(source, Date_t::now() + denylistDuration);
} else if (fetcherReturnStatus == ErrorCodes::InvalidBSON) { } else if (fetcherReturnStatus == ErrorCodes::InvalidBSON) {
LOGV2_WARNING( LOGV2_WARNING(
5579701, 5579701,
"Oplog fetcher got invalid BSON while querying oplog. Denylisting sync source", "Oplog fetcher got invalid BSON while querying oplog. Denylisting sync source",
"syncSource"_attr = source, "syncSource"_attr = source,
"denylistDuration"_attr = denylistDuration); "denylistDuration"_attr = denylistDuration,
"errorCode"_attr = fetcherReturnStatus.code());
_replCoord->denylistSyncSource(source, Date_t::now() + denylistDuration); _replCoord->denylistSyncSource(source, Date_t::now() + denylistDuration);
} else if (fetcherReturnStatus.code() == ErrorCodes::ShutdownInProgress) { } else if (fetcherReturnStatus.code() == ErrorCodes::ShutdownInProgress) {
if (auto quiesceInfo = fetcherReturnStatus.extraInfo<ShutdownInProgressQuiesceInfo>()) { if (auto quiesceInfo = fetcherReturnStatus.extraInfo<ShutdownInProgressQuiesceInfo>()) {