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

Certain types of invalid keys which buggy drivers permit (such as invalid $ operators) can save in server validly, but choke replication

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.6.5
    • Component/s: Replication
    • Labels:
      None
    • ALL

      Certain keys which are technically invalid in MongoDB can still be inserted into the database and save validly.

      However, they will choke the replication system and cause all secondaries' attempts to replicate that data to fail.

      By way of example, Java Drivers prior to version 2.4 allowed insert with an arbitrary made-up "$" operator field name, which will insert correctly but fail on replication as evinced in CS-1059.

      Using a release of Casbah linked against Java Driver 2.3, I can insert the following:

      scala> m.insert(MongoDBObject("_id" -> MongoDBObject("$uid" -> "OMGWTFBBQ")))
      res1: com.mongodb.WriteResult =

      { "n" : 0 , "connectionId" : 253 , "err" : null , "ok" : 1.0}

      Which shows up in MongoDB as:

      > db.omgPonies.find()
      { "_id" :

      { "$uid" : "OMGWTFBBQ" }

      }

      Replica members will, however, report an error when trying to replicate the oplog entry for the insert along the lines of "[rs_sync] replSet syncThread: 10068 invalid operator: $uid "

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            brendan Brendan W. McAdams
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: