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

chunkSplit doesn't check order of fields in compound key in 'middle' param and damages config.chunks collection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.9.1
    • Component/s: Internal Code, Sharding
    • Labels:
      None
    • Environment:
      linux x64
    • Operating System:
      ALL

      Description

      First, sharding:

      > db.adminCommand( { shardcollection : "test.insert_test", key :

      {"b":1,"a":1}

      });

      { "collectionsharded" : "test.insert_test", "ok" : 1 }

      Then splitting (look at 'a' and 'b' order in shard key and split):

      > db.adminCommand( { split : "test.insert_test" , middle :

      { 'a' : 0,'b':1 }

      } )

      { "ok" : 1 }

      > use config
      switched to db config
      > db.chunks.find()
      { "_id" : "test.insert_test-b_MinKeya_MinKey", "lastmod" :

      { "t" : 1000, "i" : 1 }

      , "ns" : "test.insert_test", "min" : { "b" :

      { $minKey : 1 }

      , "a" :

      { $minKey : 1 }

      }, "max" :

      { "a" : 0, "b" : 1 }

      , "shard" : "shard0000" }
      { "_id" : "test.insert_test-a_0.0b_1.0", "lastmod" :

      { "t" : 1000, "i" : 2 }

      , "ns" : "test.insert_test", "min" :

      { "a" : 0, "b" : 1 }

      , "max" : { "b" :

      { $maxKey : 1 }

      , "a" :

      { $maxKey : 1 }

      }, "shard" : "shard0000" }

      after that any moveChunk command will fail with "Chunk map pointed to incorrect chunk" message, because BSONObj::woCompare, used for searching for a chunk, can't compare

      {'a':1,'b':0}

      with

      {'b':0, 'a':1}

        Attachments

          Activity

            People

            Assignee:
            redbeard0531 Mathias Stearn
            Reporter:
            stikhonov Sergey Tikhonov
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: