|
_startupComponent currently resets the unique_ptr if the component's startup() returns an error but not when the parent component is shutting down. This usually doesn't pose a problem except when the sub component is holding some resource that needs to be released if we decide not to proceed with calling its startup().
https://github.com/mongodb/mongo/blob/fa2dcc33303dd6a2080c108e121da6984d08a9d6/src/mongo/db/repl/initial_syncer.cpp#L1340
|
initial_syncer.cpp
|
1337
|
template <typename Component>
|
1338
|
Status InitialSyncer::_startupComponent_inlock(Component& component) {
|
1339
|
if (_isShuttingDown_inlock()) {
|
1340
|
return Status(ErrorCodes::CallbackCanceled,
|
1341
|
"initial syncer shutdown while trying to call startup() on component");
|
1342
|
}
|
1343
|
auto status = component->startup();
|
1344
|
if (!status.isOK()) {
|
1345
|
component.reset();
|
1346
|
}
|
1347
|
return status;
|
1348
|
}
|
|