[SERVER-85157] Simplify concurrency of directshardoperation log-message check Created: 12/Jan/24  Updated: 16/Jan/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: George Wangensteen Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Sprint: Service Arch Prioritized List
Participants:

 Description   

We log a message warning users about performing operations via a direct-connection to a shard if we haven't already done so in the last hour. We check if we have logged in the last hour by storing the time we last logged at, protecting access to that time with a global mutex (https://github.com/mongodb/mongo/blob/531c4daba675e1a8a5213af7823ac01bccf0e8f7/src/mongo/db/service_entry_point_common.cpp#L1821-L1833) and checking that time under the mutex (along with taking the current time) on the path of every operation subject to this check.
This static mutex is therefore contended on by every direct-shard-operation thread. I think we can come up with a simpler way to control logging this message that doesn't require a mutex.


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