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

findAndModify in sharded transactions and readConcern “majority” miss existing record

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Gone away
    • None
    • None
    • None
    • None
    • ALL

    Description

      I created a sharded cluster with 1 mongos, 1 config server and three shards each with a single node replica set.

      I pre-load the data and the contended table in question has this index:

      {D_W_ID:1,  D_ID:1, D_NEXT_O_ID:1, D_TAX:1}, {unique:true}
      

      in addition to _id index. The collection is sharded with shard key

       {D_W_ID:1, D_ID:1} 

      The following two contended operations start majority of transactions:

      db.coll.findAndModify({D_W_ID:1, D_ID:1}, /* query */
           {$inc:{D_NEXT_O_ID:1}}, /* update */
           {sort:{D_NEXT_O_ID:-1}}, /* sort */
           {fields:{_id:0, D_NEXT_O_ID:1, D_TAX:1}}, /* projection */
           {new:false}
      });
      Ddb.coll.findAndModify({D_W_ID:1, D_ID:1}, /* query */
           {$inc:{D_SOMEOTHER_FIELD:1}} /* update */
      });
      

      With readConcern “majority” every once in a while one of these two findAndModify commands matches 0 documents, which is impossible.

       

      There are no inserts, deletes or balancing happening to this collection, only lots of findAndModify and a very occasional find.

      Attachments

        Issue Links

          Activity

            People

              asya.kamsky@mongodb.com Asya Kamsky
              asya.kamsky@mongodb.com Asya Kamsky
              Votes:
              0 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: