Details
Description
Follow on work from WT-7264 which is adding a new cursor flag, the flag allows the search near to exit early instead of walking numerous not visible entries.
The patch I was using when testing the change is:
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
|
index 87bda0ace9..7eef9c8528 100644
|
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
|
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
|
@@ -1520,9 +1520,11 @@ Status WiredTigerIndexUnique::_insert(OperationContext* opCtx,
|
setKey(c, prefixKeyItem.Get());
|
ret = WT_OP_CHECK(wiredTigerCursorRemove(opCtx, c));
|
invariantWTOK(ret);
|
-
|
+ c->reconfigure(c, "prefix_key=true");
|
// Second phase looks up for existence of key to avoid insertion of duplicate key
|
- if (_keyExists(opCtx, c, keyString.getBuffer(), sizeWithoutRecordId)) {
|
+ auto key_exists = _keyExists(opCtx, c, keyString.getBuffer(), sizeWithoutRecordId);
|
+ c->reconfigure(c, "prefix_key=false");
|
+ if (key_exists) {
|
auto key = KeyString::toBson(
|
keyString.getBuffer(), sizeWithoutRecordId, _ordering, keyString.getTypeBits());
|
auto entry = _desc->getEntry();
|
I think that should be all the required changes.
Attachments
Issue Links
- causes
-
SERVER-58936 Unique index constraints may not be enforced
-
- Closed
-
- depends on
-
WT-7264 Creating a new configuration for search near that allows it to exit quickly when searching for prefixes
-
- Closed
-
- is depended on by
-
SERVER-57095 Increase number of zones in resharding_large_number_of_initial_chunks.js
-
- Closed
-
- is related to
-
SERVER-56274 TTL deletes are much slower on descending indexes than ascending indexes
-
- Closed
-
-
SERVER-61185 Use prefix_search for unique index lookup
-
- Closed
-
- related to
-
WT-7653 Inconsistent update performance on unique indexes
-
- Backlog
-
-
SERVER-57221 Inconsistent delete performance on collections with multiple secondary indexes on same key
-
- Closed
-
-
SERVER-58943 Add more test coverage for unique indexes
-
- Closed
-