[SERVER-38857] txn_override.js shouldn't have a write concern when creating a collection outside of a transaction Created: 04/Jan/19  Updated: 27/Oct/23  Resolved: 04/Apr/19

Status: Closed
Project: Core Server
Component/s: Replication, Sharding, Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Samyukta Lanka Assignee: Judah Schvimer
Resolution: Gone away Votes: 0
Labels: prepare_testing
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-38937 Unify txn_override.js and auto_retry_... Closed
Related
related to SERVER-38936 Create unittests for txn_override.js Closed
Operating System: ALL
Sprint: Repl 2019-01-28, Repl 2019-02-11, Repl 2019-02-25, Repl 2019-03-11, Repl 2019-03-25, Repl 2019-04-08
Participants:

 Description   

In txn_override.js, if an insert attempts to do implicit collection creation inside a transaction, we will abort the transaction, create the collection outside of a transaction, and retry the transaction. If the collection creation fails with a write concern error, it will fail here and we'll then retry the create collection. This can cause an error because it means we could retry the collection creation even though it already succeeded the first time.



 Comments   
Comment by Judah Schvimer [ 04/Apr/19 ]

This code went away with SERVER-38937.

Comment by Siyuan Zhou [ 07/Jan/19 ]

Right. By removing the write concern, it's no difference than other writes in the transaction and will rely on the final commitTransaction's write concern to guarantee it worked.

Comment by Janna Golden [ 07/Jan/19 ]

Exactly, that's what should happen. Ah I see, that's why we don't need to include the write concern just for the create collection - sounds good.

Comment by Judah Schvimer [ 07/Jan/19 ]

It's not guaranteed (it may roll back), but my understanding is that when we retry the entire transaction, if it didn't succeed the first time we'll just try again then. samy.lanka please correct me if I'm wrong.

Comment by Janna Golden [ 07/Jan/19 ]

If we get a write concern error on collection creation, is it guaranteed that it succeeded?

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