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

Spurious WriteConflict error with multi-statement transactions

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.7.4
    • Component/s: Storage
    • None
    • Replication
    • ALL

          ses = db.getMongo().startSession()
          dbs = ses.getDatabase("test")
      
          printjson(dbs.createCollection("c", {writeConcern: {w: "majority"}}))
      
          print("TRANSACTION 1")
          printjson(ses.startTransaction())
          printjson(dbs.c.insert({_id: 0}))
          printjson(ses.commitTransaction())
      
          print("TRANSACTION 2")
          printjson(ses.startTransaction())
          printjson(dbs.c.insert({_id: 1}))
          printjson(ses.commitTransaction())
      

      The second transaction fails with

      assert: command failed: {
      	"operationTime" : Timestamp(1524048246, 2),
      	"ok" : 0,
      	"errmsg" : "WriteConflict",
      	"code" : 112,
      	"codeName" : "WriteConflict",
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1524048246, 3),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      }
      

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            bruce.lucas@mongodb.com Bruce Lucas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: