You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MongoDB: no test covers the re-run of a write transaction after a write conflict #968
On MongoDB, a write transaction that fails with a write conflict (code 112, or the TransientTransactionError label) runs again, up to 50 attempts (TRANSIENT_RETRY_ATTEMPTS). After the last attempt the write answers 503. #475 adds this path for the stream sequence counter. Only the unit tests of the error classification (write_conflict::transaction_error) cover it.
test_racing_puts_and_deletes_on_a_stream_table_all_succeed in tests/test_stream_write_contention.py sends a write again after each 503, up to 20 times (_resend_unavailable, lines 147 to 163 at b349959). So this test also passes on a server that answers 503 at the first write conflict and never runs the transaction again.
Proposed work: add a MongoDB test hook that makes the next N attempts of a write transaction fail with a write conflict. A test sets N below 50, sends one PutItem to a stream table, and requires a 200 and exactly one stream record.
Activity