summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2023-02-10 20:31:30 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-11 05:05:19 +0000
commit0b0048e3ecb2a05eb68e6e36327ba50024bf7d9d (patch)
treef3b0add94695329298fe23ce59ee8542518d655a /src/mongo/db/repl/oplog.cpp
parent8a78dc88c4b50ed4c62a05d95072b19e42e74d51 (diff)
downloadmongo-0b0048e3ecb2a05eb68e6e36327ba50024bf7d9d.tar.gz
SERVER-73858 Oplog batch application index builds on an empty collection should ignore same errors as non-empty collection case
Diffstat (limited to 'src/mongo/db/repl/oplog.cpp')
-rw-r--r--src/mongo/db/repl/oplog.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 7697be34228..0a086206e73 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -289,15 +289,20 @@ void createIndexForApplyOps(OperationContext* opCtx,
try {
indexBuildsCoordinator->createIndexesOnEmptyCollection(
opCtx, coll, {indexSpec}, fromMigrate);
- } catch (const ExceptionFor<ErrorCodes::IndexAlreadyExists>& e) {
- // Ignore the "IndexAlreadyExists" error during oplog application.
- LOGV2_DEBUG(7261800,
- 1,
- "Ignoring indexing error",
- "error"_attr = redact(e.toStatus()),
- logAttrs(indexCollection->ns()),
- logAttrs(indexCollection->uuid()),
- "spec"_attr = indexSpec);
+ } catch (DBException& ex) {
+ // Some indexing errors can be ignored during oplog application.
+ const auto& status = ex.toStatus();
+ if (IndexBuildsCoordinator::isCreateIndexesErrorSafeToIgnore(status, constraints)) {
+ LOGV2_DEBUG(7261800,
+ 1,
+ "Ignoring indexing error",
+ "error"_attr = redact(status),
+ logAttrs(indexCollection->ns()),
+ logAttrs(indexCollection->uuid()),
+ "spec"_attr = indexSpec);
+ return;
+ }
+ throw;
}
wuow.commit();
} else {