Skip to content

Commit

Permalink
MDEV-13057 innodb_read_only=1 should avoid creating buf_flush_page_cl…
Browse files Browse the repository at this point in the history
…eaner_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.
  • Loading branch information
dr-m committed Jun 12, 2017
1 parent 417434f commit 4325041
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET @start_value = @@GLOBAL.innodb_sched_priority_cleaner;
SET GLOBAL innodb_sched_priority_cleaner=39;
SELECT @@GLOBAL.innodb_sched_priority_cleaner;
@@GLOBAL.innodb_sched_priority_cleaner
19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@

# 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
SELECT @@GLOBAL.innodb_sched_priority_cleaner;
Expand Down
4 changes: 1 addition & 3 deletions storage/xtradb/buf/buf0flu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ doing the shutdown */
UNIV_INTERN bool buf_page_cleaner_is_active;

/** 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
UNIV_INTERN mysql_pfs_key_t buf_page_cleaner_thread_key;
Expand Down Expand Up @@ -2868,8 +2868,6 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)(
os_thread_pf(os_thread_get_curr_id()));
#endif /* UNIV_DEBUG_THREAD_CREATION */

buf_lru_manager_is_active = true;

/* On server shutdown, the LRU manager thread runs through cleanup
phase to provide free pages for the master and purge threads. */
while (srv_shutdown_state == SRV_SHUTDOWN_NONE
Expand Down
8 changes: 4 additions & 4 deletions storage/xtradb/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17032,6 +17032,10 @@ innodb_sched_priority_cleaner_update(
const void* save) /*!< in: immediate result
from check function */
{
if (srv_read_only_mode) {
return;
}

ulint priority = *static_cast<const ulint *>(save);
ulint actual_priority;
ulint nice = 0;
Expand All @@ -17058,10 +17062,6 @@ innodb_sched_priority_cleaner_update(
}

/* Set the priority for the page cleaner thread */
if (srv_read_only_mode) {

return;
}

ut_ad(buf_page_cleaner_is_active);
nice = os_thread_get_priority(srv_cleaner_tid);
Expand Down
11 changes: 7 additions & 4 deletions storage/xtradb/srv/srv0start.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2947,12 +2947,15 @@ innobase_start_or_create_for_mysql()

if (!srv_read_only_mode) {
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_lru_manager_thread_handle = os_thread_create(buf_flush_lru_manager_thread, NULL, NULL);
buf_flush_lru_manager_thread_started = true;
buf_lru_manager_is_active = 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) {
fprintf(stderr, "InnoDB: Warning:"
Expand Down

0 comments on commit 4325041

Please sign in to comment.