[SERVER-82511] WiredTigerRecordStore::seek recomputes table URI string length each time Created: 27/Oct/23  Updated: 02/Feb/24  Resolved: 02/Feb/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 8.0.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Ian Boros Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2024-02-05
Participants:

 Description   

https://github.com/10gen/mongo/blob/af39933b7e530cf1e582093fa06197ec6dd7799a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp#L2182

    // Implicit construction of StringData:
    metricsCollector.incrementOneCursorSeek(c->uri); 

This line of code implicitly constructs a StringData from a const char*, which results in a call to strlen every time we seek on a record store cursor. While this is not an enormous cost, it has shown up in some profiles I've taken.



 Comments   
Comment by Githook User [ 02/Feb/24 ]

Author:

{'name': 'Louis Williams', 'email': 'louiswilliams@users.noreply.github.com', 'username': 'louiswilliams'}

Message: SERVER-82511 Avoid strlen of URI in cursors (#18578)

GitOrigin-RevId: e0a274c101cab2c75048a2186a93a4bc3f48aa57
Branch: master
https://github.com/mongodb/mongo/commit/fe7839cf450dfbbfb35324f0a1fbfa8b95b6eaa0

Comment by Ian Boros [ 27/Oct/23 ]

It might make sense to just record these metrics in one go, when the cursor is destroyed, rather than one at a time in every seek/next call.

Generated at Thu Feb 08 06:49:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.