Details
-
Task
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
-
None
-
None
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.