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

Incorrect command in the example used in "Merge Chunks in a Sharded Cluster"

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Major - P3
    • Resolution: Fixed
    • None
    • None
    • Server
    • None

    Description

      There is an example in Merge Chunks documentation page to show how the command works. But it is wrong and a bit confusing.

      Based on the first sh.status output, the following command won't work:

      db.runCommand( { mergeChunks: "test.users",
                       bounds: [ { "username": "user68982" },
                                 { "username": "user95197" } ]
                   } )
      

      Because the collection test.users doesn't have any chunk that starts with "user68982" or ends with "user95197". A user following the example will get this error:

      "errmsg" : "could not merge chunks, collection test.users does not contain a chunk starting at { users: \"user68982\" } or ending at { users: \"user95197\" }"

      Still, even ignoring the fact that the command won't work, the resulting sh.status() on the documentation makes no sense. There are merges done there that are not in the range specified anyway.

      This should be the correct example.

      Pre-merge chunks:

      { "username" : { "$minKey" : 1 } } -->> { "username" : "user16643" } on : shard02 Timestamp(2, 0) }}
      { "username" : "user16643" } -->> { "username" : "user2329" } on : shard02 Timestamp(3, 0) 
      { "username" : "user2329" } -->> { "username" : "user36583" } on : shard02 Timestamp(4, 0) 
      { "username" : "user36583" } -->> { "username" : "user43229" } on : shard02 Timestamp(5, 0) 
      { "username" : "user43229" } -->> { "username" : "user49877" } on : shard02 Timestamp(6, 0) 
      { "username" : "user49877" } -->> { "username" : "user56522" } on : shard02 Timestamp(7, 0) 
      { "username" : "user56522" } -->> { "username" : "user63169" } on : shard01 Timestamp(7, 1) 
      { "username" : "user63169" } -->> { "username" : "user69816" } on : shard01 Timestamp(1, 15) 
      { "username" : "user69816" } -->> { "username" : "user76462" } on : shard01 Timestamp(1, 17) 
      { "username" : "user76462" } -->> { "username" : "user83108" } on : shard01 Timestamp(1, 19) 
      { "username" : "user83108" } -->> { "username" : "user96401" } on : shard01 Timestamp(1, 21) 
      { "username" : "user96401" } -->> { "username" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 22)

      Merge Command:

      It would be important to mention in the documentation that this command needs to be run on admin database.

      db.runCommand( { mergeChunks: "test.users",
                       bounds: [ { "username": "user63169" },
                                 { "username": "user96401" } ]
                   } )

      Post-merge chunks:

      { "username" : { "$minKey" : 1 } } -->> { "username" : "user16643" } on : shard01 Timestamp(8, 0) 
      { "username" : "user16643" } -->> { "username" : "user2329" } on : shard02 Timestamp(8, 1) 
      { "username" : "user2329" } -->> { "username" : "user36583" } on : shard02 Timestamp(4, 0) 
      { "username" : "user36583" } -->> { "username" : "user43229" } on : shard02 Timestamp(5, 0) 
      { "username" : "user43229" } -->> { "username" : "user49877" } on : shard02 Timestamp(6, 0) 
      { "username" : "user49877" } -->> { "username" : "user56522" } on : shard02 Timestamp(7, 0) 
      { "username" : "user56522" } -->> { "username" : "user63169" } on : shard01 Timestamp(7, 1) 
      { "username" : "user63169" } -->> { "username" : "user96401" } on : shard01 Timestamp(7, 2) 
      { "username" : "user96401" } -->> { "username" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 22) 

      Attachments

        Issue Links

          Activity

            People

              kay.kim@mongodb.com Kay Kim (Inactive)
              miguel.nieto@mongodb.com Miguel Angel Nieto
              Kay Kim Kay Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3 years, 41 weeks, 6 days ago