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

Remove validation prohibiting $-prefix fields in _id

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Optimization

    Description

      As part of SERVER-49117 it was attempted to remove the validation on the _id field guaranteeing that $-prefixed fields should not be allowed:
      https://github.com/mongodb/mongo/commit/995f0406d72b1a15d18b2df2d8c0afa0c4c5b774#diff-5295b5000db7b3711a31f86ebbe374e929270da88b36b20d3459c9b1d4f48d17R135-R136

      However, this caused a failure in a fuzzer test: BF-21074

      The cause was that while this validation was removed on document inserts, when a subsequent update is made and written to the oplog, the generated update request follows a path that still enforces the validation that _id cannot contain $-prefixed fields, which results in a uassert being triggered.

      Relevant code: https://github.com/mongodb/mongo/blob/master/src/mongo/db/repl/oplog.cpp#L1360-L1366

      This path on inserts may potentially experience the same problem if we remove the validation on _id:
      https://github.com/mongodb/mongo/blob/b06cffeabf1d6152f3cf722efb07a144480d3917/src/mongo/db/repl/oplog.cpp#L1302-L1316

      Subsequently, removing the validation on _id will need to fix the first and possibly also the second path mentioned above.

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            alya.berciu@mongodb.com Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: