[SERVER-45945] Prohibit collection/index creation inside prepared transactions Created: 04/Feb/20 Updated: 14/Feb/20 Resolved: 14/Feb/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Maria van Keulen | Assignee: | Maria van Keulen |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Sprint: | Execution Team 2020-02-10, Execution Team 2020-02-24 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
This ticket is split from The work to make collection and index creation function inside prepared transactions is nontrivial, and there are crash scenarios that can happen presently (see my comment). This ticket will fix those crash scenarios by disallowing collection and index creation (and any other commands) from prepared transactions. |
| Comments |
| Comment by Maria van Keulen [ 14/Feb/20 ] |
|
I'll be fixing this as part of |
| Comment by Maria van Keulen [ 07/Feb/20 ] |
|
It looks like there is a wrinkle for prepared transactions. In order to set a prepare timestamp for the transaction on the secondary, we need to have applied all of the operations inside of the transactions. In order to apply a command, we need to call applyCommand_inlock during _applyOperationsForTransaction. During applyCommand_inlock, we assign a command timestamp to the command in most cases. We then create a TimestampBlock, which in turn calls setCommitTimestamp, which invariants that we are either outside a WUOW (not true, since we've unstashed our transaction resources) or we have set a prepare timestamp (not true, since we need to have applied all of our operations to set it). |