-
Marko Mäkelä authored
In the 10.1 InnoDB Plugin, a call os_event_free(buf_flush_event) was misplaced. The event could be signalled by rollback of resurrected transactions while shutdown was in progress. This bug was caught by cmake -DWITH_ASAN testing. This call was only present in the 10.1 InnoDB Plugin, not in other versions, or in XtraDB. That said, the bug affects all InnoDB versions. Shutdown assumes the cessation of any page-dirtying activity, including the activity of the background rollback thread. InnoDB only waited for the background rollback to finish as part of a slow shutdown (innodb_fast_shutdown=0). The default is a clean shutdown (innodb_fast_shutdown=1). In a scenario where InnoDB is killed, restarted, and shut down soon enough, the data files could become corrupted. logs_empty_and_mark_files_at_shutdown(): Wait for the rollback to finish, except if innodb_fast_shutdown=2 (crash-like shutdown) was requested. trx_rollback_or_clean_recovered(): Before choosing the next recovered transaction to roll back, terminate early if non-slow shutdown was initiated. Roll back everything on slow shutdown (innodb_fast_shutdown=0). srv_innodb_monitor_mutex: Declare as static, because the mutex is only used within one module. After each call to os_event_free(), ensure that the freed event is not reachable via global variables, by setting the relevant variables to NULL.
032678ad