Commit 4325041d authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-13057 innodb_read_only=1 should avoid creating buf_flush_page_cleaner_thread

When the server is started in innodb_read_only mode, there cannot be
any writes to persistent InnoDB/XtraDB files. Just like the creation
of buf_flush_page_cleaner_thread is skipped in this case, also
the creation of the XtraDB-specific buf_flush_lru_manager_thread
should be skipped.
parent 417434f1
SET @start_value = @@GLOBAL.innodb_sched_priority_cleaner; SET GLOBAL innodb_sched_priority_cleaner=39;
SELECT @@GLOBAL.innodb_sched_priority_cleaner; SELECT @@GLOBAL.innodb_sched_priority_cleaner;
@@GLOBAL.innodb_sched_priority_cleaner @@GLOBAL.innodb_sched_priority_cleaner
19 19
......
...@@ -4,7 +4,15 @@ ...@@ -4,7 +4,15 @@
# A dynamic, global variable # A dynamic, global variable
SET @start_value = @@GLOBAL.innodb_sched_priority_cleaner; # Test in read-only mode
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
--let $restart_parameters=
# This has no actual effect in innodb_read_only mode
SET GLOBAL innodb_sched_priority_cleaner=39;
--source include/restart_mysqld.inc
# Default value # Default value
SELECT @@GLOBAL.innodb_sched_priority_cleaner; SELECT @@GLOBAL.innodb_sched_priority_cleaner;
......
...@@ -61,7 +61,7 @@ doing the shutdown */ ...@@ -61,7 +61,7 @@ doing the shutdown */
UNIV_INTERN bool buf_page_cleaner_is_active; UNIV_INTERN bool buf_page_cleaner_is_active;
/** Flag indicating if the lru_manager is in active state. */ /** Flag indicating if the lru_manager is in active state. */
UNIV_INTERN bool buf_lru_manager_is_active = false; UNIV_INTERN bool buf_lru_manager_is_active;
#ifdef UNIV_PFS_THREAD #ifdef UNIV_PFS_THREAD
UNIV_INTERN mysql_pfs_key_t buf_page_cleaner_thread_key; UNIV_INTERN mysql_pfs_key_t buf_page_cleaner_thread_key;
...@@ -2868,8 +2868,6 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)( ...@@ -2868,8 +2868,6 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)(
os_thread_pf(os_thread_get_curr_id())); os_thread_pf(os_thread_get_curr_id()));
#endif /* UNIV_DEBUG_THREAD_CREATION */ #endif /* UNIV_DEBUG_THREAD_CREATION */
buf_lru_manager_is_active = true;
/* On server shutdown, the LRU manager thread runs through cleanup /* On server shutdown, the LRU manager thread runs through cleanup
phase to provide free pages for the master and purge threads. */ phase to provide free pages for the master and purge threads. */
while (srv_shutdown_state == SRV_SHUTDOWN_NONE while (srv_shutdown_state == SRV_SHUTDOWN_NONE
......
...@@ -17032,6 +17032,10 @@ innodb_sched_priority_cleaner_update( ...@@ -17032,6 +17032,10 @@ innodb_sched_priority_cleaner_update(
const void* save) /*!< in: immediate result const void* save) /*!< in: immediate result
from check function */ from check function */
{ {
if (srv_read_only_mode) {
return;
}
ulint priority = *static_cast<const ulint *>(save); ulint priority = *static_cast<const ulint *>(save);
ulint actual_priority; ulint actual_priority;
ulint nice = 0; ulint nice = 0;
...@@ -17058,10 +17062,6 @@ innodb_sched_priority_cleaner_update( ...@@ -17058,10 +17062,6 @@ innodb_sched_priority_cleaner_update(
} }
/* Set the priority for the page cleaner thread */ /* Set the priority for the page cleaner thread */
if (srv_read_only_mode) {
return;
}
ut_ad(buf_page_cleaner_is_active); ut_ad(buf_page_cleaner_is_active);
nice = os_thread_get_priority(srv_cleaner_tid); nice = os_thread_get_priority(srv_cleaner_tid);
......
...@@ -2947,12 +2947,15 @@ innobase_start_or_create_for_mysql() ...@@ -2947,12 +2947,15 @@ innobase_start_or_create_for_mysql()
if (!srv_read_only_mode) { if (!srv_read_only_mode) {
buf_page_cleaner_is_active = true; buf_page_cleaner_is_active = true;
buf_flush_page_cleaner_thread_handle = os_thread_create(buf_flush_page_cleaner_thread, NULL, NULL); buf_flush_page_cleaner_thread_handle = os_thread_create(
buf_flush_page_cleaner_thread, NULL, NULL);
buf_flush_page_cleaner_thread_started = true; buf_flush_page_cleaner_thread_started = true;
}
buf_flush_lru_manager_thread_handle = os_thread_create(buf_flush_lru_manager_thread, NULL, NULL); buf_lru_manager_is_active = true;
buf_flush_lru_manager_thread_started = true; buf_flush_lru_manager_thread_handle = os_thread_create(
buf_flush_lru_manager_thread, NULL, NULL);
buf_flush_lru_manager_thread_started = true;
}
if (!srv_file_per_table && srv_pass_corrupt_table) { if (!srv_file_per_table && srv_pass_corrupt_table) {
fprintf(stderr, "InnoDB: Warning:" fprintf(stderr, "InnoDB: Warning:"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment