Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Finalize transaction record state after real transaction #32911
After a real (non-savepoint) transaction has committed or rolled back, the original persistence-related state for all records modified in that transaction is discarded or restored, respectively.
When the model has transactional callbacks, this happens synchronously in the
The synchronous code path always finalizes the state of the record, but the lazy code path only pops one "level" from the transaction counter, assuming it will always reach zero immediately after a real transaction. As the test cases included here demonstrate, that isn't always the case.
By using the same logic as the synchronous code path, we ensure that the record's state is always updated after a real transaction has finished.