V1 index broken for BinData larger than 32 bytes

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Blocker - P1
    • 1.9.2
    • Affects Version/s: 1.9.1
    • Component/s: Index Maintenance
    • None
    • ALL
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      Base64 of 33byte string created like this in python:
      In [7]: ('x'*33).encode('base64')
      Out[7]: 'eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\n'

      > db.foo.drop()
      true
      > b = new BinData(0,'eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4')
      BinData(0,"eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4")
      > db.foo.insert(

      {b:b}

      )
      > db.foo.count(

      {b:b}

      )
      1
      > db.foo.ensureIndex(

      {b:1}

      ,

      {v:1}

      )
      > db.foo.count(

      {b:b}

      )
      0
      > db.foo.dropIndex(

      {b:1}

      )

      { "nIndexesWas" : 2, "ok" : 1 }

      > db.foo.ensureIndex(

      {b:1}

      ,

      {v:0}

      )
      > db.foo.count(

      {b:b}

      )
      1

      The problem is in KeyV1Owned constructor. We need to check if len <= 32 before this line https://github.com/mongodb/mongo/blob/master/db/key.cpp#L267

            Assignee:
            Dwight Merriman
            Reporter:
            Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: