-
Type: Sub-task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Cluster Scalability
-
Fully Compatible
-
Cluster Scalability 2024-07-08, Cluster Scalability 2024-07-22, Cluster Scalability 2024-08-19
The ReshardingRecipientService is a primary only service that is responsible for driving resharding on the recipient shard (cloning the initial documents, applying oplog entries that occured after the initial cloning etc).The recipient service code starts in the run() function.
If you trace the code in the run() function, you will see that buildIndexThenTransitionToApplying() eventually gets called, which is the function starts the service that builds the indexes on the temporary resharding collections (this is the "index phase" in the resharding technical document). Inside that function there is already code to get information on all the indexes for the collection that is being resharded on.
So what needs to be done is to loop through those results to get all the indexes with {unqiue: true} and also figure out where to store that information (it might be an existing resharding metadata collection or a new one). For the last step please reach out to someone on the team knowledgable on resharding to get their idea (Randolph Tan for example is a good resource).
To get a better intuition for the code, try writing a small test that runs reshardCollection and add logs in the buildIndexThenTransitionToApplying function for anything you think is relevant to this ticket. To log you can use the `logd()` function. Example: logd("value of this variable: {}", variable). Note that only objects with a toString() function (such as BsonObj) can be logged.