Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4811

Failing errorContains assertion in callback-retry.json DuplicateKeyError test

    • Type: Icon: Build Failure Build Failure
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Transactions
    • Labels:
      None

      mongodb/specifications/commit/f5983a4 added an errorContains assertion to callback-retry.json in the withTransaction legacy spec test suite.

      libmongoc fails on this assertion, as the with_transaction method doesn't propagate the error message from the insertOne operation to its own bson_error_t. See this Evergreen task for related build failures. For example:

      - callback is not retried after non-transient error (DuplicateKeyError)
      2024/01/08 19:33:14.0541: [148457]:    DEBUG:       mongoc:      running operation withTransaction : { "name" : "withTransaction", "object" : "session0", "arguments" : { "callback" : { "operations" : [ { "name" : "insertOne", "object" : "collection", "arguments" : { "session" : "session0", "document" : { "_id" : 1 } }, "result" : { "insertedId" : 1 } }, { "name" : "insertOne", "object" : "collection", "arguments" : { "session" : "session0", "document" : { "_id" : 1 } }, "result" : { "errorLabelsOmit" : [ "TransientTransactionError", "UnknownTransactionCommitResult" ] } } ] } }, "result" : { "errorLabelsOmit" : [ "TransientTransactionError", "UnknownTransactionCommitResult" ], "errorContains" : "E11000" } }
      { "insert" : "test", "ordered" : true, "$db" : "withTransaction-tests", "lsid" : { "id" : { "$binary" : { "base64" : "XdBKGN23RwSV2ljL/UF+dg==", "subType" : "04" } } }, "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1704742394, "i" : 50 } }, "signature" : { "hash" : { "$binary" : { "base64" : "LrD7n4L2Z4FXCYrsBI8JE5b+krs=", "subType" : "00" } }, "keyId" : { "$numberLong" : "7321811185362272279" } } }, "startTransaction" : true, "txnNumber" : { "$numberLong" : "1" }, "autocommit" : false, "documents" : [ { "_id" : { "$numberInt" : "1" } } ] }
      2024/01/08 19:33:14.0543: [148457]:    DEBUG:       mongoc: <-- COMMAND SUCCEEDED: { "n" : { "$numberInt" : "1" }, "ok" : { "$numberDouble" : "1.0" }, "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1704742394, "i" : 99 } }, "signature" : { "hash" : { "$binary" : { "base64" : "LrD7n4L2Z4FXCYrsBI8JE5b+krs=", "subType" : "00" } }, "keyId" : { "$numberLong" : "7321811185362272279" } } }, "operationTime" : { "$timestamp" : { "t" : 1704742394, "i" : 99 } }, "recoveryToken" : { "recoveryShardId" : "sh01" } }
      { "insert" : "test", "ordered" : true, "$db" : "withTransaction-tests", "lsid" : { "id" : { "$binary" : { "base64" : "XdBKGN23RwSV2ljL/UF+dg==", "subType" : "04" } } }, "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1704742394, "i" : 99 } }, "signature" : { "hash" : { "$binary" : { "base64" : "LrD7n4L2Z4FXCYrsBI8JE5b+krs=", "subType" : "00" } }, "keyId" : { "$numberLong" : "7321811185362272279" } } }, "txnNumber" : { "$numberLong" : "1" }, "autocommit" : false, "documents" : [ { "_id" : { "$numberInt" : "1" } } ] }
      2024/01/08 19:33:14.0546: [148457]:    DEBUG:       mongoc: <-- COMMAND SUCCEEDED: { "n" : { "$numberInt" : "0" }, "writeErrors" : [ { "index" : { "$numberInt" : "0" }, "code" : { "$numberInt" : "11000" }, "errmsg" : "E11000 duplicate key error collection: withTransaction-tests.test index: _id_ dup key: { _id: 1 }", "keyPattern" : { "_id" : { "$numberInt" : "1" } }, "keyValue" : { "_id" : { "$numberInt" : "1" } } } ], "ok" : { "$numberDouble" : "1.0" }, "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1704742394, "i" : 100 } }, "signature" : { "hash" : { "$binary" : { "base64" : "LrD7n4L2Z4FXCYrsBI8JE5b+krs=", "subType" : "00" } }, "keyId" : { "$numberLong" : "7321811185362272279" } } }, "operationTime" : { "$timestamp" : { "t" : 1704742394, "i" : 100 } }, "recoveryToken" : { "recoveryShardId" : "sh01" } }
      { "abortTransaction" : { "$numberInt" : "1" }, "recoveryToken" : { "recoveryShardId" : "sh01" }, "$db" : "admin", "lsid" : { "id" : { "$binary" : { "base64" : "XdBKGN23RwSV2ljL/UF+dg==", "subType" : "04" } } }, "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1704742394, "i" : 100 } }, "signature" : { "hash" : { "$binary" : { "base64" : "LrD7n4L2Z4FXCYrsBI8JE5b+krs=", "subType" : "00" } }, "keyId" : { "$numberLong" : "7321811185362272279" } } }, "txnNumber" : { "$numberLong" : "1" }, "autocommit" : false }
      2024/01/08 19:33:14.0550: [148457]:  WARNING:       mongoc: Error in abortTransaction: Transaction with { txnNumber: 1 } has been aborted.
      2024/01/08 19:33:14.0550: [148457]:    DEBUG:       mongoc: <-- abortTransaction COMMAND FAILED: Transaction with { txnNumber: 1 } has been aborted.
      REPLY: { "errorLabels" : [ "TransientTransactionError" ], "ok" : { "$numberDouble" : "0.0" }, "errmsg" : "Transaction with { txnNumber: 1 } has been aborted.", "code" : { "$numberInt" : "251" }, "codeName" : "NoSuchTransaction", "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1704742394, "i" : 102 } }, "signature" : { "hash" : { "$binary" : { "base64" : "LrD7n4L2Z4FXCYrsBI8JE5b+krs=", "subType" : "00" } }, "keyId" : { "$numberLong" : "7321811185362272279" } } }, "operationTime" : { "$timestamp" : { "t" : 1704742394, "i" : 102 } }, "recoveryToken" : { "recoveryShardId" : "sh01" } }
      /data/mci/6df91f9b962411a1878460d340274f22/mongoc/src/libmongoc/tests/json-test-operations.c:518 check_error_contains(): [`z��] does not contain [E11000]
      

      This should originally have been handled in CDRIVER-2975, but the spec test was missed. CDRIVER-4806 ultimately synced the test, but added a skip for the test since this is beyond the scope of that ticket.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: