Investigate apparent regression in classic engine IDHACK (SERVER-68110)

[SERVER-73908] Remove unneeded Lockstats::reset() calls Created: 10/Feb/23  Updated: 29/Oct/23  Resolved: 03/Mar/23

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

Type: Sub-task Priority: Major - P3
Reporter: Colin Stolley Assignee: Colin Stolley
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-05-15
Participants:
Linked BF Score: 30

 Description   

LockStats has a function called reset() which resets its counters to zero. These are all atomic sets, so they're not trivially cheap. LockStats unnecessarily calls reset() in both the constructor and the destructor. These are both called with every OperationContext's lifetime, so it's a pretty hot path.

The constructor doesn't need to call reset() because it can construct the atomics with an initial value of 0 instead. Initial values are not set atomically, which makes them cheaper.

The destructor doesn't need to call reset() because the object is in the process of being destroyed. This was probably a copy/paste mistake.



 Comments   
Comment by Githook User [ 02/Mar/23 ]

Author:

{'name': 'Colin Stolley', 'email': 'colin.stolley@mongodb.com', 'username': 'ccstolley'}

Message: SERVER-73908: Remove unneeded reset calls.
Branch: master
https://github.com/mongodb/mongo/commit/07cced070b8b2f4e6d2704060138c56ca238239d

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