[DRIVERS-2169] Transaction test expectation contrary to retryable write requirements Created: 19/Jun/19  Updated: 31/Mar/22

Status: Backlog
Project: Drivers
Component/s: Transactions
Fix Version/s: None

Type: Spec Change Priority: Major - P3
Reporter: Oleg Pudeyev (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to RUBY-1561 Support mongos pinning for sharded tr... Closed
Driver Changes: Needed

 Description   

The "commitTransaction retry fails on new mongos" test in https://github.com/mongodb/specifications/blob/master/source/transactions/tests/mongos-recovery-token.yml#L177 performs two commitTransaction operations; the first one is failed with a socket error via a fail point, the second one fails with an OperationFailure. The test expects the second failing operation to have a transient error label, however as far as I can tell this is contrary to retryable writes spec requirements per https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.rst#executing-retryable-write-commands, which require that a non-socket error, non-not master error causes the original failure to be reraised rather than propagating the retry failure, specifically the following bit of pseudocode:

 } catch (DriverException ignoredError) {
   throw originalError;
 }

In case of the commit test in question, the original error has the unknown result label, and the retried error has the transient label. The test as currently written expects the error to have the transient label, implicitly requiring that the retried error is propagated, but in Ruby the test produces an exception with the unknown result label, indicating that the original error was propagated.

Looking at Python driver which is the reference implementation for transactions, my impression is it always raises the last OperationFailure encountered when doing write retries, and hence would raise the last error contrary to the pseudocode quoted above. The relevant spec change for raising original error is https://github.com/mongodb/specifications/commit/84f0fb9043e7bf2b04e74c9072f56013a97a5073

Since error details were requested in slack, I am providing them below.

first error:

[#<Mongo::Error::SocketError: EOFError: end of file reached (for 127.0.0.1:27571 (no TLS))>, ["UnknownTransactionCommitResult"]]

second error:

[#<Mongo::Error::OperationFailure: Recovering the transaction's outcome found the transaction aborted (251)>, ["TransientTransactionError"]]



 Comments   
Comment by Oleg Pudeyev (Inactive) [ 24/Jun/19 ]

Proposed spec test change: https://github.com/mongodb/mongo-ruby-driver/pull/1360/commits/771885625148d7978075f627031d69e9ba9b9bde

Generated at Thu Feb 08 08:24:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.