There are 4 different Timestamp member variables and equally as many booleans to track how we open transactions, timestamp transactions, and commit transactions. The relationship between the recovery unit and the snapshot manager is equally as confusing.
There are 5 ways to open a transaction and 2 ways to commit.
On top of that, the ignore_prepare flag has to be set in each of the 5 places we begin transactions, and sometimes with additional configuration parameters.
My suggestions for improvement (at a minimum) are:
- Only call begin_transaction in one place, potentially as a helper on the WiredTigerSession or the RecoveryUnit itself.
- Use an enum to keep track of what type of read/commit we are doing for the open transaction.
- To reduce timestamp confusion we should only have to keep track of 2 timestamps: when to read and when to commit.
- The SnapshotManager should only keep track of timestamps (or removed completely), and not be the designated caller to open special types of transactions.