Skip to content

Commit

Permalink
InnoDB purge thread and other bg threads
Browse files Browse the repository at this point in the history
in slow shutdown mode stop all bg threads that might generate
new undo records to purge before stopping purge threads.
  • Loading branch information
vuvova committed Dec 15, 2016
1 parent eabb0ae commit 8d77085
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
5 changes: 5 additions & 0 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ thd_destructor_proxy(void *)
while (trx_sys_any_active_transactions()) {
os_thread_sleep(1000);
}

/* Some background threads might generate undo pages that will
need to be purged, so they have to be shut down before purge
threads if slow shutdown is requested. */
srv_shutdown_bg_undo_sources();
}
srv_purge_wakeup();

Expand Down
5 changes: 5 additions & 0 deletions storage/innobase/include/srv0start.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ Shuts down the Innobase database.
dberr_t
innobase_shutdown_for_mysql(void);

/****************************************************************//**
Shuts down background threads that can generate undo pages. */
void
srv_shutdown_bg_undo_sources(void);

/********************************************************************
Signal all per-table background threads to shutdown, and wait for them to do
so. */
Expand Down
23 changes: 17 additions & 6 deletions storage/innobase/srv/srv0start.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2769,6 +2769,21 @@ srv_fts_close(void)
}
#endif


/****************************************************************//**
Shuts down background threads that can generate undo pages. */
void
srv_shutdown_bg_undo_sources(void)
/*===========================*/
{
fts_optimize_shutdown();
dict_stats_shutdown();

/* Shutdown key rotation threads */
fil_crypt_threads_end();
}


/****************************************************************//**
Shuts down the InnoDB database.
@return DB_SUCCESS or error code */
Expand All @@ -2785,12 +2800,8 @@ innobase_shutdown_for_mysql(void)
return(DB_SUCCESS);
}

if (!srv_read_only_mode) {
fts_optimize_shutdown();
dict_stats_shutdown();

/* Shutdown key rotation threads */
fil_crypt_threads_end();
if (!srv_read_only_mode && srv_fast_shutdown) {
srv_shutdown_bg_undo_sources();
}

/* 1. Flush the buffer pool to disk, write the current lsn to
Expand Down

0 comments on commit 8d77085

Please sign in to comment.