diff options
author | Wenbin Zhu <wenbin.zhu@mongodb.com> | 2021-06-30 22:56:25 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-07-20 20:53:15 +0000 |
commit | a395774d97caeaeb9f2019f6430332b152f3314d (patch) | |
tree | 020767fb569c77d29039fe54790ef8f955a7c376 | |
parent | b16aad93159684f4dd9a1640997cf78338aa8aea (diff) | |
download | mongo-a395774d97caeaeb9f2019f6430332b152f3314d.tar.gz |
SERVER-58164 Log error code and exclude NamespaceNotFound in error logs when group insert fails.
(cherry picked from commit 6e00ab669dfae4bb5381d6c8a7766ca7a0bcf349)
-rw-r--r-- | src/mongo/db/repl/insert_group.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/repl/insert_group.cpp b/src/mongo/db/repl/insert_group.cpp index 36d1c7cee09..9fef7cac7c6 100644 --- a/src/mongo/db/repl/insert_group.cpp +++ b/src/mongo/db/repl/insert_group.cpp @@ -137,20 +137,21 @@ StatusWith<InsertGroup::ConstIterator> InsertGroup::groupAndApplyInserts(ConstIt // application of an individual op. static constexpr char message[] = "Error applying inserts in bulk. Trying first insert as a lone insert"; - auto status = exceptionToStatus().withContext( - str::stream() << message << ". Grouped inserts: " << redact(groupedInserts.toBSON()) - << ". First insert: " << redact(entry.getRaw())); + auto status = exceptionToStatus(); // It's not an error during initial sync to encounter DuplicateKey errors. - if (Mode::kInitialSync == _mode && ErrorCodes::DuplicateKey == status) { + if (Mode::kInitialSync == _mode && + (ErrorCodes::DuplicateKey == status || ErrorCodes::NamespaceNotFound == status)) { LOGV2_DEBUG(21203, 2, message, + "error"_attr = redact(status), "groupedInserts"_attr = redact(groupedInserts.toBSON()), "firstInsert"_attr = redact(entry.getRaw())); } else { LOGV2_ERROR(21204, message, + "error"_attr = redact(status), "groupedInserts"_attr = redact(groupedInserts.toBSON()), "firstInsert"_attr = redact(entry.getRaw())); } |