[CDRIVER-4811] Failing errorContains assertion in callback-retry.json DuplicateKeyError test Created: 09/Jan/24  Updated: 16/Jan/24

Status: Backlog
Project: C Driver
Component/s: Transactions
Affects Version/s: None
Fix Version/s: None

Type: Build Failure Priority: Unknown
Reporter: Jeremy Mikola Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-2975 Resync transaction spec tests for bul... Closed
is related to CDRIVER-4806 Require 4.3.1+ server version when us... Closed
Epic Link: Stabilize Evergreen

 Description   

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.



 Comments   
Comment by Githook User [ 10/Jan/24 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: CDRIVER-4806 sync tests for failCommand errorLabels reqs (#1508)

Synced with mongodb/specifications@5fc23f40f79d18f0693e7159eba81f0e7b276715

Updates retryable writes prose test 3 to relocate the errorLabels field when configuring a fail point.

Note: with_transaction/callback-retry.json is unrelated but was missed in CDRIVER-2975. This test currently fails and has been skipped (see: CDRIVER-4811).
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/4ef84ecdb7f1ce86b3d96b34ef8015d9c5f0f3f1

Generated at Wed Feb 07 21:22:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.