diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-10-16 10:36:28 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-10-16 10:36:28 +0200 |
commit | d9a8799205d160688f81362356dd2323eb8a91ea (patch) | |
tree | a25584d7adfc190bb0312b6d10cdcb62e17a20d1 /storage/xtradb/srv | |
parent | abefaab57b4b884b74ff9bd3c63f86c018d0e5de (diff) | |
parent | 96d3a797eedfe9304cc6416c7d71c7e543695870 (diff) | |
download | mariadb-git-d9a8799205d160688f81362356dd2323eb8a91ea.tar.gz |
XtraDB 1.1.8-29.0
Diffstat (limited to 'storage/xtradb/srv')
-rw-r--r-- | storage/xtradb/srv/srv0srv.c | 52 | ||||
-rw-r--r-- | storage/xtradb/srv/srv0start.c | 19 |
2 files changed, 69 insertions, 2 deletions
diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c index 0a545a8247a..dff9fc07a7f 100644 --- a/storage/xtradb/srv/srv0srv.c +++ b/storage/xtradb/srv/srv0srv.c @@ -67,6 +67,7 @@ Created 10/8/1995 Heikki Tuuri #include "mem0pool.h" #include "sync0sync.h" #include "que0que.h" +#include "log0online.h" #include "log0recv.h" #include "pars0pars.h" #include "usr0sess.h" @@ -176,6 +177,10 @@ UNIV_INTERN char* srv_doublewrite_file = NULL; UNIV_INTERN ibool srv_recovery_stats = FALSE; +UNIV_INTERN my_bool srv_track_changed_pages = TRUE; + +UNIV_INTERN ulonglong srv_changed_pages_limit = 0; + /* if TRUE, then we auto-extend the last data file */ UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE; /* if != 0, this tells the max size auto-extending may increase the @@ -771,6 +776,10 @@ UNIV_INTERN os_event_t srv_lock_timeout_thread_event; UNIV_INTERN os_event_t srv_shutdown_event; +UNIV_INTERN os_event_t srv_checkpoint_completed_event; + +UNIV_INTERN os_event_t srv_redo_log_thread_finished_event; + UNIV_INTERN srv_sys_t* srv_sys = NULL; /* padding to prevent other memory update hotspots from residing on @@ -1110,6 +1119,9 @@ srv_init(void) srv_lock_timeout_thread_event = os_event_create(NULL); srv_shutdown_event = os_event_create(NULL); + srv_checkpoint_completed_event = os_event_create(NULL); + srv_redo_log_thread_finished_event = os_event_create(NULL); + for (i = 0; i < SRV_MASTER + 1; i++) { srv_n_threads_active[i] = 0; srv_n_threads[i] = 0; @@ -3034,6 +3046,46 @@ srv_shutdown_print_master_pending( } } +/******************************************************************//** +A thread which follows the redo log and outputs the changed page bitmap. +@return a dummy value */ +os_thread_ret_t +srv_redo_log_follow_thread( +/*=======================*/ + void* arg __attribute__((unused))) /*!< in: a dummy parameter + required by + os_thread_create */ +{ +#ifdef UNIV_DEBUG_THREAD_CREATION + fprintf(stderr, "Redo log follower thread starts, id %lu\n", + os_thread_pf(os_thread_get_curr_id())); +#endif + +#ifdef UNIV_PFS_THREAD + pfs_register_thread(srv_log_tracking_thread_key); +#endif + + my_thread_init(); + + do { + os_event_wait(srv_checkpoint_completed_event); + os_event_reset(srv_checkpoint_completed_event); + + if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) { + log_online_follow_redo_log(); + } + + } while (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE); + + log_online_read_shutdown(); + os_event_set(srv_redo_log_thread_finished_event); + + my_thread_end(); + os_thread_exit(NULL); + + OS_THREAD_DUMMY_RETURN; +} + /*******************************************************************//** Tells the InnoDB server that there has been activity in the database and wakes up the master thread if it is suspended (not sleeping). Used diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c index d1329f445aa..7c98f74909e 100644 --- a/storage/xtradb/srv/srv0start.c +++ b/storage/xtradb/srv/srv0start.c @@ -51,6 +51,7 @@ Created 2/16/1996 Heikki Tuuri #include "rem0rec.h" #include "mtr0mtr.h" #include "log0log.h" +#include "log0online.h" #include "log0recv.h" #include "page0page.h" #include "page0cur.h" @@ -121,9 +122,9 @@ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE; static os_file_t files[1000]; /** io_handler_thread parameters for thread identification */ -static ulint n[SRV_MAX_N_IO_THREADS + 7]; +static ulint n[SRV_MAX_N_IO_THREADS + 8]; /** io_handler_thread identifiers */ -static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7]; +static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 8]; /** We use this mutex to test the return value of pthread_mutex_trylock on successful locking. HP-UX does NOT return 0, though Linux et al do. */ @@ -145,6 +146,7 @@ UNIV_INTERN mysql_pfs_key_t srv_error_monitor_thread_key; UNIV_INTERN mysql_pfs_key_t srv_monitor_thread_key; UNIV_INTERN mysql_pfs_key_t srv_master_thread_key; UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key; +UNIV_INTERN mysql_pfs_key_t srv_log_tracking_thread_key; #endif /* UNIV_PFS_THREAD */ /*********************************************************************//** @@ -2037,6 +2039,19 @@ innobase_start_or_create_for_mysql(void) if (srv_auto_lru_dump && srv_blocking_lru_restore) buf_LRU_file_restore(); + if (srv_track_changed_pages) { + + /* Initialize the log tracking subsystem here to block + server startup until it's completed due to the potential + need to re-read previous server run's log. */ + log_online_read_init(); + + /* Create the thread that follows the redo log to output the + changed page bitmap */ + os_thread_create(&srv_redo_log_follow_thread, NULL, + thread_ids + 6 + SRV_MAX_N_IO_THREADS); + } + srv_is_being_started = FALSE; err = dict_create_or_check_foreign_constraint_tables(); |