Fix UpdateDriver::modsAffectIndices false-negative in v6.0

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Do
    • Priority: Major - P3
    • None
    • Affects Version/s: 6.0.4
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • Hide

      reproduce.js script is attached

      Show
      reproduce.js script is attached
    • QE 2023-05-15, QE 2023-05-29
    • 9
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In mongod versions <= 6.0 UpdateDriver::modsAffectIndices can produce false-negative result.

      It is fixed in 6.3.0-rc0 with SERVER-65364, but this change is too massive to safely backport it as is even to 6.0.

      In this ticket we need to implement a custom small fix to 6.0 and try to backport it as far as possible.

      How to reproduce:

      1. Create wildcard index 
        {"b.d.$**": 1} 
      1. Add document 
        {a: 1}
        
      1. Update document with 
        {$set: {"b.c": 1}}
        
      1. Call validate({full: true}) on the collection.

      Validation will show that there is missing index key "b" for the updated document. It is also possible for extra index keys to be present due to this issue.

      Fortunately this redundant key will never be used because the path 'b' is not covered by the wildcard path, b.d.$** and the index bounds generated for wildcard indexes will always match the path.

            Assignee:
            Ivan Fefer
            Reporter:
            Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: