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

Move CommitChunkMigration command implementation into a Catalog function and unit test it

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4.2, 3.5.2
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v3.4
    • Sprint:
      Sharding 2016-10-31, Sharding 2016-11-21, Sharding 2016-12-12, Sharding 2017-01-02

      Description

      While working on SERVER-25875, it became evident that to adequately test the CommitChunkMigration command with JS testing requires cumbersome failpoint additions. Continuing to add failpoints would make future changes increasingly difficult. Unit testing is far more appropriate in this case than adding failpoints and JS test setup in order to mimic unit testing.

      As part of this ticket, the code from the CommitChunkMigration command should be moved to be a commitChunkMigration method on ShardingCatalogManager with the following parameters:

      • Collection namespace
      • Migrated chunk - ChunkType
      • Control chunk (optional) - ChunkType
      • From shard - ShardId
      • To shard - ShardId

      The current parameters fromShardCollectionVersion and shardHasDistributedLock will be removed in place of the exact chunk version being transmitted and the newly written unit-tests.

      In addition to the change above, unit-tests must be implemented similar to what we do for split and merge. The following test case should be included:

      • Correctly migrating a chunk
      • Correctly migrating the last chunk from a shard (i.e., there is no control chunk)
      • The expected chunk version does not match
      • The expected chunk epoch does not match
      • The from shard does not match

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: