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

Add to documentation: sh.addTagRange() splits chunks at min

    XMLWordPrintableJSON

Details

    • 0.25

    Description

      When performing sh.addTagRange(ns, min, max, tag), the chunk is split at min (if not already split there).

      This should be made explicit so that users know the full effect of their addTagRange command.

      Here is the addTagRange doc:

      http://docs.mongodb.org/manual/reference/method/sh.addTagRange/

      Steps to Reproduce:

      mongos> sh.enableSharding("testDB")
      { "ok" : 1 }
      mongos> sh.shardCollection("testDB.testColl", { a : 1 } )
      { "collectionsharded" : "testDB.testColl", "ok" : 1 }
      mongos> sh.status()
      --- Sharding Status ---
        sharding version: {
      	"_id" : 1,
      	"version" : 4,
      	"minCompatibleVersion" : 4,
      	"currentVersion" : 5,
      	"clusterId" : ObjectId("53f67f7cd68704c62f3f8b31")
      }
        shards:
      	{  "_id" : "shard01",  "host" : "shard01/will-macbook-air.local:27018,will-macbook-air.local:27019,will-macbook-air.local:27020" }
      	{  "_id" : "shard02",  "host" : "shard02/will-macbook-air.local:27021,will-macbook-air.local:27022,will-macbook-air.local:27023" }
      	{  "_id" : "shard03",  "host" : "shard03/will-macbook-air.local:27024,will-macbook-air.local:27025,will-macbook-air.local:27026" }
        databases:
      	{  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
      	{  "_id" : "testDB",  "partitioned" : true,  "primary" : "shard01" }
      		testDB.testColl
      			shard key: { "a" : 1 }
      			chunks:
      				shard01	1
      			{ "a" : { "$minKey" : 1 } } -->> { "a" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
      	{  "_id" : "grades",  "partitioned" : false,  "primary" : "shard02" }
       
      mongos> sh.addTagRange("testDB.testColl", { a : 3 }, { a : 5 }, "asdf" )
      mongos> sh.status()
      --- Sharding Status ---
        sharding version: {
      	"_id" : 1,
      	"version" : 4,
      	"minCompatibleVersion" : 4,
      	"currentVersion" : 5,
      	"clusterId" : ObjectId("53f67f7cd68704c62f3f8b31")
      }
        shards:
      	{  "_id" : "shard01",  "host" : "shard01/will-macbook-air.local:27018,will-macbook-air.local:27019,will-macbook-air.local:27020" }
      	{  "_id" : "shard02",  "host" : "shard02/will-macbook-air.local:27021,will-macbook-air.local:27022,will-macbook-air.local:27023" }
      	{  "_id" : "shard03",  "host" : "shard03/will-macbook-air.local:27024,will-macbook-air.local:27025,will-macbook-air.local:27026" }
        databases:
      	{  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
      	{  "_id" : "testDB",  "partitioned" : true,  "primary" : "shard01" }
      		testDB.testColl
      			shard key: { "a" : 1 }
      			chunks:
      				shard01	2
      			{ "a" : { "$minKey" : 1 } } -->> { "a" : 3 } on : shard01 Timestamp(1, 1)
      			{ "a" : 3 } -->> { "a" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 2)
      			 tag: asdf  { "a" : 3 } -->> { "a" : 5 }
      	{  "_id" : "grades",  "partitioned" : false,  "primary" : "shard02" }
       
      mongos>

      Attachments

        Activity

          People

            steve.renaker@mongodb.com Steve Renaker (Inactive)
            william.cross William Cross
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 2 weeks ago