From befb5b1bf6b71bd168f73467d1c3d7c66d737ed2 Mon Sep 17 00:00:00 2001 From: Gregory Wlodarek Date: Tue, 31 Jan 2023 13:59:49 +0000 Subject: SERVER-71950 Fail and log the operation when out-of-order keys are detected in WiredTiger (cherry picked from commit b2085e2d422278733bb6925614eb0c2f36348034) --- .../db/storage/wiredtiger/wiredtiger_record_store.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index 359ac8318b2..6c6d7ad19f7 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -2209,19 +2209,18 @@ boost::optional WiredTigerRecordStoreCursorBase::next() { } if (_forward && _lastReturnedId >= id) { - LOGV2_ERROR(22406, - "WTCursor::next -- c->next_key ( {next}) was not greater than _lastReturnedId " - "({last}) which is a bug.", - "WTCursor::next -- next was not greater than last which is a bug", - "next"_attr = id, - "last"_attr = _lastReturnedId); - // Crash when testing diagnostics are enabled. invariant(!TestingProctor::instance().isEnabled(), "next was not greater than last"); - // Force a retry of the operation from our last known position by acting as-if - // we received a WT_ROLLBACK error. - throw WriteConflictException(); + // uassert with 'DataCorruptionDetected' after logging. + LOGV2_ERROR_OPTIONS(22406, + {logv2::UserAssertAfterLog(ErrorCodes::DataCorruptionDetected)}, + "WT_Cursor::next -- returned out-of-order keys", + "forward"_attr = _forward, + "next"_attr = id, + "last"_attr = _lastReturnedId, + "ident"_attr = _rs._ident, + "ns"_attr = _rs.ns()); } WT_ITEM value; -- cgit v1.2.1