[SERVER-64097] CommandHelpers::runCommandInvocation and similar functions should not grab a shared_ptr to CommandInvocationHooks Created: 01/Mar/22  Updated: 29/Oct/23  Resolved: 11/Mar/22

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

Type: Improvement Priority: Major - P3
Reporter: Matt Diener (Inactive) Assignee: Matt Diener (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2022-03-07, Service Arch 2022-03-21
Participants:
Linked BF Score: 130

 Description   

 This was discovered while investigating BF-24415

In commands.cpp, CommandHelpers::runCommandInvocation, we do:

auto hooks = getCommandInvocationHooksHandle(opCtx->getServiceContext());

Given that the ServiceContext keeps keeps the CommandInvocationHooks alive, there is no need for hooks to be a shared_ptr. getCommandInvocationHooksHandle should not cause us to Incref and Decref. 

We don't expect for this to address the root cause of BF-BF-24415, but we do expect it to manifest more clearly if we introduce this change.



 Comments   
Comment by Githook User [ 11/Mar/22 ]

Author:

{'name': 'Matt Diener', 'email': 'matt.diener@mongodb.com', 'username': 'mattdiener'}

Message: SERVER-64097 replace CommandInvocationHooksHandle with a unique_ptr
Branch: master
https://github.com/mongodb/mongo/commit/54353d64dd622a9477eb2e3f82f4f63d4d6d5674

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