Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MDEV-11025: Make number of page cleaner threads variable dynamic
New test cases
innodb-page-cleaners
Modified test cases
innodb_page_cleaners_basic
New function buf_flush_set_page_cleaner_thread_cnt
Increase or decrease the amount of page cleaner worker threads.
In case of increase this function creates based on current
abount and requested amount how many new threads should be
created. In case of decrease this function sets up the
requested amount of threads and uses is_requested event
to signal workers. Then we wait until all new treads
are started, old threads that should exit signal
is_finished or shutdown has marked that page cleaner
should finish.
buf_flush_page_cleaner_worker
Store current thread id and thread_no and then signal
event is_finished. If number of used page cleaner threads
decrease we shut down those threads that have thread_no
greater or equal than number of page configured page
cleaners - 1 (note that there will be always page cleaner
coordinator). Before exiting we signal is_finished.
New function innodb_page_cleaners_threads_update
Update function for innodb-page-cleaners system variable.
innobase_start_or_create_for_mysql
If more than one page cleaner threads is configured
we use new function buf_flush_set_page_cleaner_thread_cnt
to set up the requested threads (-1 coordinator).- Loading branch information
Jan Lindström
committed
Oct 24, 2017
1 parent
3722372
commit b23a109
Showing
18 changed files
with
3,657 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| SET @saved_page_cleaners = @@GLOBAL.innodb_page_cleaners; | ||
| create table t1 (a int not null primary key auto_increment, | ||
| b bigint, | ||
| c varchar(200), | ||
| d int, | ||
| key b (b), | ||
| key d (d)) engine=INNODB; | ||
| set GLOBAL innodb_page_cleaners = 4; | ||
| connect con1,localhost,root,,; | ||
| connection con1; | ||
| update t1 set b = b + 5, d = d + 1 where a between 1 and 2000; | ||
| connect con2,localhost,root,,; | ||
| connection con2; | ||
| update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000; | ||
| connect con3,localhost,root,,; | ||
| connection con3; | ||
| update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000; | ||
| connection default; | ||
| set GLOBAL innodb_page_cleaners = 2; | ||
| set GLOBAL innodb_page_cleaners = 4; | ||
| set GLOBAL innodb_page_cleaners = 6; | ||
| connection con1; | ||
| connection con2; | ||
| connection con3; | ||
| connection default; | ||
| set GLOBAL innodb_page_cleaners = 4; | ||
| connection con1; | ||
| update t1 set b = b + 5, d = d + 1 where a between 1 and 2000; | ||
| connection con2; | ||
| update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000; | ||
| connection con3; | ||
| update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000; | ||
| connection default; | ||
| set GLOBAL innodb_page_cleaners = 3; | ||
| set GLOBAL innodb_page_cleaners = 2; | ||
| set GLOBAL innodb_page_cleaners = 1; | ||
| connection con1; | ||
| connection con2; | ||
| connection con3; | ||
| connection default; | ||
| disconnect con1; | ||
| disconnect con2; | ||
| disconnect con3; | ||
| DROP TABLE t1; | ||
| SET GLOBAL innodb_page_cleaners=@saved_page_cleaners; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --source include/have_innodb.inc | ||
|
|
||
| SET @saved_page_cleaners = @@GLOBAL.innodb_page_cleaners; | ||
|
|
||
| create table t1 (a int not null primary key auto_increment, | ||
| b bigint, | ||
| c varchar(200), | ||
| d int, | ||
| key b (b), | ||
| key d (d)) engine=INNODB; | ||
|
|
||
| let $rows = 15000; | ||
| --disable_query_log | ||
| begin; | ||
| while ($rows) | ||
| { | ||
| eval insert into t1 values(NULL, $rows, 'testing...', $rows+1000); | ||
| dec $rows; | ||
| } | ||
| commit; | ||
| --enable_query_log | ||
|
|
||
| # | ||
| # We want 4 connections: (1) - (3) to create dirty pages | ||
| # and default to modify the number of page cleaner threads | ||
| # | ||
|
|
||
| set GLOBAL innodb_page_cleaners = 4; | ||
|
|
||
| connect (con1,localhost,root,,); | ||
| connection con1; | ||
| send update t1 set b = b + 5, d = d + 1 where a between 1 and 2000; | ||
|
|
||
| connect (con2,localhost,root,,); | ||
| connection con2; | ||
| send update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000; | ||
|
|
||
|
|
||
| connect (con3,localhost,root,,); | ||
| connection con3; | ||
| send update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000; | ||
|
|
||
| # | ||
| # Page cleaners are increased | ||
| # | ||
|
|
||
| connection default; | ||
| set GLOBAL innodb_page_cleaners = 2; | ||
| set GLOBAL innodb_page_cleaners = 4; | ||
| set GLOBAL innodb_page_cleaners = 6; | ||
|
|
||
| connection con1; | ||
| reap; | ||
|
|
||
| connection con2; | ||
| reap; | ||
|
|
||
| connection con3; | ||
| reap; | ||
|
|
||
| connection default; | ||
| set GLOBAL innodb_page_cleaners = 4; | ||
|
|
||
| # | ||
| # Page cleaners are decreased | ||
| # | ||
|
|
||
| connection con1; | ||
| send update t1 set b = b + 5, d = d + 1 where a between 1 and 2000; | ||
|
|
||
| connection con2; | ||
| send update t1 set b = b + 5, d = d + 1 where a between 3000 and 5000; | ||
|
|
||
| connection con3; | ||
| send update t1 set b = b + 5, d = d + 1 where a between 8000 and 12000; | ||
|
|
||
| connection default; | ||
| set GLOBAL innodb_page_cleaners = 3; | ||
| set GLOBAL innodb_page_cleaners = 2; | ||
| set GLOBAL innodb_page_cleaners = 1; | ||
|
|
||
| connection con1; | ||
| reap; | ||
|
|
||
| connection con2; | ||
| reap; | ||
|
|
||
| connection con3; | ||
| reap; | ||
|
|
||
| connection default; | ||
| disconnect con1; | ||
| disconnect con2; | ||
| disconnect con3; | ||
|
|
||
| DROP TABLE t1; | ||
|
|
||
| SET GLOBAL innodb_page_cleaners=@saved_page_cleaners; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.