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

MoveChunk should allow you to specify a chunk via its bounds

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.2
    • Affects Version/s: 2.3.0
    • Component/s: Sharding
    • None

      Right now when you call moveChunk on mongos, you specify a chunk to move via a "find", e.g.

      > db.adminCommand({moveChunk : "test.foo" , find : {a : 5} , to : "shard0001"})
      

      The semantics of this are "find the chunk that contains the doc

      {a : 5}

      , and move it to shard0001."

      With hashed shard keys, the chunks are ranges of hashes, so a single chunk might be from say

      { "a" : NumberLong("8234") }

      -->>

      { "a" : NumberLong("9543") }

      . Right now there's no way to specify this particular chunk unless you use a doc whose 'a' value hashes to somewhere in the range [8234,9543).

      As alternative to the "find" syntax, moveChunk should also allow you to specify a chunk via its upper and lower bounds, as with the following syntax:

      > db.adminCommand({moveChunk : "test.foo" , bounds : [ {a : NumberLong("8234")} , { "a" : NumberLong("9543") } ] , to : "shard0001"})
      

      This allows the user to be very explicit about which chunk they want to move (the command would just return an error if no chunk with those upper and lower bounds exists).

            Assignee:
            matulef Kevin Matulef
            Reporter:
            matulef Kevin Matulef
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: