[SERVER-61700] Implement TenantToShardCache::getShard Created: 22/Nov/21 Updated: 06/Dec/22 Resolved: 06/Jan/22 |
|
| 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: | [DO NOT USE] Backlog - Server Serverless (Inactive) |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Serverless
|
| Participants: |
| Description |
|
Implement TenantToShardCache::getShard(OID& tenantId) to load the shard for the tenant from config.tenants on the config servers. For this ticket, we can give TenantToShardCache a private map from tenantId (OID) to ShardId. getShard can simply look up from this map. In a future ticket, we will replace the private map with a private ReadThroughCache. If there is no entry in the map, TenantToShardCache::getShard should load the entry from config.tenants, which is currently on the config servers. To do this, TenantToShardCache::getShard can call a new method similar to ShardingCatalogClient::getCollection, which reads from config.collections on the config servers. This ticket should add a unit test of TenantToShardCache::getShard, and can use catalog_cache_test.cpp's GetDatabase and GetCachedDatabase as examples. – Additional implementation notes: 1. The ObjectId type in cpp is OID. Here is an example of a hash map keyed by OID. 2. ShardingCatalogClient::getCollection returns a CollectionType, which is parser and serializer in cpp. It wraps CollectionTypeBase, which is a parser and serializer in IDL. We should create a TenantType, and use IDL. TenantType should contain a tenant id of IDL type 'objectid' (example) and shard id of IDL type 'shard_id' (example). 'objectid' converts to OID in cpp, and 'shard_id' converts to ShardId in cpp. |
| Comments |
| Comment by Mathis Bessa [ 20/Dec/21 ] |
|
Blocking this Jira following up our conversation about options we have for serverless architecture plans. |