diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 79d24242435..1808cfb6ea3 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -642,6 +642,18 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_DEBUG_SYNC +SESSION_VALUE NULL +DEFAULT_VALUE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT debug_sync for innodb purge threads. Use it to set up sync points for all purge threads at once. The commands will be applied sequentially at the beginning of purging the next undo record. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY_ID SESSION_VALUE 1 DEFAULT_VALUE 1 diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index df8e0c5ee10..a18b6215417 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -21015,9 +21015,9 @@ char *innobase_debug_sync; static MYSQL_SYSVAR_STR(debug_sync, innobase_debug_sync, PLUGIN_VAR_NOCMDARG, "debug_sync for innodb purge threads. " - "Use it t oset up sync points for all purge threads " + "Use it to set up sync points for all purge threads " "at once. The commands will be applied sequentially at " - "the beginning of purging the next node ", + "the beginning of purging the next undo record.", NULL, innobase_debug_sync_set, NULL); #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index 3e23978f54c..8489551e64d 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -386,8 +386,8 @@ struct que_thr_t{ row_prebuilt_t* prebuilt; /*!< prebuilt structure processed by the query thread */ - ut_d(srv_slot_t *thread_slot;) /*!< a slot from srv_sys.sys_threads - * if any */ + /** a slot of srv_sys.sys_threads, for DEBUG_SYNC in purge thread */ + ut_d(srv_slot_t* thread_slot;) }; #define QUE_THR_MAGIC_N 8476583 diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 96f90d63759..1d3d1573299 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -1082,9 +1082,6 @@ que_run_threads_low( ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS); ut_ad(!trx_mutex_own(thr_get_trx(thr))); - /* slot can be received from purge thread for debug_sync setup */ - ut_d(srv_slot_t *slot = thr->thread_slot); - /* cumul_resource counts how much resources the OS thread (NOT the query thread) has spent in this function */ diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 16efe4a6a34..42e026df7e4 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3047,18 +3047,18 @@ srv_was_tablespace_truncated(const fil_space_t* space) } #ifdef UNIV_DEBUG -static uint get_first_slot(srv_thread_type type) +static ulint get_first_slot(srv_thread_type type) { switch (type) { - case SRV_MASTER: - return SRV_MASTER_SLOT; - case SRV_PURGE: - return SRV_PURGE_SLOT; - case SRV_WORKER: - /* Find an empty slot, skip the master and purge slots. */ - return SRV_WORKER_SLOTS_START; - default: - ut_error; + case SRV_MASTER: + return SRV_MASTER_SLOT; + case SRV_PURGE: + return SRV_PURGE_SLOT; + case SRV_WORKER: + /* Find an empty slot, skip the master and purge slots. */ + return SRV_WORKER_SLOTS_START; + default: + ut_error; } } @@ -3066,14 +3066,12 @@ void srv_for_each_thread(srv_thread_type type, srv_slot_callback_t callback, const void *arg) { - int slot_idx= get_first_slot(type); - while(slot_idx < srv_sys.n_sys_threads - && srv_sys.sys_threads[slot_idx].in_use - && srv_sys.sys_threads[slot_idx].type == type) - { - srv_slot_t *slot= &srv_sys.sys_threads[slot_idx]; - callback(slot, arg); - slot_idx++; + for (ulint slot_idx= get_first_slot(type); + slot_idx < srv_sys.n_sys_threads + && srv_sys.sys_threads[slot_idx].in_use + && srv_sys.sys_threads[slot_idx].type == type; + slot_idx++) { + callback(&srv_sys.sys_threads[slot_idx], arg); } } #endif