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

Setting wildcard index as multikey can cause prepare conflicts

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • Hide

      1. Create a wildcard index
      2. Make the index multikey as part of a transaction
      3. Prepare the transaction
      4. Insert a doc into the same collection that would make the index multikey

      Show
      1. Create a wildcard index 2. Make the index multikey as part of a transaction 3. Prepare the transaction 4. Insert a doc into the same collection that would make the index multikey
    • 15

      We can cause a prepare conflict if we set a wildcard index as multikey as part of a prepared transaction and then try to set it as multikey through a write separate from the transaction.

      The conflict comes from when we insert keys into the index itself for wildcard indexes (multiMetadataKeys is populated by the wildcard_key_generator). I think that is done in the same wuow as the transaction, which means that it will generate a prepare conflict if we try to write on top of it.

      I suspect this would be resolved if we did these writes in a side transaction block, like when we set the index as multikey.

        1. repro.js
          2 kB
          Samyukta Lanka

            Assignee:
            judah.schvimer@mongodb.com Judah Schvimer
            Reporter:
            samy.lanka@mongodb.com Samyukta Lanka
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: