15.16.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 function that
matches this definition:
int (*rollback)(THD *thd, bool all);
The function name is then listed in the
rollback (thirteenth) entry of
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
ha_innodb.cc and
ha_berkeley.cc.