-
Type: Task
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Sharding
-
Sharding NYC
As part of SERVER-50066, tenant_migration_donor_service.cpp was put in its own library due to issues with the destructor of ReplicaSetAwareServiceRegistry on embedded which caused this invariant to fail. Here is a quote of Esha's code review comment for this:
"mongod calls setGlobalServiceContext here in mongod startup but the ServiceContext never gets destroyed. On the other hand, embedded also calls setGlobalServiceContext in startup but also calls it again with nullptr on shutdown. [...] This means since ReplicaSetAwareServiceRegistry is a decoration on ServiceContext, its destructor doesn't run in mongod but does run in embedded. So, the invariant maybe would be triggered in both mongod and embedded if ServiceContext was being destroyed in mongod. As for why the invariant is being triggered at all, I think the ServiceContextDeleter's operator() is supposed to invoke the DestructorActions registered via ConstructorActionRegisterer by calling 'onDestroy'. The DestructorAction should call ReplicaSetAwareServiceRegistry::_unregisterService which should erase the service from the list. I have not figured out why the ReplicaSetAwareServiceRegistry's destructor
appears to be getting called before the 'onDestroy' (or why 'onDestroy' is not
getting called at all)."
We should investigate that further and find a library to put tenant_migration_donor_service.cpp and other primary-only services.
- is related to
-
SERVER-50066 Rehost tenant migration donor's logic on Primary-Only Service
- Closed