Commit b23a1096 authored by Jan Lindström's avatar Jan Lindström

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).
parent 3722372a
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;
--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;
...@@ -2,13 +2,42 @@ SELECT COUNT(@@GLOBAL.innodb_page_cleaners); ...@@ -2,13 +2,42 @@ SELECT COUNT(@@GLOBAL.innodb_page_cleaners);
COUNT(@@GLOBAL.innodb_page_cleaners) COUNT(@@GLOBAL.innodb_page_cleaners)
1 1
1 Expected 1 Expected
SELECT COUNT(@@innodb_page_cleaners); SELECT @@innodb_page_cleaners;
COUNT(@@innodb_page_cleaners) @@innodb_page_cleaners
1 1
1 Expected 1 Expected
SET @@GLOBAL.innodb_page_cleaners=2;
Expected to pass
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
2
2 Expected
SET @@GLOBAL.innodb_page_cleaners=1; SET @@GLOBAL.innodb_page_cleaners=1;
ERROR HY000: Variable 'innodb_page_cleaners' is a read only variable Expected to pass
Expected error 'Read-only variable' SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
1
1 Expected
SET @@GLOBAL.innodb_page_cleaners=6;
Expected to pass
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
6
6 Expected
SET @@GLOBAL.innodb_page_cleaners=4;
Expected to pass
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
4
4 Expected
SET @@GLOBAL.innodb_page_cleaners=0;
Warnings:
Warning 1292 Truncated incorrect innodb_page_cleaners value: '0'
Warning expected
SELECT @@innodb_page_cleaners;
@@innodb_page_cleaners
1
1 Expected
SELECT innodb_page_cleaners = @@SESSION.innodb_page_cleaners; SELECT innodb_page_cleaners = @@SESSION.innodb_page_cleaners;
ERROR 42S22: Unknown column 'innodb_page_cleaners' in 'field list' ERROR 42S22: Unknown column 'innodb_page_cleaners' in 'field list'
Expected error 'Read-only variable' Expected error 'Read-only variable'
......
--- suite/sys_vars/r/sysvars_debug.result 2014-10-10 13:33:55.000000000 +0300 --- r\sysvars_debug.result 2017-08-08 10:52:39.036804900 +0300
+++ suite/sys_vars/r/sysvars_debug,32bit.reject 2014-10-10 19:36:44.000000000 +0300 +++ r\sysvars_debug,32bit.reject 2017-09-10 08:06:38.447122100 +0300
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 0 DEFAULT_VALUE 0
...@@ -9,3 +9,24 @@ ...@@ -9,3 +9,24 @@
VARIABLE_COMMENT Extra sleep (in microseconds) to add to binlog fsync(), for debugging VARIABLE_COMMENT Extra sleep (in microseconds) to add to binlog fsync(), for debugging
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295 NUMERIC_MAX_VALUE 4294967295
@@ -43,20 +43,6 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
-VARIABLE_NAME DEBUG_MUTEX_DEADLOCK_DETECTOR
-SESSION_VALUE NULL
-GLOBAL_VALUE ON
-GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE ON
-VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BOOLEAN
-VARIABLE_COMMENT Enable checking of wrong mutex usage
-NUMERIC_MIN_VALUE NULL
-NUMERIC_MAX_VALUE NULL
-NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST OFF,ON
-READ_ONLY YES
-COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME DEBUG_NO_THREAD_ALARM
SESSION_VALUE NULL
GLOBAL_VALUE OFF
--- suite/sys_vars/r/sysvars_innodb.result 2017-05-10 10:25:27.196836832 +0200 --- suite/sys_vars/r/sysvars_innodb.result 2017-09-14 10:37:46.000000000 +0000
+++ suite/sys_vars/r/sysvars_innodb.reject 2017-05-10 17:54:00.922046824 +0200 +++ suite/sys_vars/r/sysvars_innodb,32bit.reject 2017-09-26 13:13:23.685012523 +0000
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8 DEFAULT_VALUE 8
...@@ -364,7 +364,7 @@ ...@@ -364,7 +364,7 @@
VARIABLE_COMMENT Maximum delay of user threads in micro-seconds VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10000000 NUMERIC_MAX_VALUE 10000000
@@ -1692,10 +1692,10 @@ @@ -1678,10 +1678,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0 DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -377,7 +377,7 @@ ...@@ -377,7 +377,7 @@
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY YES READ_ONLY YES
@@ -1720,7 +1720,7 @@ @@ -1706,7 +1706,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4 DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -386,7 +386,7 @@ ...@@ -386,7 +386,7 @@
VARIABLE_COMMENT Page cleaner threads can be from 1 to 64. Default is 4. VARIABLE_COMMENT Page cleaner threads can be from 1 to 64. Default is 4.
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64 NUMERIC_MAX_VALUE 64
@@ -1748,7 +1748,7 @@ @@ -1734,7 +1734,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16 DEFAULT_VALUE 16
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -395,7 +395,7 @@ ...@@ -395,7 +395,7 @@
VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2 VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024 NUMERIC_MAX_VALUE 1024
@@ -1762,7 +1762,7 @@ @@ -1748,7 +1748,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384 DEFAULT_VALUE 16384
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -404,7 +404,7 @@ ...@@ -404,7 +404,7 @@
VARIABLE_COMMENT Page size to use for all InnoDB tablespaces. VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
NUMERIC_MIN_VALUE 4096 NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 65536 NUMERIC_MAX_VALUE 65536
@@ -1804,7 +1804,7 @@ @@ -1790,7 +1790,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 300 DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list. VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5000 NUMERIC_MAX_VALUE 5000
@@ -1818,7 +1818,7 @@ @@ -1804,7 +1804,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128 DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -422,7 +422,7 @@ ...@@ -422,7 +422,7 @@
VARIABLE_COMMENT Dictates rate at which UNDO records are purged. Value N means purge rollback segment(s) on every Nth iteration of purge invocation VARIABLE_COMMENT Dictates rate at which UNDO records are purged. Value N means purge rollback segment(s) on every Nth iteration of purge invocation
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128 NUMERIC_MAX_VALUE 128
@@ -1860,7 +1860,7 @@ @@ -1846,7 +1846,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4 DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -431,7 +431,7 @@ ...@@ -431,7 +431,7 @@
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 4. VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 4.
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32 NUMERIC_MAX_VALUE 32
@@ -1888,7 +1888,7 @@ @@ -1874,7 +1874,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 56 DEFAULT_VALUE 56
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -440,7 +440,7 @@ ...@@ -440,7 +440,7 @@
VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead. VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64 NUMERIC_MAX_VALUE 64
@@ -1902,7 +1902,7 @@ @@ -1888,7 +1888,7 @@
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4 DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -449,7 +449,7 @@ ...@@ -449,7 +449,7 @@
VARIABLE_COMMENT Number of background read I/O threads in InnoDB. VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64 NUMERIC_MAX_VALUE 64
@@ -1930,10 +1930,10 @@ @@ -1916,10 +1916,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0 DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -462,7 +462,7 @@ ...@@ -462,7 +462,7 @@
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
@@ -1958,7 +1958,7 @@ @@ -1944,7 +1944,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128 DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -471,7 +471,7 @@ ...@@ -471,7 +471,7 @@
VARIABLE_COMMENT Number of undo logs to use (deprecated). VARIABLE_COMMENT Number of undo logs to use (deprecated).
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128 NUMERIC_MAX_VALUE 128
@@ -1972,7 +1972,7 @@ @@ -1958,7 +1958,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0 DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -480,7 +480,7 @@ ...@@ -480,7 +480,7 @@
VARIABLE_COMMENT An InnoDB page number. VARIABLE_COMMENT An InnoDB page number.
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295 NUMERIC_MAX_VALUE 4294967295
@@ -2028,7 +2028,7 @@ @@ -2014,7 +2014,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576 DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -489,7 +489,7 @@ ...@@ -489,7 +489,7 @@
VARIABLE_COMMENT Memory buffer size for index creation VARIABLE_COMMENT Memory buffer size for index creation
NUMERIC_MIN_VALUE 65536 NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 67108864 NUMERIC_MAX_VALUE 67108864
@@ -2238,7 +2238,7 @@ @@ -2224,7 +2224,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1 DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -498,7 +498,7 @@ ...@@ -498,7 +498,7 @@
VARIABLE_COMMENT Size of the mutex/lock wait array. VARIABLE_COMMENT Size of the mutex/lock wait array.
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024 NUMERIC_MAX_VALUE 1024
@@ -2266,10 +2266,10 @@ @@ -2252,10 +2252,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30 DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -511,7 +511,7 @@ ...@@ -511,7 +511,7 @@
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
@@ -2308,7 +2308,7 @@ @@ -2294,7 +2294,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0 DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -520,7 +520,7 @@ ...@@ -520,7 +520,7 @@
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling. VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000 NUMERIC_MAX_VALUE 1000
@@ -2322,7 +2322,7 @@ @@ -2308,7 +2308,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10000 DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -529,7 +529,7 @@ ...@@ -529,7 +529,7 @@
VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000 NUMERIC_MAX_VALUE 1000000
@@ -2392,7 +2392,7 @@ @@ -2378,7 +2378,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128 DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -538,7 +538,7 @@ ...@@ -538,7 +538,7 @@
VARIABLE_COMMENT Number of undo logs to use. VARIABLE_COMMENT Number of undo logs to use.
NUMERIC_MIN_VALUE 1 NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128 NUMERIC_MAX_VALUE 128
@@ -2420,7 +2420,7 @@ @@ -2406,7 +2406,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0 DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
...@@ -547,7 +547,7 @@ ...@@ -547,7 +547,7 @@
VARIABLE_COMMENT Number of undo tablespaces to use. VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0 NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 127 NUMERIC_MAX_VALUE 127
@@ -2476,7 +2476,7 @@ @@ -2448,7 +2448,7 @@
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4 DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
......
...@@ -1712,8 +1712,8 @@ NUMERIC_MIN_VALUE 1 ...@@ -1712,8 +1712,8 @@ NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64 NUMERIC_MAX_VALUE 64
NUMERIC_BLOCK_SIZE 0 NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY YES READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_PAGE_CLEANER_DISABLED_DEBUG VARIABLE_NAME INNODB_PAGE_CLEANER_DISABLED_DEBUG
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE OFF GLOBAL_VALUE OFF
......
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result --- suite/sys_vars/r/sysvars_server_notembedded.result 2017-09-14 10:37:46.000000000 +0000
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ suite/sys_vars/r/sysvars_server_notembedded,32bit.reject 2017-09-26 13:04:02.733012523 +0000
@@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
GLOBAL_VALUE_ORIGIN CONFIG GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 1 DEFAULT_VALUE 1
......
# Variable name: innodb_page_cleaners # Variable name: innodb_page_cleaners
# Scope: Global # Scope: Global
# Access type: Static # Access type: Dynamic
# Data type: numeric # Data type: numeric
--source include/have_innodb.inc --source include/have_innodb.inc
...@@ -8,12 +8,38 @@ ...@@ -8,12 +8,38 @@
SELECT COUNT(@@GLOBAL.innodb_page_cleaners); SELECT COUNT(@@GLOBAL.innodb_page_cleaners);
--echo 1 Expected --echo 1 Expected
SELECT COUNT(@@innodb_page_cleaners); SELECT @@innodb_page_cleaners;
--echo 1 Expected --echo 1 Expected
--error ER_INCORRECT_GLOBAL_LOCAL_VAR SET @@GLOBAL.innodb_page_cleaners=2;
--echo Expected to pass
SELECT @@innodb_page_cleaners;
--echo 2 Expected
SET @@GLOBAL.innodb_page_cleaners=1; SET @@GLOBAL.innodb_page_cleaners=1;
--echo Expected error 'Read-only variable' --echo Expected to pass
SELECT @@innodb_page_cleaners;
--echo 1 Expected
SET @@GLOBAL.innodb_page_cleaners=6;
--echo Expected to pass
SELECT @@innodb_page_cleaners;
--echo 6 Expected
SET @@GLOBAL.innodb_page_cleaners=4;
--echo Expected to pass
SELECT @@innodb_page_cleaners;
--echo 4 Expected
SET @@GLOBAL.innodb_page_cleaners=0;
--echo Warning expected
SELECT @@innodb_page_cleaners;
--echo 1 Expected
--Error ER_BAD_FIELD_ERROR --Error ER_BAD_FIELD_ERROR
SELECT innodb_page_cleaners = @@SESSION.innodb_page_cleaners; SELECT innodb_page_cleaners = @@SESSION.innodb_page_cleaners;
......
...@@ -149,6 +149,8 @@ struct page_cleaner_t { ...@@ -149,6 +149,8 @@ struct page_cleaner_t {
threads. */ threads. */
os_event_t is_finished; /*!< event to signal that all os_event_t is_finished; /*!< event to signal that all
slots were finished. */ slots were finished. */
os_event_t is_started; /*!< event to signal that
thread is started/exiting */
volatile ulint n_workers; /*!< number of worker threads volatile ulint n_workers; /*!< number of worker threads
in existence */ in existence */
bool requested; /*!< true if requested pages bool requested; /*!< true if requested pages
...@@ -2728,6 +2730,7 @@ buf_flush_page_cleaner_init(void) ...@@ -2728,6 +2730,7 @@ buf_flush_page_cleaner_init(void)
page_cleaner->is_requested = os_event_create("pc_is_requested"); page_cleaner->is_requested = os_event_create("pc_is_requested");
page_cleaner->is_finished = os_event_create("pc_is_finished"); page_cleaner->is_finished = os_event_create("pc_is_finished");
page_cleaner->is_started = os_event_create("pc_is_started");
page_cleaner->n_slots = static_cast<ulint>(srv_buf_pool_instances); page_cleaner->n_slots = static_cast<ulint>(srv_buf_pool_instances);
...@@ -2757,6 +2760,7 @@ buf_flush_page_cleaner_close(void) ...@@ -2757,6 +2760,7 @@ buf_flush_page_cleaner_close(void)
os_event_destroy(page_cleaner->is_finished); os_event_destroy(page_cleaner->is_finished);
os_event_destroy(page_cleaner->is_requested); os_event_destroy(page_cleaner->is_requested);
os_event_destroy(page_cleaner->is_started);
ut_free(page_cleaner); ut_free(page_cleaner);
...@@ -3478,6 +3482,39 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*) ...@@ -3478,6 +3482,39 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
OS_THREAD_DUMMY_RETURN; OS_THREAD_DUMMY_RETURN;
} }
/** Adjust thread count for page cleaner workers.
@param[in] new_cnt Number of threads to be used */
void
buf_flush_set_page_cleaner_thread_cnt(ulong new_cnt)
{
mutex_enter(&page_cleaner->mutex);
if (new_cnt > srv_n_page_cleaners) {
/* User has increased the number of page
cleaner threads. */
uint add = new_cnt - srv_n_page_cleaners;
srv_n_page_cleaners = new_cnt;
for (uint i = 0; i < add; i++) {
os_thread_id_t cleaner_thread_id;
os_thread_create(buf_flush_page_cleaner_worker, NULL, &cleaner_thread_id);
}
} else if (new_cnt < srv_n_page_cleaners) {
/* User has decreased the number of page
cleaner threads. */
srv_n_page_cleaners = new_cnt;
}
mutex_exit(&page_cleaner->mutex);
/* Wait until defined number of workers has started. */
while (page_cleaner->is_running &&
page_cleaner->n_workers != (srv_n_page_cleaners - 1)) {
os_event_set(page_cleaner->is_requested);
os_event_reset(page_cleaner->is_started);
os_event_wait_time(page_cleaner->is_started, 1000000);
}
}
/******************************************************************//** /******************************************************************//**
Worker thread of page_cleaner. Worker thread of page_cleaner.
@return a dummy parameter */ @return a dummy parameter */
...@@ -3490,9 +3527,19 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)( ...@@ -3490,9 +3527,19 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)(
os_thread_create */ os_thread_create */
{ {
my_thread_init(); my_thread_init();
os_thread_id_t cleaner_thread_id = os_thread_get_curr_id();
mutex_enter(&page_cleaner->mutex); mutex_enter(&page_cleaner->mutex);
ulint thread_no = page_cleaner->n_workers;
page_cleaner->n_workers++; page_cleaner->n_workers++;
DBUG_LOG("ib_buf", "Thread "
<< cleaner_thread_id
<< " started n_workers "
<< page_cleaner->n_workers << ".");
/* Signal that we have started */
os_event_set(page_cleaner->is_started);
mutex_exit(&page_cleaner->mutex); mutex_exit(&page_cleaner->mutex);
#ifdef UNIV_LINUX #ifdef UNIV_LINUX
...@@ -3515,11 +3562,31 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)( ...@@ -3515,11 +3562,31 @@ DECLARE_THREAD(buf_flush_page_cleaner_worker)(
break; break;
} }
ut_ad(srv_n_page_cleaners >= 1);
/* If number of page cleaner threads is decreased
exit those that are not anymore needed. */
if (srv_shutdown_state == SRV_SHUTDOWN_NONE &&
thread_no >= (srv_n_page_cleaners - 1)) {
DBUG_LOG("ib_buf", "Exiting "
<< thread_no
<< " page cleaner worker thread_id "
<< os_thread_pf(cleaner_thread_id)
<< " total threads " << srv_n_page_cleaners << ".");
break;
}
pc_flush_slot(); pc_flush_slot();
} }
mutex_enter(&page_cleaner->mutex); mutex_enter(&page_cleaner->mutex);
page_cleaner->n_workers--; page_cleaner->n_workers--;
DBUG_LOG("ib_buf", "Thread " << cleaner_thread_id
<< " exiting n_workers " << page_cleaner->n_workers<< ".");
/* Signal that we have stopped */
os_event_set(page_cleaner->is_started);
mutex_exit(&page_cleaner->mutex); mutex_exit(&page_cleaner->mutex);
my_thread_end(); my_thread_end();
......
...@@ -19984,10 +19984,20 @@ static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir, ...@@ -19984,10 +19984,20 @@ static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to InnoDB log files.", NULL, NULL, NULL); "Path to InnoDB log files.", NULL, NULL, NULL);
/** Update innodb_page_cleaners.
@param[in] save the new value of innodb_page_cleaners */
static
void
innodb_page_cleaners_threads_update(THD*, struct st_mysql_sys_var*, void*, const void *save)
{
buf_flush_set_page_cleaner_thread_cnt(*static_cast<const ulong*>(save));
}
static MYSQL_SYSVAR_ULONG(page_cleaners, srv_n_page_cleaners, static MYSQL_SYSVAR_ULONG(page_cleaners, srv_n_page_cleaners,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG,
"Page cleaner threads can be from 1 to 64. Default is 4.", "Page cleaner threads can be from 1 to 64. Default is 4.",
NULL, NULL, 4, 1, 64, 0); NULL,
innodb_page_cleaners_threads_update, 4, 1, 64, 0);
static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct, srv_max_buf_pool_modified_pct, static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
......
...@@ -243,6 +243,12 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)( ...@@ -243,6 +243,12 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(
/*===============================================*/ /*===============================================*/
void* arg); /*!< in: a dummy parameter required by void* arg); /*!< in: a dummy parameter required by
os_thread_create */ os_thread_create */
/** Adjust thread count for page cleaner workers.
@param[in] new_cnt Number of threads to be used */
void
buf_flush_set_page_cleaner_thread_cnt(ulong new_cnt);
/******************************************************************//** /******************************************************************//**
Worker thread of page_cleaner. Worker thread of page_cleaner.
@return a dummy parameter */ @return a dummy parameter */
......
...@@ -1868,9 +1868,10 @@ innobase_start_or_create_for_mysql() ...@@ -1868,9 +1868,10 @@ innobase_start_or_create_for_mysql()
os_thread_create(buf_flush_page_cleaner_coordinator, os_thread_create(buf_flush_page_cleaner_coordinator,
NULL, NULL); NULL, NULL);
for (i = 1; i < srv_n_page_cleaners; ++i) { /* Create page cleaner workers if needed. For example
os_thread_create(buf_flush_page_cleaner_worker, mariabackup could set srv_n_page_cleaners = 0. */
NULL, NULL); if (srv_n_page_cleaners > 1) {
buf_flush_set_page_cleaner_thread_cnt(srv_n_page_cleaners);
} }
#ifdef UNIV_LINUX #ifdef UNIV_LINUX
......
--- sysvars_aria.result 2015-01-09 11:49:32.000000000 +0100
+++ sysvars_aria,32bit.result 2015-01-09 17:30:11.000000000 +0100
@@ -7,7 +7,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8192
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Block size to be used for Aria index pages.
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 32768
@@ -21,7 +21,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Interval between tries to do an automatic checkpoints. In seconds; 0 means 'no automatic checkpoints' which makes sense only for testing.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -35,7 +35,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of bytes that the transaction log has to grow between checkpoints before a new checkpoint is written to the log.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -63,7 +63,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 255
@@ -91,7 +91,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Interval between commite in microseconds (1/1000000c). 0 stands for no waiting for other threads to come and do a commit in "hard" mode and no sync()/commit at all in "soft" mode. Option has only an effect if aria_group_commit is used
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -105,7 +105,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 1073741824
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Limit for transaction log size
NUMERIC_MIN_VALUE 8388608
NUMERIC_MAX_VALUE 4294967295
@@ -147,10 +147,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in the page cache.
NUMERIC_MIN_VALUE 100
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 100
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -175,7 +175,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT The minimum percentage of warm blocks in key cache
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100
@@ -189,7 +189,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 512
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of Aria files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open Aria files.
NUMERIC_MIN_VALUE 128
NUMERIC_MAX_VALUE 16384
@@ -231,7 +231,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
@@ -248,7 +248,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.
NUMERIC_MIN_VALUE 4096
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
--- suite/sys_vars/r/sysvars_debug.result 2017-09-14 10:37:46.000000000 +0000
+++ suite/sys_vars/r/sysvars_debug,32bit.reject 2017-09-26 13:15:14.197012523 +0000
@@ -21,7 +21,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Extra sleep (in microseconds) to add to binlog fsync(), for debugging
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
--- suite/sys_vars/r/sysvars_wsrep.result 2014-10-10 13:33:55.000000000 +0300
+++ suite/sys_vars/r/sysvars_wsrep,32bit.reject 2014-10-10 19:38:09.000000000 +0300
@@ -245,7 +245,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 131072
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Max number of rows in write set
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1048576
@@ -259,7 +259,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1073741824
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Max write set size (bytes)
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 4294901759
@@ -273,7 +273,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT mysql replication group commit
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
@@ -455,7 +455,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE SESSION
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Max number of times to retry a failed autocommit statement
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10000
@@ -483,7 +483,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of slave appliers to launch
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 512
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