-
Type: Task
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: 6.0.0
-
Labels:None
Starting from v6.0.0, sharded clusters introduce the moveRange command. The purpose of this ticket is to document the moveRange command that will replace moveChunk.
The command offers:
- All the capabilities of moveChunk command
- The possibility to move a sub-range of a chunk
Constraints:
- min and max need to either fit the boundaries of a chunk or be a sub-range of an existing chunk. It is not allowed to invoke moveRange on a range spanning multiple chunks.
The command is accepting the following parameters:
- toShard: ID of the recipient shard
- min: the min key of the range to move
- max [optional]: the max key of the range to move. If not specified, given a chunk C including the shard key min, max is going to be automatically calculated as follows:
- If the data size of the range between min and max(C) is less than the per-collection chunk size (if set) or the default chunk size , then the chunk's max is going to be selected as max = max(C)
- Otherwise, key max < max(C) where max(C) depends on the configured chunk size
- forceJumbo [optional]: if set to true, force jumbo chunk/range move. The default value is false.
- waitForDelete [optional]: if set to true, wait for the chunk migration to finish before returning. The default value is false.
- writeConcern [optional]: (default = majority)
- secondaryThrottle [optional]: if set to true, wait for writeConcern of secondaries to acknowledge data moving. The default value is false.
Examples
All the following examples are considering a sharded collection with shard key x, configured chunk size 128MB, and a chunk with boundaries [x: 0, x: 100).
Both boundaries specified
- User can call moveRange with min = 0, max = 100 (behavior equivalent to moveChunk)
- User can call moveRange with min>=0 && max <=100 (new behavior, potentially resulting in splits + move):
- E.g. moveRange with min = 10, max = 30 will create 3 chunks and move the middle one to the recipient: [x: 0, x: 10), [x: 10, x: 30), [x: 30, x: 100)
- E.g. moveRange with min = 0, max = 20 will create 2 chunks and move the left one to the recipient: [x: 0, x: 20), [x: 20, x: 100)
- E.g. moveRange with min = 40, max = 100 will create 2 chunks and move the right one to the recipient: [x: 0, x: 40), [x: 40, x: 100)
Only min specified (max will be calculated)
- User can call moveRange with 0 <= min < 100
- E.g. moveRange with min = 0, assuming less than 128MB contained between keys x: 0 and x:100: equivalent to moveChunk, will move the whole chunk on the recipient
- E.g. moveRange with min = 10, assuming less than 128MB contained between keys x: 10 and x:100: will create 2 chunks and move the right one on the recipient: [x: 0, x: 10), [x: 10, x: 100)
- E.g. moveRange with min = 10, assuming 128MB contained between keys x: 10 and x:30: will create 3 chunks and move the middle one on the recipient: [x: 0, x: 10), [x: 10, x: 30), [x: 30, x: 100)
- causes
-
DOCS-16004 [Server] Add command name in `moveRange` example
- Closed
- has to be done before
-
DOCS-15340 [Server] Document change of balancing policy
- Closed
- is duplicated by
-
DOCS-15332 Investigate changes in SERVER-64195: Provide user-facing `moveRange` command
- Closed
- related to
-
SERVER-66805 Change public-facing `moveRange::forceJumbo` to bool type
- Closed