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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.1
    • Affects Version/s: 1.8.1
    • Component/s: Internal Code, Sharding
    • Labels:
      None
    • Environment:
      linux x64
    • ALL

      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}

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            stikhonov Sergey Tikhonov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: