Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-48676

Create reshardCollection command on router

    • Fully Compatible
    • Sharding 2020-06-15, Sharding 2020-06-29

      • 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.

            Assignee:
            kshitij.gupta@mongodb.com Kshitij Gupta
            Reporter:
            blake.oler@mongodb.com Blake Oler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: