[SERVER-33591] Cleanup interaction of write concerns and transactions Created: 01/Mar/18  Updated: 29/Oct/23  Resolved: 15/Mar/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.7.4

Type: Task Priority: Major - P3
Reporter: Siyuan Zhou Assignee: Siyuan Zhou
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-33412 Error on writes with unsupported tran... Closed
Backwards Compatibility: Fully Compatible
Sprint: Repl 2018-03-26
Participants:

 Description   

Due to SERVER-33223, a global WriteUnitOfWork gets established in unstashTransactionResources() if snapshot read concern is specified. This WUOW will commit after running runCommandImpl(). However, waitForWaitConcern happens inside runCommandImpl() and will hit the invariant inside a WUOW.

We need to wait for write concern after committing the WUOW for commitTransaction and abortTransaction commands and disable or ignore write concerns for writes in a transaction.



 Comments   
Comment by Githook User [ 15/Mar/18 ]

Author:

{'email': 'siyuan.zhou@mongodb.com', 'name': 'Siyuan Zhou', 'username': 'visualzhou'}

Message: SERVER-33591 Cleanup interaction of write concerns and transactions
Branch: master
https://github.com/mongodb/mongo/commit/b762003b0b692fe78658e675f06495f132af442c

Comment by Siyuan Zhou [ 06/Mar/18 ]

To make sure writeForWriteConcern can never be called inside the global WUOW, we need to push down the stashing logic as discussed with james.wahlin before his vacation.

commitTransaction will commit the WUOW and transaction abort for whatever reason will leave the WUOW to the destructor, but we will stash the WUOW if any non-abort error is thrown, e.g. parsing errors. In the error cases, we generally allow clients to wait for writeConcern. Thus it makes more sense to make the writeForWriteConcern orthogonal to transaction by waiting outside the global WUOW.

Comment by Siyuan Zhou [ 02/Mar/18 ]

spencer, as mentioned in the description, waitForWaitConcern is called inside a WUOW and hits an invariant in transaction.

Comment by Spencer Brody (Inactive) [ 02/Mar/18 ]

Is there anything to do to support writeConcern on commitTransaction? I'd expect it to just work after SERVER-33216 is completed

Comment by Siyuan Zhou [ 02/Mar/18 ]

spencer, this ticket is also for supporting write concern of commitTransaction, which isn't covered by SERVER-33412.

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