[SERVER-48676] Create reshardCollection command on router Created: 09/Jun/20  Updated: 29/Oct/23  Resolved: 02/Jul/20

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

Type: Task Priority: Major - P3
Reporter: Blake Oler Assignee: Kshitij Gupta
Resolution: Fixed Votes: 0
Labels: PM-234-M1, PM-234-T-lifecycle
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2020-06-15, Sharding 2020-06-29
Participants:

 Description   
  • Add required input parameter validation.
  • Add unit tests
  • Add integration tests.

Step One: Creating the command files.

  1. Take the schema defined in the technical design for the project. Translate it to an IDL file, and place it in src/mongo/s/request_types/reshard_collection.idl
  2. Create a corresponding C++ command file in src/mongo/s/commands/cluster_reshard_collection_cmd.cpp. This command may just return true for now.
  3. Make a Javascript test that calls this command and asserts that it returns true. This won't be something that's going to be pushed in its state, but may serve as a stub to verify that your code is working properly while you're building up this command.

Step Two: Adding input validation.

  • Ensure that the namespace entered follows valid namespace rules. There should be other commands that validate this that you can copy from.
  • Ensure that the namespace conforms to a collection that exists and is sharded. This may be done by checking the collection's routing info through the CatalogCache object. Let blake.oler know if you need help on this.
  • Verify that if unique is specified, that it is false.
  • Locally populate numInitialChunks to be the existing number of chunks in the original collection if it is not specified. This information can also be extracted from the collection's routing info through the CatalogCache object.
  • Verify that the collation is set to { locale: "simple" }

    if specified. You may want to set this to a string/other constant in the command file to avoid a magic string.

  • Verify that if _presetReshardedChunks is set, that test commands are enabled. This should be a global variable, do a grep/search for testCommandsEnabled or something similar.

Step Three: Creating integration tests

  • Create tests verifying that the input validation is correctly followed.


 Comments   
Comment by Githook User [ 02/Jul/20 ]

Author:

{'name': 'Kshitij Gupta', 'email': 'kshitij.gupta@mongodb.com', 'username': 'kshitijng'}

Message: SERVER-48676: Create reshardCollection command on router.
Branch: master
https://github.com/mongodb/mongo/commit/2bdac781a19690e80880bd1c7b22f1d0d3d2b7b2

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