[SERVER-50467] Ensure that tenant migration donor only removes a ReplicaSetMonitor for a recipient when the last migration to that recipient completes Created: 21/Aug/20  Updated: 29/Oct/23  Resolved: 08/Dec/20

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

Type: Task Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Andrew Shuvalov (Inactive)
Resolution: Fixed Votes: 0
Labels: pm-1791_milestone-D
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-51440 Cleanup refcounting and lifetime of R... Closed
Problem/Incident
Related
related to SERVER-53276 After tenant migration, recipient sid... Closed
related to SERVER-50093 Test that donor supports running mult... Closed
is related to SERVER-50189 Replace ReplicaSetMonitorManager::rem... Backlog
is related to SERVER-51413 RemoteCommandTargeterRS custom delete... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2020-10-19, Sharding 2020-11-02, Sharding 2020-11-16, Sharding 2020-11-30, Sharding 2020-12-14
Participants:
Linked BF Score: 17

 Description   

SERVER-49789 made a TenantMigrationDonorService::Instance create a RemoteCommandTargeterRS for the recipient replica set at the beginning of its run() and capture the targeter into all the continuations in its future chain (like here).

See that ticket's description for background.

We handled destroying the donor's ReplicaSetMonitor for the recipient once the donor completed the migration by calling ReplicaSetMonitor::remove in the RemoteCommandTargeterRS destructor.

However, if the donor was migrating two tenants to the same recipient concurrently, the two migrations would be sharing the same ReplicaSetMonitor, and the first migration to finish would rip the ReplicaSetMonitor out from under the second migration.

This ticket is to ensure the ReplicaSetMonitor is only removed when the ReplicasSetMonitor does not have any more users.

There is already a commented-out test case for this here.



 Comments   
Comment by Githook User [ 08/Dec/20 ]

Author:

{'name': 'Andrew Shuvalov', 'email': 'andrew.shuvalov@mongodb.com', 'username': 'shuvalov-mdb'}

Message: SERVER-50467: Added TODO SERVER-53276 to fix recipient side tenant migration RSM lifetime bug
Branch: master
https://github.com/mongodb/mongo/commit/987484b4aa34deea1db7d70228989b83448a24e8

Comment by Githook User [ 08/Dec/20 ]

Author:

{'name': 'Andrew Shuvalov', 'email': 'andrew.shuvalov@mongodb.com', 'username': 'shuvalov-mdb'}

Message: SERVER-50467: Ensure that tenant migration donor only removes a ReplicaSetMonitor for a recipient when the last migration to that recipient completes
Branch: master
https://github.com/mongodb/mongo/commit/f3a221e769527f1709dae21e832729da52af6e83

Comment by Githook User [ 24/Nov/20 ]

Author:

{'name': 'Andrew Shuvalov', 'email': 'andrew.shuvalov@mongodb.com', 'username': 'shuvalov-mdb'}

Message: SERVER-50467: StreamableReplicaSetMonitor should call drop on itself from destructor
Branch: master
https://github.com/mongodb/mongo/commit/c50282b539308d1578465fa0819e228a47d3421e

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