Determine transaction success or failure
The access method can register an end-of-transaction callback function to handle the MI_EVENT_END_XACT event, which the database server raises at the end of a transaction.
Return value for mi_transition_type() | Transaction state |
---|---|
MI_NORMAL_END | Successful transaction completion The database server can commit the data. |
MI_ABORT_END | Unsuccessful transaction completion The database server must roll back the index to its state before the transaction began. |
As long as a transaction is in progress, the access method should save each original source record value before it executes a delete or update. For transactions that include both internal and external objects, the access method can include either an end-of-transaction or end-of-statement callback function to ensure the correct end-of-transaction action. Depending on the value that mi_transition_type() returns, the callback function either commits or rolls back (if possible) the operations on the external objects.
If an external transaction does not completely commit, the access method must notify the database server to roll back any effects of the transaction on the state of the virtual index.
- Handling state-transitions in a UDR
- End-of-transaction callback functions
- End-of-statement callback functions