[SERVER-82725] Improve the locking in ProfilerFilter::getDefault Created: 02/Nov/23 Updated: 24/Jan/24 Resolved: 08/Dec/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.3.0-rc0 |
| Type: | Task | Priority: | Critical - P2 |
| Reporter: | Mark Benvenuto | Assignee: | Zixuan Zhuang |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | perf-8.0, perf-tiger, perf-tiger-handoff, perf-tiger-poc, perf-tiger-q4, query-perf-q4 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Execution
|
| Backwards Compatibility: | Fully Compatible |
| Sprint: | QE 2023-11-27, QE 2023-12-11 |
| Participants: |
| Description |
|
ProfilerFilter::getDefault/setDefault uses a global mutex to protect a shared pointer. C++20 adds support for atomic shared_ptr's but our toolchain v4 compilers do not yet support it. ProfilerFilter is rarely set. It is accessed during a findOne() twice: once in FindCommand::run() and HandleRequest::onSuccess Ideally, a cheap memory reclamation technology like hazard pointers could be used to protect writes to this shared pointer. But since that does not exist in the code base, an alternative is to use a partitioned reader/writer lock so that all the readers do not have to touch the same cache line for taking the reader/writer lock. |
| Comments |
| Comment by Githook User [ 08/Dec/23 ] |
|
Author: {'name': 'zixuan zhuang', 'email': 'zixuan.zhuang@mongodb.com', 'username': 'leozzx'}Message: GitOrigin-RevId: 512c4489d747dfcdf997d71f7c162370c22fe5b6 |