summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog.cpp
diff options
context:
space:
mode:
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 39b8daf8f79..cdccf23da26 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 {