Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12618

The arguments for splitChunk are not documented correctly

      Description

      Here the first field name is said to be ns, but in fact the name of the field that specifies the namespace is splitChunk. Here is an example of the command logged by the server on v3.6:

      2019-04-11T18:29:10.364+1000 I COMMAND  [conn48] command admin.$cmd appName: "MongoDB Shell" command:   splitChunk {
        	splitChunk: "test.s",
        	from: "myShard_0",
        	keyPattern: {
        		_id: "hashed"
        	},
        	epoch: ObjectId('5caee45fa3d6aee92bcb4aa4'),
        	shardVersion: [Timestamp(12, 1), ObjectId('5caee45fa3d6aee92bcb4aa4')],
        	min: {
        		_id: 5711438324243501269
        	},
        	max: {
        		_id: 6918684992004911231 splitKeys: [{
        			_id: 6316025472438991097
        		}],
        		lsid: {
        			id: UUID("f783a577-4dfb-4f1d-8916-2b99ed81f1b7"),
        			uid: BinData(0, 3 B408CB48548B5037822C10EB0976B3CBF2CEE3BF9C708796BF03941FBECD80)
        		},
        		$clusterTime: {
        			clusterTime: Timestamp(1554971349, 1),
        			signature: {
        				hash: BinData(0, 0000000000000000000000000000000000000000),
        				keyId: 0
        			}
        		},
        		$client: {
        			application: {
        				name: "Mongo Shell"
        			},
        			driver: {
        				name: "MongoDB Internal Client",
        				version: "4.0.6"
        			},
        			os: {
        				type: "Linux",
        				name: "Ubuntu",
        				architecture: "x86_64",
        				version: "14.04"
        			},
        			mongos: {
        				host: "lubuntu:27017",
        				client: "127.0.0.1:59094",
        				version: "3.6.7"
        			}
        		},
        		$configServerState: {
        			opTime: {
        				ts: Timestamp(1554971349, 1),
        				t: 4
        			}
        		},
        		$db: "admin"
        	}
        	numYields: 0 reslen: 268 locks: {
        		Global: {
        			acquiCount: {
        				r: 2
        			}
        		},
        		Database: {
        			acquireCount: {
        				r: 1
        			}
        		},
        		Collection: {
        			acquireCount: {
        				r: 1
        			}
        		}
        	}
        	protocol: op_msg 54 ms
      

      Another issue is shardId. As per the above log, the shard names is passed via the from field. The shardId field is not present needed.

      One more - splitKeys takes an array of split points so splitChunk can potentially split chunk in more than one point.

      Finally, shardVersion is required, but not listed.

      Thus for v3.6 and above the list of arguments should look like:

      Field Type Description
      splitChunk string The complete namespace of the chunk to split.
      keyPattern document The shard key.
      min document The lower bound of the shard key for the chunk to split.
      max document The upper bound of the shard key for the chunk to split.
      from string The shard that owns the chunk to split.
      splitKeys array of documents The split points for the chunk.
      shardVersion array The shard version of the namespace.

      For v3.4 it should be:

      Field Type Description
      splitChunk string The complete namespace of the chunk to split.
      keyPattern document The shard key.
      min document The lower bound of the shard key for the chunk to split.
      max document The upper bound of the shard key for the chunk to split.
      from string The shard that owns the chunk to split.
      splitKeys array of documents The split points for the chunk.
      shardVersion array The shard version of the namespace.
      configdb string Connection string for the CSRS

      Right now we shows the same list of fields regardless of the MongoDB version toggled in the documentation.

      Scope of changes

      • Navigate the MongoDB code base to validate the required fields for splitChunks
      • Document them for 4.2, 4.0, 3.6
      • update fields - do not provide examples, as this is still an internal-only command
      • Confirm w/ sharding for external review.

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            Unassigned Unassigned
            Reporter:
            dmitry.ryabtsev@mongodb.com Dmitry Ryabtsev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              1 year, 25 weeks, 2 days ago