diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-18 17:02:53 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-18 17:02:53 -0300 |
| commit | 959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch) | |
| tree | acc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/index/index_access_method.cpp | |
| parent | 76588293975fc059cf076779e4283e6ffaf8afff (diff) | |
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/index/index_access_method.cpp')
| -rw-r--r-- | src/mongo/db/index/index_access_method.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp index 5727bfea1df..4d454f2b5a3 100644 --- a/src/mongo/db/index/index_access_method.cpp +++ b/src/mongo/db/index/index_access_method.cpp @@ -412,6 +412,13 @@ void SortedDataIndexAccessMethod::removeOneKey(OperationContext* opCtx, try { _newInterface->unindex(opCtx, keyString, dupsAllowed); } catch (AssertionException& e) { + if (e.code() == ErrorCodes::DataCorruptionDetected) { + // DataCorruptionDetected errors are expected to have logged an error and added an entry + // to the health log with the stack trace at the location where the error was initially + // thrown. No need to do so again. + throw; + } + NamespaceString ns = _indexCatalogEntry->getNSSFromCatalog(opCtx); LOGV2(20683, "Assertion failure: _unindex failed on: {namespace} for index: {indexName}. " @@ -631,7 +638,8 @@ Status SortedDataIndexAccessMethod::doUpdate(OperationContext* opCtx, // Add all new data keys into the index. for (const auto& keyString : ticket.added) { - bool dupsAllowed = !_descriptor->prepareUnique() && ticket.dupsAllowed; + bool dupsAllowed = (!_descriptor->prepareUnique() || !opCtx->isEnforcingConstraints()) && + ticket.dupsAllowed; auto status = _newInterface->insert(opCtx, keyString, dupsAllowed); if (!status.isOK()) return status; |
