Skip to content

Commit

Permalink
Bug#30088404 : CONCURRENT LOG BUFFER OF 8.0 CAUSES REGRESSION OF CPU …
Browse files Browse the repository at this point in the history
…BOUND PERFORMANCE ON LOW-END ARCHITECTURE

- improved ut0link_buf.h and log_closer_thread was removed because not needed
- add variable to choose former style log_write_up_to for low-end servers cpu% bound
  innodb_log_writer_threads=[ON|OFF]
- optimized checkpoint and sync_flush behavior

RB: 23457
Reviewed-by: Pawel Olchawa <pawel.olchawa@oracle.com>
  • Loading branch information
Yasufumi Kinoshita committed Apr 6, 2020
1 parent 1cf7773 commit 9bfe602
Show file tree
Hide file tree
Showing 24 changed files with 881 additions and 617 deletions.
8 changes: 4 additions & 4 deletions mysql-test/r/all_persisted_variables.result
Expand Up @@ -38,17 +38,17 @@ include/assert.inc [Expect 500+ variables in the table. Due to open Bugs, we are

# Test SET PERSIST

include/assert.inc [Expect 402 persisted variables in the table.]
include/assert.inc [Expect 403 persisted variables in the table.]

************************************************************
* 3. Restart server, it must preserve the persisted variable
* settings. Verify persisted configuration.
************************************************************
# restart

include/assert.inc [Expect 402 persisted variables in persisted_variables table.]
include/assert.inc [Expect 402 persisted variables shown as PERSISTED in variables_info table.]
include/assert.inc [Expect 402 persisted variables with matching peristed and global values.]
include/assert.inc [Expect 403 persisted variables in persisted_variables table.]
include/assert.inc [Expect 403 persisted variables shown as PERSISTED in variables_info table.]
include/assert.inc [Expect 403 persisted variables with matching peristed and global values.]

************************************************************
* 4. Test RESET PERSIST IF EXISTS. Verify persisted variable
Expand Down
154 changes: 0 additions & 154 deletions mysql-test/suite/innodb/r/innodb_redo_debug_1.result
Expand Up @@ -229,157 +229,3 @@ count(*)=0
1
DROP DATABASE dbredoopt;
DROP USER 'redo_wl_user'@'localhost';
# Test with log_advance_ready_for_write_before_update
DROP DATABASE IF EXISTS dbredoopt;
CREATE DATABASE dbredoopt;
USE dbredoopt;
CREATE TABLE dbredoopt.t1
(col1 INT, col2 INT, c1 LONGBLOB, c2 LONGBLOB,
PRIMARY KEY(col1), INDEX `idx2` (col2),
INDEX `idx3` (c1(300),c2(200))
);
CREATE PROCEDURE dbredoopt.populate_t1()
BEGIN
DECLARE i INT DEFAULT 1;
while (i <= 500) DO
INSERT INTO dbredoopt.t1 values (i, i,REPEAT('a',5000), REPEAT('b',5000));
SET i = i + 1;
END WHILE;
END|
CREATE USER 'redo_wl_user'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'redo_wl_user'@'localhost' WITH GRANT OPTION;
START TRANSACTION;
SELECT count(*) FROM dbredoopt.t1;
count(*)
0
call dbredoopt.populate_t1();
SELECT count(*) FROM dbredoopt.t1;
count(*)
500
SELECT col1 FROM dbredoopt.t1 LIMIT 10;
col1
1
2
3
4
5
6
7
8
9
10
COMMIT;
# Check rows which are not modified by parallel load
SELECT col1 FROM dbredoopt.t1 WHERE col1%50=0 AND (col1 < 501 AND col1 > 0 );
col1
50
100
150
200
250
300
350
400
450
500
# Wait till all mysql clients are connected
# Singal all mysql clients since each one is waiting for signal go_ahead
# with 'go_ahead' signal , all client suppose to resume in parallel
# Wait till all clients are over or server is gone
# restart
# Check rows which are not modified by parallel load
SELECT col1 FROM dbredoopt.t1 WHERE col1%50=0 AND (col1 < 501 AND col1 > 0 );
col1
50
100
150
200
250
300
350
400
450
500
# Check rows which are updated by parallel load
SELECT count(*)=0 FROM (SELECT col1,col2 FROM dbredoopt.t1 WHERE col1 NOT BETWEEN 1 AND 501 ) AS A WHERE (A.col1+A.col2) != 0 ;
count(*)=0
1
DROP DATABASE dbredoopt;
DROP USER 'redo_wl_user'@'localhost';
# Test with log_advance_ready_for_write_before_reclaim
DROP DATABASE IF EXISTS dbredoopt;
CREATE DATABASE dbredoopt;
USE dbredoopt;
CREATE TABLE dbredoopt.t1
(col1 INT, col2 INT, c1 LONGBLOB, c2 LONGBLOB,
PRIMARY KEY(col1), INDEX `idx2` (col2),
INDEX `idx3` (c1(300),c2(200))
);
CREATE PROCEDURE dbredoopt.populate_t1()
BEGIN
DECLARE i INT DEFAULT 1;
while (i <= 500) DO
INSERT INTO dbredoopt.t1 values (i, i,REPEAT('a',5000), REPEAT('b',5000));
SET i = i + 1;
END WHILE;
END|
CREATE USER 'redo_wl_user'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'redo_wl_user'@'localhost' WITH GRANT OPTION;
START TRANSACTION;
SELECT count(*) FROM dbredoopt.t1;
count(*)
0
call dbredoopt.populate_t1();
SELECT count(*) FROM dbredoopt.t1;
count(*)
500
SELECT col1 FROM dbredoopt.t1 LIMIT 10;
col1
1
2
3
4
5
6
7
8
9
10
COMMIT;
# Check rows which are not modified by parallel load
SELECT col1 FROM dbredoopt.t1 WHERE col1%50=0 AND (col1 < 501 AND col1 > 0 );
col1
50
100
150
200
250
300
350
400
450
500
# Wait till all mysql clients are connected
# Singal all mysql clients since each one is waiting for signal go_ahead
# with 'go_ahead' signal , all client suppose to resume in parallel
# Wait till all clients are over or server is gone
# restart
# Check rows which are not modified by parallel load
SELECT col1 FROM dbredoopt.t1 WHERE col1%50=0 AND (col1 < 501 AND col1 > 0 );
col1
50
100
150
200
250
300
350
400
450
500
# Check rows which are updated by parallel load
SELECT count(*)=0 FROM (SELECT col1,col2 FROM dbredoopt.t1 WHERE col1 NOT BETWEEN 1 AND 501 ) AS A WHERE (A.col1+A.col2) != 0 ;
count(*)=0
1
DROP DATABASE dbredoopt;
DROP USER 'redo_wl_user'@'localhost';
16 changes: 16 additions & 0 deletions mysql-test/suite/innodb/r/log_writer_threads.result
@@ -0,0 +1,16 @@
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
CREATE TABLE t1 (a CHAR(8));
SET GLOBAL innodb_log_writer_threads = ON;
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'log_flushed_by_writer SIGNAL log_flushed';
SET AUTOCOMMIT = 1;
INSERT INTO t1 (a) VALUES ('a');
SET DEBUG_SYNC = 'now WAIT_FOR log_flushed';
SET GLOBAL innodb_log_writer_threads = OFF;
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'log_flushed_by_self SIGNAL log_flushed';
SET AUTOCOMMIT = 1;
INSERT INTO t1 (a) VALUES ('a');
SET DEBUG_SYNC = 'now WAIT_FOR log_flushed';
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
16 changes: 0 additions & 16 deletions mysql-test/suite/innodb/t/innodb_redo_debug_1.test
Expand Up @@ -4,8 +4,6 @@
# 1) log_buffer_write_completed_before_store
# 2) log_buffer_write_before_memcpy
# 3) log_buffer_set_first_record_group_before_update
# 4) log_advance_ready_for_write_before_update
# 5) log_advance_ready_for_write_before_reclaim
#------------------------------------------------------------------------------

# Test uses debug binary
Expand Down Expand Up @@ -35,17 +33,3 @@ let debug_point=log_buffer_write_before_memcpy;
let client_cnt=5;
let debug_point=log_buffer_set_first_record_group_before_update;
--source suite/innodb/include/innodb_redo_debug.inc

--echo # Test with log_advance_ready_for_write_before_update
--source include/expect_crash.inc
# No. of parallel client running load
let client_cnt=5;
let debug_point=log_advance_ready_for_write_before_update;
--source suite/innodb/include/innodb_redo_debug.inc

--echo # Test with log_advance_ready_for_write_before_reclaim
--source include/expect_crash.inc
# No. of parallel client running load
let client_cnt=5;
let debug_point=log_advance_ready_for_write_before_reclaim;
--source suite/innodb/include/innodb_redo_debug.inc
49 changes: 49 additions & 0 deletions mysql-test/suite/innodb/t/log_writer_threads.test
@@ -0,0 +1,49 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc

--disable_query_log
SET @old_innodb_log_writer_threads = @@innodb_log_writer_threads;
SET @old_innodb_flush_log_at_trx_commit = @@innodb_flush_log_at_trx_commit;
--enable_query_log

# Save the initial number of concurrent sessions
--source include/count_sessions.inc

SET GLOBAL innodb_flush_log_at_trx_commit = 1;

--connect (con1,localhost,root,,)

CREATE TABLE t1 (a CHAR(8));

# log flushed by writer threads
SET GLOBAL innodb_log_writer_threads = ON;
SET DEBUG_SYNC = 'RESET';
--connection con1
SET DEBUG_SYNC = 'log_flushed_by_writer SIGNAL log_flushed';
SET AUTOCOMMIT = 1;
INSERT INTO t1 (a) VALUES ('a');
--connection default
SET DEBUG_SYNC = 'now WAIT_FOR log_flushed';

# log flushed by user thread
SET GLOBAL innodb_log_writer_threads = OFF;
SET DEBUG_SYNC = 'RESET';
--connection con1
SET DEBUG_SYNC = 'log_flushed_by_self SIGNAL log_flushed';
SET AUTOCOMMIT = 1;
INSERT INTO t1 (a) VALUES ('a');
--connection default
SET DEBUG_SYNC = 'now WAIT_FOR log_flushed';

# Cleanup
SET DEBUG_SYNC = 'RESET';
--disconnect con1
DROP TABLE t1;

--disable_query_log
SET GLOBAL innodb_log_writer_threads = @old_innodb_log_writer_threads;
SET GLOBAL innodb_flush_log_at_trx_commit = @old_innodb_flush_log_at_trx_commit;
--enable_query_log

# Wait till all disconnects are completed.
--source include/wait_until_count_sessions.inc
1 change: 0 additions & 1 deletion mysql-test/suite/perfschema/r/threads_innodb.result
Expand Up @@ -16,7 +16,6 @@ thread/innodb/io_log_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL Y
thread/innodb/io_read_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/io_write_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/log_checkpointer_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/log_closer_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/log_flush_notifier_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/log_flusher_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
thread/innodb/log_write_notifier_thread BACKGROUND NULL NULL NULL NULL NULL NULL NULL NULL YES
Expand Down
34 changes: 34 additions & 0 deletions mysql-test/suite/sys_vars/r/innodb_log_writer_threads_basic.result
@@ -0,0 +1,34 @@
SET @orig = @@global.innodb_log_writer_threads;
SET GLOBAL innodb_log_writer_threads = OFF;
SELECT @@global.innodb_log_writer_threads;
@@global.innodb_log_writer_threads
0
SET GLOBAL innodb_log_writer_threads = default;
SELECT @@global.innodb_log_writer_threads;
@@global.innodb_log_writer_threads
1
SET GLOBAL innodb_log_writer_threads = ON;
SELECT @@global.innodb_log_writer_threads;
@@global.innodb_log_writer_threads
1
SET GLOBAL innodb_log_writer_threads = 2;
ERROR 42000: Variable 'innodb_log_writer_threads' can't be set to the value of '2'
SELECT @@global.innodb_log_writer_threads;
@@global.innodb_log_writer_threads
1
SET GLOBAL innodb_log_writer_threads = 1e2;
ERROR 42000: Incorrect argument type to variable 'innodb_log_writer_threads'
SELECT @@global.innodb_log_writer_threads;
@@global.innodb_log_writer_threads
1
SET GLOBAL innodb_log_writer_threads = 1.0;
ERROR 42000: Incorrect argument type to variable 'innodb_log_writer_threads'
SELECT @@global.innodb_log_writer_threads;
@@global.innodb_log_writer_threads
1
SET innodb_log_writer_threads = OFF;
ERROR HY000: Variable 'innodb_log_writer_threads' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@global.innodb_log_writer_threads;
@@global.innodb_log_writer_threads
1
SET GLOBAL innodb_log_writer_threads = @orig;
29 changes: 29 additions & 0 deletions mysql-test/suite/sys_vars/t/innodb_log_writer_threads_basic.test
@@ -0,0 +1,29 @@
# Check the default value
SET @orig = @@global.innodb_log_writer_threads;

SET GLOBAL innodb_log_writer_threads = OFF;
SELECT @@global.innodb_log_writer_threads;

SET GLOBAL innodb_log_writer_threads = default;
SELECT @@global.innodb_log_writer_threads;

SET GLOBAL innodb_log_writer_threads = ON;
SELECT @@global.innodb_log_writer_threads;

-- error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_log_writer_threads = 2;
SELECT @@global.innodb_log_writer_threads;

-- error ER_WRONG_TYPE_FOR_VAR
SET GLOBAL innodb_log_writer_threads = 1e2;
SELECT @@global.innodb_log_writer_threads;

-- error ER_WRONG_TYPE_FOR_VAR
SET GLOBAL innodb_log_writer_threads = 1.0;
SELECT @@global.innodb_log_writer_threads;

-- error ER_GLOBAL_VARIABLE
SET innodb_log_writer_threads = OFF;
SELECT @@global.innodb_log_writer_threads;

SET GLOBAL innodb_log_writer_threads = @orig;
2 changes: 0 additions & 2 deletions mysql-test/suite/sysschema/r/pr_ps_setup_show_enabled.result
Expand Up @@ -227,7 +227,6 @@ innodb/io_write_thread BACKGROUND
innodb/io_write_thread BACKGROUND
innodb/io_write_thread BACKGROUND
innodb/log_checkpointer_thread BACKGROUND
innodb/log_closer_thread BACKGROUND
innodb/log_flush_notifier_thread BACKGROUND
innodb/log_flusher_thread BACKGROUND
innodb/log_write_notifier_thread BACKGROUND
Expand Down Expand Up @@ -278,7 +277,6 @@ innodb/io_write_thread BACKGROUND
innodb/io_write_thread BACKGROUND
innodb/io_write_thread BACKGROUND
innodb/log_checkpointer_thread BACKGROUND
innodb/log_closer_thread BACKGROUND
innodb/log_flush_notifier_thread BACKGROUND
innodb/log_flusher_thread BACKGROUND
innodb/log_write_notifier_thread BACKGROUND
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/t/all_persisted_variables.test
Expand Up @@ -40,7 +40,7 @@ call mtr.add_suppression("Failed to set up SSL because of the following SSL libr
call mtr.add_suppression("Failed to initialize TLS for channel: mysql_main");

let $total_global_vars=`SELECT COUNT(*) FROM performance_schema.global_variables where variable_name NOT LIKE 'ndb_%'`;
let $total_persistent_vars=402;
let $total_persistent_vars=403;

--echo ***************************************************************
--echo * 0. Verify that variables present in performance_schema.global
Expand Down

0 comments on commit 9bfe602

Please sign in to comment.