Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-50489

[polish] Not link ReplicaSetAwareServiceRegistry, PrimaryOnlyService, and TenantMigrationDonorService into embedded

    • 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.

            Assignee:
            backlog-server-sharding-nyc [DO NOT USE] Backlog - Sharding NYC
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: