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

Update onPrimaryTransactionalWrite fail point for multi-statement transactions

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Repl 2018-04-23

      For the sake of driver testing, let's make the onPrimaryTransactionalWrite fail point work the same within a multi-statement transaction as it does for retryable writes. It looks like this fail point still works in 3.7 as expected for retryable writes, but we can't currently use it for testing multi-statement transactions because it has no effect for commands that include "autocommit: false"?

      Here's some mongoreplay output:

      driver sends configureFailPoint and server replies ok: 1
      
      21 Mar 18 17:22 -0400 (Connection: 407:1817129560)  command configureFailPoint admin.$cmd Request:{"$clusterTime":{"clusterTime":{"$timestamp":{"t":1521667353,"i":1}},"signature":{"hash":{"$binary":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","$type":"00"},"keyId":{"$numberLong":"0"}}},"configureFailPoint":"onPrimaryTransactionalWrite","data":{"closeConnection":false,"failBeforeCommitExceptionCode":17},"lsid":{"id":{"$binary":"mekpcqQ5QaKw66XYtFR4bg==","$type":"04"}},"mode":{"times":2}}
      
      21 Mar 18 17:22 -0400 (Connection: 407:1817129560) +158µs reply    Response:{"$clusterTime":{"clusterTime":{"$timestamp":{"t":1521667354,"i":2}},"signature":{"hash":{"$binary":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","$type":"00"},"keyId":{"$numberLong":"0"}}},"ok":1.0,"operationTime":{"$timestamp":{"t":1521667354,"i":2}}}
      
      Driver sends an insert with autocommit: false:
      
      21 Mar 18 17:22 -0400 (Connection: 406:1131570933)  insert  transaction-tests.$cmd Request:{"$clusterTime":{"clusterTime":{"$timestamp":{"t":1521667354,"i":2}},"signature":{"hash":{"$binary":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","$type":"00"},"keyId":{"$numberLong":"0"}}},"autocommit":false,"documents":[{"_id":1}],"insert":"test","lsid":{"id":{"$binary":"yXw7GM3+T3mtzKDW6+vsQA==","$type":"04"}},"ordered":true,"readConcern":{"level":"snapshot"},"stmtId":0,"txnNumber":{"$numberLong":"1"}}
      
      It succeeds, unexpectedly:
      
      21 Mar 18 17:22 -0400 (Connection: 406:1131570933) +332µs reply    Response:{"$clusterTime":{"clusterTime":{"$timestamp":{"t":1521667354,"i":3}},"signature":{"hash":{"$binary":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","$type":"00"},"keyId":{"$numberLong":"0"}}},"electionId":{"$oid":"7fffffff000000000000000d"},"n":1,"ok":1.0,"opTime":{"t":{"$numberLong":"13"},"ts":{"$timestamp":{"t":1521667354,"i":2}}},"operationTime":{"$timestamp":{"t":1521667354,"i":2}}}
      

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: