summaryrefslogtreecommitdiff
path: root/src/mongo/db/index/index_access_method.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/index/index_access_method.cpp')
-rw-r--r--src/mongo/db/index/index_access_method.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp
index 486a6740012..004fb931f75 100644
--- a/src/mongo/db/index/index_access_method.cpp
+++ b/src/mongo/db/index/index_access_method.cpp
@@ -728,16 +728,17 @@ Status AbstractIndexAccessMethod::commitBulk(OperationContext* opCtx,
// Assert that keys are retrieved from the sorter in non-decreasing order, but only in debug
// builds since this check can be expensive.
int cmpData;
- if (kDebugBuild || _descriptor->unique()) {
+ if (_descriptor->unique()) {
cmpData = data.first.compareWithoutRecordId(previousKey);
- if (cmpData < 0) {
- LOGV2_FATAL_NOTRACE(
- 31171,
- "Expected the next key to be greater than or equal to the previous key",
- "nextKey"_attr = data.first.toString(),
- "previousKey"_attr = previousKey.toString(),
- "index"_attr = _descriptor->indexName());
- }
+ }
+
+ if (kDebugBuild && data.first.compare(previousKey) < 0) {
+ LOGV2_FATAL_NOTRACE(
+ 31171,
+ "Expected the next key to be greater than or equal to the previous key",
+ "nextKey"_attr = data.first.toString(),
+ "previousKey"_attr = previousKey.toString(),
+ "index"_attr = _descriptor->indexName());
}
// Before attempting to insert, perform a duplicate key check.