summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index a0d96de1529..0f4806c32a4 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -1397,6 +1397,14 @@ Status WiredTigerRecordStore::_insertRecords(OperationContext* opCtx,
invariant(!_overwrite);
invariant(_keyFormat == KeyFormat::String);
+ DuplicateKeyErrorInfo::FoundValue foundValueObj;
+ if (TestingProctor::instance().isEnabled()) {
+ WT_ITEM foundValue;
+ invariantWTOK(c->get_value(c, &foundValue), c->session);
+
+ foundValueObj.emplace<BSONObj>(reinterpret_cast<const char*>(foundValue.data));
+ }
+
// Generate a useful error message that is consistent with duplicate key error messages
// on indexes.
BSONObj obj = record_id_helpers::toBSONAs(record.id, "");
@@ -1404,7 +1412,8 @@ Status WiredTigerRecordStore::_insertRecords(OperationContext* opCtx,
NamespaceString(ns()),
"" /* indexName */,
BSON("_id" << 1),
- BSONObj() /* collation */);
+ BSONObj() /* collation */,
+ std::move(foundValueObj));
}
if (ret)