Browse Source

Disable more threads on innodb_force_recovery=3 or more

The original intention of the setting innodb_force_recovery=3 was to
disable background activity that could create trouble, most notably,
the rollback of incomplete transactions, and the purge of transaction
history.

MySQL 5.6 introduced more background threads, it is creating
dict_stats_thread and fts_optimize_thread even though these threads
are at least as non-essential as the rollback and purge. These
threads are in fact worse, because they can create new transactions
on their own.

innobase_start_or_create_for_mysql(): Do not create any internal
undo log sources unless innodb_force_recovery<3.
pull/409/head
Marko Mäkelä 9 years ago
parent
commit
a133b05cd7
  1. 8
      storage/innobase/srv/srv0start.cc
  2. 4
      storage/innobase/trx/trx0purge.cc

8
storage/innobase/srv/srv0start.cc

@ -2602,13 +2602,15 @@ files_checked:
operations */
if (!srv_read_only_mode) {
thread_handles[1 + SRV_MAX_N_IO_THREADS] = os_thread_create(
srv_master_thread,
NULL, thread_ids + (1 + SRV_MAX_N_IO_THREADS));
thread_started[1 + SRV_MAX_N_IO_THREADS] = true;
srv_start_state_set(SRV_START_STATE_MASTER);
}
if (!srv_read_only_mode
&& srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {
srv_undo_sources = true;
/* Create the dict stats gathering thread */
srv_dict_stats_thread_active = true;
@ -2617,10 +2619,6 @@ files_checked:
/* Create the thread that will optimize the FTS sub-system. */
fts_optimize_init();
}
if (!srv_read_only_mode
&& srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {
thread_handles[5 + SRV_MAX_N_IO_THREADS] = os_thread_create(
srv_purge_coordinator_thread,

4
storage/innobase/trx/trx0purge.cc

@ -285,6 +285,8 @@ trx_purge_add_update_undo_to_history(
purge have been started, recv_recovery_rollback_active() can
start transactions in row_merge_drop_temp_indexes() and
fts_drop_orphaned_tables(), and roll back recovered transactions.
Also, DROP TABLE may be executed while innodb_force_recovery=2
prevents the purge from running.
After the purge thread has been given permission to exit,
in fast shutdown, we may roll back transactions (trx->undo_no==0)
in THD::cleanup() invoked from unlink_thd(). */
@ -292,6 +294,8 @@ trx_purge_add_update_undo_to_history(
|| ((srv_startup_is_before_trx_rollback_phase
|| trx_rollback_or_clean_is_active)
&& purge_sys->state == PURGE_STATE_INIT)
|| (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND
&& purge_sys->state == PURGE_STATE_DISABLED)
|| (trx->undo_no == 0 && srv_fast_shutdown));
/* Add the log as the first in the history list */

Loading…
Cancel
Save