SERVER-56896 Log the duplicate key error concisley with arrtributes
This commit is contained in:
parent
92b41dc3f1
commit
aaa930aaed
@ -641,6 +641,14 @@ Status OplogApplierUtils::applyOplogBatchCommon(
|
||||
"error"_attr = causedBy(redact(status)));
|
||||
return status;
|
||||
}
|
||||
} catch (const ExceptionFor<ErrorCodes::DuplicateKey>& e) {
|
||||
auto info = e.extraInfo<DuplicateKeyErrorInfo>();
|
||||
LOGV2_FATAL_CONTINUE(5689600,
|
||||
"Writer worker caught duplicate key exception",
|
||||
"keyPattern"_attr = redact(info->getKeyPattern()),
|
||||
"keyValue"_attr = redact(info->getDuplicatedKeyValue()),
|
||||
"oplogEntry"_attr = redact(op->toBSONForLogging()));
|
||||
return e.toStatus();
|
||||
} catch (const DBException& e) {
|
||||
// SERVER-24927 If we have a NamespaceNotFound exception, then this document will be
|
||||
// dropped before initial sync or recovery ends anyways and we should ignore it.
|
||||
|
||||
@ -509,6 +509,13 @@ boost::optional<Timestamp> ReplicationRecoveryImpl::recoverFromOplog(
|
||||
opCtx, _consistencyMarkers->getAppliedThrough(opCtx), topOfOplog);
|
||||
}
|
||||
return stableTimestamp;
|
||||
} catch (const ExceptionFor<ErrorCodes::DuplicateKey>& e) {
|
||||
auto info = e.extraInfo<DuplicateKeyErrorInfo>();
|
||||
LOGV2_FATAL_CONTINUE(5689601,
|
||||
"Caught duplicate key exception during replication recovery",
|
||||
"keyPattern"_attr = redact(info->getKeyPattern()),
|
||||
"keyValue"_attr = redact(info->getDuplicatedKeyValue()));
|
||||
std::terminate();
|
||||
} catch (...) {
|
||||
LOGV2_FATAL_CONTINUE(
|
||||
21570, "Caught exception during replication recovery", "error"_attr = exceptionToStatus());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user