[SERVER-50489] [polish] Not link ReplicaSetAwareServiceRegistry, PrimaryOnlyService, and TenantMigrationDonorService into embedded Created: 24/Aug/20  Updated: 06/Dec/22  Resolved: 08/Apr/21

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

Type: Task Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: [DO NOT USE] Backlog - Sharding NYC
Resolution: Won't Fix Votes: 0
Labels: pm-1791_non-cloud-blocking, pm-1791_polish
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-50066 Rehost tenant migration donor's logic... Closed
Assigned Teams:
Sharding NYC
Participants:

 Description   

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.


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