On transaction rollback, we are unnecessarily waiting for redo log to complete. If the server were killed, the transaction would be rolled back just fine. If we are lucky, the changes of the transaction were never written to redo log, and recovery would never even know about the transaction. This is about a minor tweak to the transaction commit code:
This code is also invoked at the end of rollback. The trx_t::undo_no is the number of rows that would remain in the undo log. After a full rollback, that number would always be 0.
A simple benchmark shows the difference:
On my system, with innodb_flush_log_at_trx_commit=1, the test before the patch takes 7.6 seconds. With the patch, it is only 2.3 seconds.