[DOCS-13619] Investigate changes in SERVER-46796: Specific errors during prepare should get propagated to the client Created: 28/Apr/20  Updated: 08/Sep/20  Due: 22/May/20  Resolved: 19/May/20

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 4.4.0-rc4, 4.7.0

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: docs-transactions
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-46796 Specific errors during prepare should... Closed
Participants:
Days since reply: 3 years, 38 weeks, 1 day ago
Epic Link: DOCS: 4.4 Server Release Work

 Description   

Description

Downstream Change Summary

Before this ticket, if a prepared transaction failed it would always fail with NoSuchTransaction. Now, the error reported by a failed prepared transaction can take other values which may indicate what caused a shard to vote to abort (for example OperationNotSupportedInTransaction as described in the ticket).

Description of Linked Ticket

SERVER-44409 adds a test that attempts (and fails) to do a prepared transaction that creates a collection. The failure is expected, since we presently disallow collection creation inside prepared transactions.

The test must presently check that commitTransaction_forTesting() fails with NoSuchTransaction, but the logs for the test confirm that the OperationNotSupportedInTransaction error does occur:

[js_test:create_new_collections_prepared_transactions] 2020-03-11T12:45:54.642-0400 d20022| {"t":{"$date":"2020-03-11T12:45:54.641-0400"},"s":"I", "c":"TXN",     "id":22483,"ctx":"conn28","msg":"Participant shard received prepareTransaction for transaction with txnNumber {opCtx_getTxnNumber} on session {opCtx_getLogicalSessionId}","attr":{"opCtx_getTxnNumber":0,"opCtx_getLogicalSessionId":{"id":{"$uuid":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31"},"uid":{"$binary":{"base64":"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=","subType":"0"}}}}}
[js_test:create_new_collections_prepared_transactions] 2020-03-11T12:45:54.643-0400 d20022| {"t":{"$date":"2020-03-11T12:45:54.642-0400"},"s":"I", "c":"TXN",     "id":51802,"ctx":"conn28","msg":"transaction","attr":{"parameters":{"lsid":{"id":{"$uuid":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31"},"uid":{"$binary":{"base64":"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=","subType":"0"}}},"txnNumber":0,"autocommit":false,"readConcern":{"provenance":"clientSupplied"}},"readTimestamp":"Timestamp(0, 0)","terminationCause":"aborted","timeActiveMicros":58189,"timeInactiveMicros":121171,"numYields":0,"locks":{"ReplicationStateTransition":{"acquireCount":{"w":3}},"Global":{"acquireCount":{"w":2}},"Database":{"acquireCount":{"w":2}},"Collection":{"acquireCount":{"r":1,"w":2}},"Mutex":{"acquireCount":{"r":3}}},"storage":{},"wasPrepared":false,"durationMillis":179}}
[js_test:create_new_collections_prepared_transactions] 2020-03-11T12:45:54.643-0400 d20020| {"t":{"$date":"2020-03-11T12:45:54.643-0400"},"s":"D3","c":"TXN",     "id":22479,"ctx":"TransactionCoordinator","msg":"{txnIdToString_lsid_txnNumber} Coordinator shard received {status} from shard {shardId} for {commandObj}","attr":{"txnIdToString_lsid_txnNumber":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31:0","status":{"code":263,"codeName":"OperationNotSupportedInTransaction","errmsg":"Cannot create new collections inside distributed transactions"},"shardId":"create_new_collections_prepared_transactions-rs0","commandObj":{"prepareTransaction":1,"lsid":{"id":{"$uuid":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31"},"uid":{"$binary":{"base64":"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=","subType":"0"}}},"txnNumber":0,"autocommit":false,"writeConcern":{"w":"majority"}}}}

It seems that the coordinator shard does not propagate the OperationNotSupportedInTransaction error to the caller. It would be nice to propagate errors during prepare to more clearly communicate what caused the prepare to fail.

Scope of changes

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)



 Comments   
Comment by Kay Kim (Inactive) [ 19/May/20 ]

Tested that retryable error is not bubbled up.

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