Documentation Home
MySQL Internals Manual

23.17.3 Implementing ROLLBACK

Of the two major transactional operations, ROLLBACK is the more complicated to implement. All operations that occurred during the transaction must be reversed so that all rows are unchanged from before the transaction began.

To support ROLLBACK, create a method that matches this definition:

int (*rollback)(THD *thd, bool all);

The method name is then listed in the rollback (thirteenth) entry of [custom-engine.html#custom-engine-handlerton the handlerton].

The THD parameter is used to identify the transaction that needs to be rolled back, while the bool all parameter indicates whether the entire transaction should be rolled back or just the last statement.

Details of implementing a ROLLBACK operation will vary by storage engine. Examples can be found in