[SERVER-35677] Do not allow prepareTransaction to prepare transactions without operations Created: 19/Jun/18 Updated: 29/Oct/23 Resolved: 22/Jun/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Louis Williams | Assignee: | Judah Schvimer |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | prepare_errors | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||
| Backwards Compatibility: | Fully Compatible | |||||||||||||||||
| Operating System: | ALL | |||||||||||||||||
| Steps To Reproduce: | ./mongod --replSet rs --setParameter enableTestCommands=1 And in the shell:
|
|||||||||||||||||
| Participants: | ||||||||||||||||||
| Linked BF Score: | 49 | |||||||||||||||||
| Description |
|
The onTransactionPrepare opObserver early-returns when there are no statements in the transaction. If a "find" transaction is started, and later prepared, this should not be legal if there are no statements to prepare. Session::prepareTransaction calls WriteUnitOfWork::prepare() regardless of whether or not a prepare optime was generated. This leads RecoveryUnit::prepareUnitOfWork to be called when no prepare timestamp has been set, causing this invariant failure Prepare should either a) be a no-op or b) return an error when there are no operations to prepare |
| Comments |
| Comment by Githook User [ 22/Jun/18 ] |
|
Author: {'username': 'judahschvimer', 'name': 'Judah Schvimer', 'email': 'judah@mongodb.com'}Message: |
| Comment by Judah Schvimer [ 19/Jun/18 ] |
|
We have since decided that prepareTransaction should always log an oplog entry. I expect that to fix this. |