[SERVER-61067] Add test that afterClusterTime find against mongos returns TenantMigrationCommitted Created: 28/Oct/21  Updated: 01/Nov/21  Resolved: 01/Nov/21

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

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Sophia Tan
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Once a tenant migration has committed, the donor will reject reads with a readTimestamp later than the blockTimestamp.

This ticket is to add a test that the TenantMigrationCommitted error is currently passed back from the donor through mongos/mongoq to the client. (In a later ticket, we'll update mongos/mongoq to handle TenantMigrationCommitted internally by retrying against the recipient.)

In order to generate a read with a readTimestamp later than the blockTimestamp, we can do the following:

  • Start a ShardingTest with two mongos and with the noop writer turned off on the shards
  • Use enableSharding to create a database
  • Use movePrimary to ensure the database's primary shard is the first shard
  • Start a causally consistent session
  • Run a find through the first mongos to make the first mongos load the database entry into its cache
  • Run a tenant migration and wait for it to commit
  • Manually update the routing table on the config server to say the database lives on the recipient shard
  • Run a write through the second mongos to make the second mongos load the updated database entry into its cache and generate a clusterTime higher than that on the first shard
  • Run a read through the first mongos, which will attach afterClusterTime of the clusterTime of the write since it's in a causally consistent session. The first mongos should still target the donor since it has the old database entry cached. The donor should return TenantMigrationCommitted. Assert that the first mongos passes this error back to the client.
     


 Comments   
Comment by Esha Maharishi (Inactive) [ 01/Nov/21 ]

This test would have been unnecessarily complex, since the find command will return TenantMigrationCommitted if sent after the migration has committed even if the find command does not have afterClusterTime.

We have a similar test for the count command here.

We are refactoring TenantMigrationDonorAccessBlocker::getCanReadFuture to improve its clarity under SERVER-61114.

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