From 535a38c4559160c7a46f0d9ece52495b83718d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 20 Mar 2023 14:28:03 +0200 Subject: [PATCH 01/14] MDEV-30400 fixup: Fix the UNIV_ZIP_DEBUG build --- storage/innobase/btr/btr0btr.cc | 4 ++-- storage/innobase/btr/btr0cur.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index e54c2a101b8..0b74d3b4311 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -3316,7 +3316,7 @@ insert_empty: ut_a(!insert_page_zip || page_zip_validate(insert_page_zip, insert_page, - cursor->index)); + cursor->index())); } #endif /* UNIV_ZIP_DEBUG */ @@ -4378,7 +4378,7 @@ btr_discard_page( #ifdef UNIV_ZIP_DEBUG if (page_zip_des_t* merge_page_zip - = buf_block_get_page_zip(merge_block)); + = buf_block_get_page_zip(merge_block)) ut_a(page_zip_validate(merge_page_zip, merge_block->page.frame, index)); #endif /* UNIV_ZIP_DEBUG */ diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 27ed631099d..5b76a39b865 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1673,7 +1673,7 @@ dberr_t btr_cur_t::pessimistic_search_leaf(const dtuple_t *tuple, mtr->upgrade_buffer_fix(block_savepoint, RW_X_LATCH); #ifdef UNIV_ZIP_DEBUG const page_zip_des_t *page_zip= buf_block_get_page_zip(block); - ut_a(!page_zip || page_zip_validate(page_zip, page, index())); + ut_a(!page_zip || page_zip_validate(page_zip, block->page.frame, index())); #endif /* UNIV_ZIP_DEBUG */ if (page_has_next(block->page.frame) && !btr_block_get(*index(), btr_page_get_next(block->page.frame), From dccbb5a6dba21b241e1796af82a0db85de28d195 Mon Sep 17 00:00:00 2001 From: Tingyao Nian Date: Wed, 15 Mar 2023 19:14:01 +0000 Subject: [PATCH 02/14] [MDEV-30824] Fix binlog to use 'String' for setting 'character_set_client' Commit a923d6f49c1ad6fd3f4d6ec02e444c26e4d1dfa8 disabled numeric setting of character_set_* variables with non-default values: MariaDB [(none)]> set character_set_client=224; ERROR 1115 (42000): Unknown character set: '224' However the corresponding binlog functionality still write numeric values for log event, and this will break binlog replay if the value is not default. Now make the server use 'String' type for 'character_set_client' when generating binlog events Before: /*!\C utf8mb4 *//*!*/; SET @@session.character_set_client=224,@@session.collation_connection=224,@@session.collation_server=33/*!*/; After: /*!\C utf8mb4 *//*!*/; SET @@session.character_set_client=utf8mb4,@@session.collation_connection=33,@@session.collation_server=8/*!*/; Note: prior to the previous commit, setting with '224' or '45' or 'utf8mb4' have the same effect, as they all set the parameter to 'utf8mb4'. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- mysql-test/main/mysqlbinlog-innodb.result | 4 +- mysql-test/main/mysqlbinlog.result | 36 ++++++------- .../main/mysqlbinlog_row_compressed.result | 2 +- .../main/mysqlbinlog_row_minimal.result | 4 +- .../main/mysqlbinlog_stmt_compressed.result | 2 +- mysql-test/main/user_var-binlog.result | 2 +- .../binlog/include/binlog_row_annotate.inc | 12 ++--- .../binlog/include/ctype_ucs_binlog.test | 4 +- .../suite/binlog/r/binlog_base64_flag.result | 2 +- .../r/binlog_mysqlbinlog_row_innodb.result | 8 +-- .../r/binlog_mysqlbinlog_row_myisam.result | 8 +-- .../suite/binlog/t/binlog_mysqlbinlog2.test | 54 +++++++++---------- .../binlog/t/binlog_mysqlbinlog_row.test | 4 +- .../t/binlog_mysqlbinlog_row_trans.test | 2 +- .../t/binlog_row_mysqlbinlog_options.test | 4 +- mysql-test/suite/binlog/t/flashback.test | 4 +- .../suite/engines/funcs/r/rpl_sp.result | 2 +- .../suite/galera/r/galera_gra_log.result | 2 +- .../rpl/r/rpl_blackhole_row_annotate.result | 2 +- mysql-test/suite/rpl/r/rpl_hrtime.result | 2 +- mysql-test/suite/rpl/r/rpl_mdev382.result | 6 +-- .../suite/rpl/r/rpl_old_master_29078.result | 2 +- .../suite/rpl/r/rpl_parallel_29322.result | 4 +- .../suite/rpl/r/rpl_row_mysqlbinlog.result | 8 +-- mysql-test/suite/rpl/r/rpl_sp.result | 2 +- mysql-test/suite/rpl/r/rpl_timestamp.result | 2 +- sql/log_event_client.cc | 4 +- 27 files changed, 94 insertions(+), 94 deletions(-) diff --git a/mysql-test/main/mysqlbinlog-innodb.result b/mysql-test/main/mysqlbinlog-innodb.result index be34c273019..566563bff76 100644 --- a/mysql-test/main/mysqlbinlog-innodb.result +++ b/mysql-test/main/mysqlbinlog-innodb.result @@ -33,7 +33,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES (1) @@ -64,7 +64,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES (1) diff --git a/mysql-test/main/mysqlbinlog.result b/mysql-test/main/mysqlbinlog.result index 3e3d9d092e3..c6d9ef97229 100644 --- a/mysql-test/main/mysqlbinlog.result +++ b/mysql-test/main/mysqlbinlog.result @@ -26,7 +26,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */ @@ -106,7 +106,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`) @@ -142,7 +142,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; COMMIT @@ -193,7 +193,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") @@ -220,7 +220,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */ @@ -300,7 +300,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`word`) @@ -336,7 +336,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; COMMIT @@ -387,7 +387,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") @@ -496,7 +496,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() @@ -548,7 +548,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a varchar(64) character set utf8) @@ -728,7 +728,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1(a int) engine= innodb @@ -782,7 +782,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN @@ -817,7 +817,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN @@ -859,7 +859,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; BEGIN @@ -977,7 +977,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) @@ -1060,7 +1060,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) @@ -1143,7 +1143,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) @@ -1226,7 +1226,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table test.t1 (id int not null) diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index 539729a79bb..820e100220f 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -37,7 +37,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index 57556949a47..a05a778105f 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -35,7 +35,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) @@ -401,7 +401,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; COMMIT diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.result b/mysql-test/main/mysqlbinlog_stmt_compressed.result index 37aa2c327ed..7db60a96b72 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.result +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.result @@ -37,7 +37,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=#/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) diff --git a/mysql-test/main/user_var-binlog.result b/mysql-test/main/user_var-binlog.result index c07d6d42b98..cd0bf056c17 100644 --- a/mysql-test/main/user_var-binlog.result +++ b/mysql-test/main/user_var-binlog.result @@ -33,7 +33,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=#/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=#/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES(@`a b`) diff --git a/mysql-test/suite/binlog/include/binlog_row_annotate.inc b/mysql-test/suite/binlog/include/binlog_row_annotate.inc index 69d9dc3cc49..c36e5437cce 100644 --- a/mysql-test/suite/binlog/include/binlog_row_annotate.inc +++ b/mysql-test/suite/binlog/include/binlog_row_annotate.inc @@ -125,7 +125,7 @@ if (!$use_remote_mysqlbinlog) --echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) --echo ##################################################################################### - --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ + --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $datadir/master-bin.000001 --echo # @@ -135,7 +135,7 @@ if (!$use_remote_mysqlbinlog) --echo # - DELETE test1.t1, test2.t2 FROM <...> --echo ##################################################################################### - --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ + --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v $datadir/master-bin.000001 --echo # @@ -144,7 +144,7 @@ if (!$use_remote_mysqlbinlog) --echo # No Annotates should appear in this output --echo ##################################################################################### - --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ + --replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-row-events -v -v $datadir/master-bin.000001 --let use_remote_mysqlbinlog= 0 @@ -161,7 +161,7 @@ if (!$use_remote_mysqlbinlog) --echo # - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map) --echo ##################################################################################### ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 --echo # @@ -171,7 +171,7 @@ if (!$use_remote_mysqlbinlog) --echo # - DELETE test1.t1, test2.t2 FROM <...> --echo ##################################################################################### ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows --database=test1 -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 --echo # @@ -180,7 +180,7 @@ if (!$use_remote_mysqlbinlog) --echo # No Annotates should appear in this output --echo ##################################################################################### ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows --skip-annotate-row-events -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 # Clean-up diff --git a/mysql-test/suite/binlog/include/ctype_ucs_binlog.test b/mysql-test/suite/binlog/include/ctype_ucs_binlog.test index 0e9d49f6663..9c55e8bc449 100644 --- a/mysql-test/suite/binlog/include/ctype_ucs_binlog.test +++ b/mysql-test/suite/binlog/include/ctype_ucs_binlog.test @@ -16,7 +16,7 @@ source include/show_binlog_events.inc; # escaped). flush logs; let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 drop table t2; @@ -54,7 +54,7 @@ SELECT * FROM t1; DROP TABLE t1; FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /TIMESTAMP=[0-9]*/TIMESTAMP=XXX/ /# at [0-9]*/# at #/ /(exec_time=|end_log_pos |Xid = |thread_id=|server id |table id |mapped to number )[0-9]+/\1#/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Gtid list [[][0-9]+-[0-9]+-[0-9]+[\]]/Gtid list [#-#-#]/ /session[.](gtid_domain_id|server_id|gtid_seq_no)=[0-9]+/session.\1=#/ /(^#|created )[0-9]{6} [ 12][0-9]:[0-9]{2}:[0-9]{2}/\1YYMMDD HH:MM:SS/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /TIMESTAMP=[0-9]*/TIMESTAMP=XXX/ /# at [0-9]*/# at #/ /(exec_time=|end_log_pos |Xid = |thread_id=|server id |table id |mapped to number )[0-9]+/\1#/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Gtid list [[][0-9]+-[0-9]+-[0-9]+[\]]/Gtid list [#-#-#]/ /session[.](gtid_domain_id|server_id|gtid_seq_no)=[0-9]+/session.\1=#/ /(^#|created )[0-9]{6} [ 12][0-9]:[0-9]{2}:[0-9]{2}/\1YYMMDD HH:MM:SS/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows -vv $MYSQLD_DATADIR/master-bin.000003 SET TIMESTAMP=DEFAULT; diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index a79ae45981e..045f3adfd71 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -63,7 +63,7 @@ SET TIMESTAMP=1196959712/*!*/; SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int) engine= myisam diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result index 989c0dcb723..01a28690a03 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result @@ -2272,7 +2272,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( @@ -5281,7 +5281,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( @@ -5681,7 +5681,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( @@ -6319,7 +6319,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result index 84c0c2769de..123e2d53ae4 100644 --- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result @@ -2272,7 +2272,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( @@ -5304,7 +5304,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( @@ -5710,7 +5710,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( @@ -6358,7 +6358,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=X/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=X/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 ( diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test index f5b7e2c01d6..1d4cf3fca79 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test @@ -47,42 +47,42 @@ select "--- Local --" as ""; # be time dependent (the Start events). Better than nothing. # let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- offset --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --offset=5 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start-position --" as ""; --enable_query_log let $start_pos= `select @binlog_start_pos + 696`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log let $stop_pos= `select @binlog_start_pos + 696`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log let $start_pos= `select @binlog_start_pos + 696`; let $stop_pos= `select @binlog_start_pos + 857`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--start-datetime=1970-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--stop-datetime=1970-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 --disable_query_log @@ -92,119 +92,119 @@ select "--- Local with 2 binlogs on command line --" as ""; # This is to verify that some options apply only to first, or last binlog flush logs; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- offset --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --offset=5 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- start-position --" as ""; --enable_query_log let $start_pos= `select @binlog_start_pos + 696`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log let $stop_pos= `select @binlog_start_pos + 134`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--start-datetime=1970-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- stop-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--stop-datetime=1970-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- Remote --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- offset --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --offset=5 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start-position --" as ""; --enable_query_log let $start_pos= `select @binlog_start_pos + 696`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log let $stop_pos= `select @binlog_start_pos + 696`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log let $start_pos= `select @binlog_start_pos + 696`; let $stop_pos= `select @binlog_start_pos + 812`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--start-datetime=1970-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- stop-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--stop-datetime=1970-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- Remote with 2 binlogs on command line --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- offset --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --offset=5 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- start-position --" as ""; --enable_query_log let $start_pos= `select @binlog_start_pos + 696`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log let $stop_pos= `select @binlog_start_pos + 109`; ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--start-datetime=19700121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- stop-datetime --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form "--stop-datetime=1970/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- to-last-log --" as ""; --enable_query_log ---replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001 # clean up diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test index b366578f3cd..516bbe0a6d3 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test @@ -478,7 +478,7 @@ DROP TABLE t1; FLUSH LOGS; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -487,5 +487,5 @@ FLUSH LOGS; --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000002 2>&1 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000003 diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test index 12d83e0a777..11d1ff80996 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test @@ -150,7 +150,7 @@ FLUSH LOGS; --echo # let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # diff --git a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test index 064cebef47f..f5761180dd7 100644 --- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test +++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_options.test @@ -59,7 +59,7 @@ flush logs; --echo # let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows --rewrite-db="test1->new_test1" --rewrite-db="test3->new_test3" -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # @@ -70,7 +70,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; --echo # --read-from-remote-server --echo # ---replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /server id [0-9]*/server id #/ /server v [^ ]*/server v #.##.##/ /exec_time=[0-9]*/exec_time=#/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows --rewrite-db="test1->new_test1" --rewrite-db="test3->new_test3" -v -v --read-from-remote-server --user=root --host=localhost --port=$MASTER_MYPORT master-bin.000001 DROP DATABASE test1; diff --git a/mysql-test/suite/binlog/t/flashback.test b/mysql-test/suite/binlog/t/flashback.test index abe054e4de0..f8f76ae8b11 100644 --- a/mysql-test/suite/binlog/t/flashback.test +++ b/mysql-test/suite/binlog/t/flashback.test @@ -55,7 +55,7 @@ FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # < CASE 1 > @@ -64,7 +64,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ +--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[a-zA-Z0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --exec $MYSQL_BINLOG -B --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001 --echo # < CASE 1 > diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp.result b/mysql-test/suite/engines/funcs/r/rpl_sp.result index 30a95dc65d9..21f83bb7b72 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sp.result +++ b/mysql-test/suite/engines/funcs/r/rpl_sp.result @@ -775,7 +775,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; drop database if exists mysqltest1 diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result index 8ac76692262..8c0286a4ef1 100644 --- a/mysql-test/suite/galera/r/galera_gra_log.result +++ b/mysql-test/suite/galera/r/galera_gra_log.result @@ -22,7 +22,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (f1 INTEGER) diff --git a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result index f411fdf4f97..b7019d051e1 100644 --- a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result +++ b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result @@ -204,7 +204,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (a INT, b INT, c INT) diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result index 5f0b8f4123a..03732198e73 100644 --- a/mysql-test/suite/rpl/r/rpl_hrtime.result +++ b/mysql-test/suite/rpl/r/rpl_hrtime.result @@ -41,7 +41,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b varchar(100), c datetime(2)) diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result index b88b47b2dfa..d5947343967 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev382.result +++ b/mysql-test/suite/rpl/r/rpl_mdev382.result @@ -183,7 +183,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3), @@ -283,7 +283,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100)) @@ -392,7 +392,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES(1) diff --git a/mysql-test/suite/rpl/r/rpl_old_master_29078.result b/mysql-test/suite/rpl/r/rpl_old_master_29078.result index 89d3e039bf3..eefa3acc847 100644 --- a/mysql-test/suite/rpl/r/rpl_old_master_29078.result +++ b/mysql-test/suite/rpl/r/rpl_old_master_29078.result @@ -20,7 +20,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (f1 timestamp, f2 timestamp) diff --git a/mysql-test/suite/rpl/r/rpl_parallel_29322.result b/mysql-test/suite/rpl/r/rpl_parallel_29322.result index f7059705b37..74b8b1fbb66 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_29322.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_29322.result @@ -46,7 +46,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (f1 timestamp, f2 timestamp) @@ -139,7 +139,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C utf8 *//*!*/; -SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=utf8,@@session.collation_connection=33,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (f1 timestamp, f2 timestamp) diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result index 83f16122d96..8ba705a76ee 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result @@ -172,7 +172,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) @@ -195,7 +195,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1(word VARCHAR(20)) @@ -310,7 +310,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1(word VARCHAR(20)) @@ -339,7 +339,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 6e733fa555d..315714f6de6 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -788,7 +788,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=0/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; drop database if exists mysqltest1 diff --git a/mysql-test/suite/rpl/r/rpl_timestamp.result b/mysql-test/suite/rpl/r/rpl_timestamp.result index 5e38de40b42..3ced32aa72f 100644 --- a/mysql-test/suite/rpl/r/rpl_timestamp.result +++ b/mysql-test/suite/rpl/r/rpl_timestamp.result @@ -32,7 +32,7 @@ SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.uniq SET @@session.sql_mode=1411383296/*!*/; SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; -SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; create table t1 (f1 timestamp, f2 timestamp) diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index 9a8ee6b0239..c1c5ddf377c 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -1965,11 +1965,11 @@ bool Query_log_event::print_query_header(IO_CACHE* file, goto err; } if (my_b_printf(file,"SET " - "@@session.character_set_client=%d," + "@@session.character_set_client=%s," "@@session.collation_connection=%d," "@@session.collation_server=%d" "%s\n", - uint2korr(charset), + cs_info->csname, uint2korr(charset+2), uint2korr(charset+4), print_event_info->delimiter)) From 701399ad375fe71daded4fc7f18f347594352aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 22 Mar 2023 15:19:52 +0200 Subject: [PATCH 03/14] MDEV-30882 Crash on ROLLBACK in a ROW_FORMAT=COMPRESSED table btr_cur_upd_rec_in_place(): Avoid calling page_zip_write_rec() if we are not modifying any fields that are stored in compressed format. btr_cur_update_in_place_zip_check(): New function to check if a ROW_FORMAT=COMPRESSED record can actually be updated in place. btr_cur_pessimistic_update(): If the BTR_KEEP_POS_FLAG is not set (we are in a ROLLBACK and cannot write any BLOBs), ignore the potential overflow and let page_zip_reorganize() or page_zip_compress() handle it. This avoids a failure when an attempted UPDATE of an NULL column to 0 is rolled back. During the ROLLBACK, we would try to move a non-updated long column to off-page storage in order to avoid a compression failure of the ROW_FORMAT=COMPRESSED page. page_zip_write_trx_id_and_roll_ptr(): Remove an assertion that would fail in row_upd_rec_in_place() because the uncompressed page would already have been modified there. This is a 10.5 version of commit ff3d4395d808b6421d2e0714e10d48c7aa2f3c3a (different because of commit 08ba388713946c03aa591899cd3a446a6202f882). --- storage/innobase/btr/btr0cur.cc | 103 ++++++++++++++++++++++++++---- storage/innobase/page/page0zip.cc | 3 - 2 files changed, 89 insertions(+), 17 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 463b9da9744..a14874ec011 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -4218,9 +4218,85 @@ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index, } } - if (UNIV_LIKELY_NULL(block->page.zip.data)) { - page_zip_write_rec(block, rec, index, offsets, 0, mtr); + if (UNIV_LIKELY(!block->page.zip.data)) { + return; } + + switch (update->n_fields) { + case 0: + /* We only changed the delete-mark flag. */ + return; + case 1: + if (!index->is_clust() + || update->fields[0].field_no != index->db_roll_ptr()) { + break; + } + goto update_sys; + case 2: + if (!index->is_clust() + || update->fields[0].field_no != index->db_trx_id() + || update->fields[1].field_no != index->db_roll_ptr()) { + break; + } + update_sys: + ulint len; + const byte* sys = rec_get_nth_field(rec, offsets, + index->db_trx_id(), &len); + ut_ad(len == DATA_TRX_ID_LEN); + page_zip_write_trx_id_and_roll_ptr( + block, rec, offsets, index->db_trx_id(), + trx_read_trx_id(sys), + trx_read_roll_ptr(sys + DATA_TRX_ID_LEN), mtr); + return; + } + + page_zip_write_rec(block, rec, index, offsets, 0, mtr); +} + +/** Check if a ROW_FORMAT=COMPRESSED page can be updated in place +@param cur cursor pointing to ROW_FORMAT=COMPRESSED page +@param offsets rec_get_offsets(btr_cur_get_rec(cur)) +@param update index fields being updated +@param mtr mini-transaction +@return the record in the ROW_FORMAT=COMPRESSED page +@retval nullptr if the page cannot be updated in place */ +ATTRIBUTE_COLD static +rec_t *btr_cur_update_in_place_zip_check(btr_cur_t *cur, rec_offs *offsets, + const upd_t& update, mtr_t *mtr) +{ + dict_index_t *index= cur->index; + ut_ad(!index->table->is_temporary()); + + switch (update.n_fields) { + case 0: + /* We are only changing the delete-mark flag. */ + break; + case 1: + if (!index->is_clust() || + update.fields[0].field_no != index->db_roll_ptr()) + goto check_for_overflow; + /* We are only changing the delete-mark flag and DB_ROLL_PTR. */ + break; + case 2: + if (!index->is_clust() || + update.fields[0].field_no != index->db_trx_id() || + update.fields[1].field_no != index->db_roll_ptr()) + goto check_for_overflow; + /* We are only changing DB_TRX_ID, DB_ROLL_PTR, and the delete-mark. + They can be updated in place in the uncompressed part of the + ROW_FORMAT=COMPRESSED page. */ + break; + check_for_overflow: + default: + if (!btr_cur_update_alloc_zip(btr_cur_get_page_zip(cur), + btr_cur_get_page_cur(cur), + index, + offsets, rec_offs_size(offsets), + false, mtr)) + return nullptr; + } + + return btr_cur_get_rec(cur); } /*************************************************************//** @@ -4282,17 +4358,10 @@ btr_cur_update_in_place( page_zip_des_t* page_zip = buf_block_get_page_zip(block); /* Check that enough space is available on the compressed page. */ - if (UNIV_LIKELY_NULL(page_zip)) { - ut_ad(!index->table->is_temporary()); - - if (!btr_cur_update_alloc_zip( - page_zip, btr_cur_get_page_cur(cursor), - index, offsets, rec_offs_size(offsets), - false, mtr)) { - return(DB_ZIP_OVERFLOW); - } - - rec = btr_cur_get_rec(cursor); + if (UNIV_LIKELY_NULL(page_zip) + && !(rec = btr_cur_update_in_place_zip_check( + cursor, offsets, *update, mtr))) { + return DB_ZIP_OVERFLOW; } /* Do lock checking and undo logging */ @@ -5040,7 +5109,13 @@ btr_cur_pessimistic_update( ut_ad(page_is_leaf(block->frame)); ut_ad(dict_index_is_clust(index)); - ut_ad(flags & BTR_KEEP_POS_FLAG); + if (UNIV_UNLIKELY(!(flags & BTR_KEEP_POS_FLAG))) { + ut_ad(page_zip != NULL); + dtuple_convert_back_big_rec(index, new_entry, + big_rec_vec); + big_rec_vec = NULL; + n_ext = dtuple_get_n_ext(new_entry); + } } /* Do lock checking and undo logging */ diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 647bc381755..8ed4863b3fb 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -3980,9 +3980,6 @@ page_zip_write_trx_id_and_roll_ptr( ut_ad(field + DATA_TRX_ID_LEN == rec_get_nth_field(rec, offsets, trx_id_col + 1, &len)); ut_ad(len == DATA_ROLL_PTR_LEN); -#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG - ut_a(!memcmp(storage, field, sys_len)); -#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ compile_time_assert(DATA_TRX_ID_LEN == 6); mach_write_to_6(field, trx_id); compile_time_assert(DATA_ROLL_PTR_LEN == 7); From a8b616d1e92ca9a4f4ba929aba41f64b19b2d169 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Thu, 23 Mar 2023 22:31:55 +0300 Subject: [PATCH 04/14] MDEV-30421 rpl_parallel_*.test cleanup Moved rpl_parallel_*.inc to rpl_parallel_*.test --- .../rpl_parallel_analyze_table_hang.test | 2 +- .../rpl_parallel_deadlock_corrupt_binlog.test | 2 +- .../rpl_parallel_domain.test | 2 +- .../rpl_parallel_domain_slave_single_grp.test | 2 +- .../rpl_parallel_free_deferred_event.test | 2 +- .../rpl_parallel_gco_wait_kill.test | 2 +- ...l_parallel_gtid_slave_pos_update_fail.test | 2 +- .../rpl_parallel_ignore_error_on_rotate.test | 2 +- .../rpl_parallel_innodb_lock_conflict.test | 2 +- .../rpl_parallel_missed_error_handling.test | 2 +- .../binlog_encryption/rpl_parallel_mode.test | 2 +- .../rpl_parallel_partial_binlog_trans.test | 2 +- .../rpl_parallel_record_gtid_wakeup.test | 2 +- .../rpl_parallel_retry_deadlock.test | 2 +- .../rpl_parallel_rollback_assert.test | 2 +- .../rpl_parallel_single_grpcmt.test | 2 +- .../rpl_parallel_slave_bgc_kill.test | 2 +- .../rpl_parallel_stop_on_con_kill.test | 2 +- .../rpl_parallel_stop_slave.test | 2 +- .../rpl_parallel_wrong_binlog_order.test | 2 +- .../rpl_parallel_wrong_exec_master_pos.test | 2 +- .../rpl_parallel_analyze_table_hang.inc | 73 --- .../rpl_parallel_deadlock_corrupt_binlog.inc | 80 --- .../suite/rpl/include/rpl_parallel_domain.inc | 87 ---- .../rpl_parallel_domain_slave_single_grp.inc | 128 ----- .../rpl_parallel_free_deferred_event.inc | 67 --- .../include/rpl_parallel_gco_wait_kill.inc | 366 -------------- ...pl_parallel_gtid_slave_pos_update_fail.inc | 98 ---- .../rpl_parallel_ignore_error_on_rotate.inc | 96 ---- .../rpl_parallel_innodb_lock_conflict.inc | 107 ---- .../rpl_parallel_missed_error_handling.inc | 87 ---- .../suite/rpl/include/rpl_parallel_mode.inc | 87 ---- .../rpl_parallel_partial_binlog_trans.inc | 71 --- .../rpl_parallel_record_gtid_wakeup.inc | 72 --- .../include/rpl_parallel_retry_deadlock.inc | 281 ----------- .../include/rpl_parallel_rollback_assert.inc | 62 --- .../include/rpl_parallel_single_grpcmt.inc | 170 ------- .../include/rpl_parallel_slave_bgc_kill.inc | 454 ----------------- .../include/rpl_parallel_stop_on_con_kill.inc | 129 ----- .../rpl/include/rpl_parallel_stop_slave.inc | 114 ----- .../rpl_parallel_wrong_binlog_order.inc | 91 ---- .../rpl_parallel_wrong_exec_master_pos.inc | 56 --- .../t/rpl_parallel_analyze_table_hang.test | 74 ++- .../rpl_parallel_deadlock_corrupt_binlog.test | 81 +++- .../suite/rpl/t/rpl_parallel_domain.test | 88 +++- .../rpl_parallel_domain_slave_single_grp.test | 129 ++++- .../t/rpl_parallel_free_deferred_event.test | 68 ++- .../rpl/t/rpl_parallel_gco_wait_kill.test | 367 +++++++++++++- ...l_parallel_gtid_slave_pos_update_fail.test | 99 +++- .../rpl_parallel_ignore_error_on_rotate.test | 97 +++- .../t/rpl_parallel_innodb_lock_conflict.test | 108 ++++- .../t/rpl_parallel_missed_error_handling.test | 88 +++- mysql-test/suite/rpl/t/rpl_parallel_mode.test | 88 +++- .../t/rpl_parallel_partial_binlog_trans.test | 72 ++- .../t/rpl_parallel_record_gtid_wakeup.test | 73 ++- .../rpl/t/rpl_parallel_retry_deadlock.test | 282 ++++++++++- .../rpl/t/rpl_parallel_rollback_assert.test | 63 ++- .../rpl/t/rpl_parallel_single_grpcmt.test | 171 ++++++- .../rpl/t/rpl_parallel_slave_bgc_kill.test | 455 +++++++++++++++++- .../rpl/t/rpl_parallel_stop_on_con_kill.test | 130 ++++- .../suite/rpl/t/rpl_parallel_stop_slave.test | 115 ++++- .../t/rpl_parallel_wrong_binlog_order.test | 92 +++- .../t/rpl_parallel_wrong_exec_master_pos.test | 57 ++- 63 files changed, 2797 insertions(+), 2818 deletions(-) delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_analyze_table_hang.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_domain.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_free_deferred_event.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_missed_error_handling.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_mode.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_partial_binlog_trans.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_retry_deadlock.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_rollback_assert.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_single_grpcmt.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_stop_on_con_kill.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_wrong_binlog_order.inc delete mode 100644 mysql-test/suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_analyze_table_hang.test b/mysql-test/suite/binlog_encryption/rpl_parallel_analyze_table_hang.test index 69e76692ce1..14eb643be5d 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_analyze_table_hang.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_analyze_table_hang.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_analyze_table_hang.inc +--source suite/rpl/t/rpl_parallel_analyze_table_hang.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_deadlock_corrupt_binlog.test b/mysql-test/suite/binlog_encryption/rpl_parallel_deadlock_corrupt_binlog.test index 71c589dcd88..bc509a29c0d 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_deadlock_corrupt_binlog.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_deadlock_corrupt_binlog.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc +--source suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_domain.test b/mysql-test/suite/binlog_encryption/rpl_parallel_domain.test index b498b8616c8..8e86bea880a 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_domain.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_domain.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_domain.inc +--source suite/rpl/t/rpl_parallel_domain.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_domain_slave_single_grp.test b/mysql-test/suite/binlog_encryption/rpl_parallel_domain_slave_single_grp.test index ce9239f189e..6f45f982e16 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_domain_slave_single_grp.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_domain_slave_single_grp.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc +--source suite/rpl/t/rpl_parallel_domain_slave_single_grp.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_free_deferred_event.test b/mysql-test/suite/binlog_encryption/rpl_parallel_free_deferred_event.test index d0b6c970210..aa31efb53c1 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_free_deferred_event.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_free_deferred_event.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_free_deferred_event.inc +--source suite/rpl/t/rpl_parallel_free_deferred_event.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_gco_wait_kill.test b/mysql-test/suite/binlog_encryption/rpl_parallel_gco_wait_kill.test index 853465f1760..84655914b8d 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_gco_wait_kill.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_gco_wait_kill.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_gco_wait_kill.inc +--source suite/rpl/t/rpl_parallel_gco_wait_kill.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_gtid_slave_pos_update_fail.test b/mysql-test/suite/binlog_encryption/rpl_parallel_gtid_slave_pos_update_fail.test index 67105ccafee..f259b5a711f 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_gtid_slave_pos_update_fail.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_gtid_slave_pos_update_fail.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc +--source suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_ignore_error_on_rotate.test b/mysql-test/suite/binlog_encryption/rpl_parallel_ignore_error_on_rotate.test index ce57184d812..fe017a7b24c 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_ignore_error_on_rotate.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_ignore_error_on_rotate.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc +--source suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_innodb_lock_conflict.test b/mysql-test/suite/binlog_encryption/rpl_parallel_innodb_lock_conflict.test index 624667d5408..8f8cb25a14c 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_innodb_lock_conflict.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_innodb_lock_conflict.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc +--source suite/rpl/t/rpl_parallel_innodb_lock_conflict.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.test b/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.test index c6d09f2196b..d0eaf07f58e 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_missed_error_handling.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_missed_error_handling.inc +--source suite/rpl/t/rpl_parallel_missed_error_handling.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_mode.test b/mysql-test/suite/binlog_encryption/rpl_parallel_mode.test index 93170f61c95..3723550669f 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_mode.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_mode.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_mode.inc +--source suite/rpl/t/rpl_parallel_mode.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_partial_binlog_trans.test b/mysql-test/suite/binlog_encryption/rpl_parallel_partial_binlog_trans.test index 4f90cf4808e..c2b4a1f6b4c 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_partial_binlog_trans.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_partial_binlog_trans.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_partial_binlog_trans.inc +--source suite/rpl/t/rpl_parallel_partial_binlog_trans.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_record_gtid_wakeup.test b/mysql-test/suite/binlog_encryption/rpl_parallel_record_gtid_wakeup.test index cb3b0dfa119..577256bf0f7 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_record_gtid_wakeup.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_record_gtid_wakeup.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc +--source suite/rpl/t/rpl_parallel_record_gtid_wakeup.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_retry_deadlock.test b/mysql-test/suite/binlog_encryption/rpl_parallel_retry_deadlock.test index 61c2cb22a75..04bfb2b71cd 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_retry_deadlock.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_retry_deadlock.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_retry_deadlock.inc +--source suite/rpl/t/rpl_parallel_retry_deadlock.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_rollback_assert.test b/mysql-test/suite/binlog_encryption/rpl_parallel_rollback_assert.test index 181305219be..33b1435eb62 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_rollback_assert.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_rollback_assert.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_rollback_assert.inc +--source suite/rpl/t/rpl_parallel_rollback_assert.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_single_grpcmt.test b/mysql-test/suite/binlog_encryption/rpl_parallel_single_grpcmt.test index 6a13735c29c..50379b8978c 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_single_grpcmt.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_single_grpcmt.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_single_grpcmt.inc +--source suite/rpl/t/rpl_parallel_single_grpcmt.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.test b/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.test index 72597f32685..c291d607b8f 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_slave_bgc_kill.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_slave_bgc_kill.inc +--source suite/rpl/t/rpl_parallel_slave_bgc_kill.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_stop_on_con_kill.test b/mysql-test/suite/binlog_encryption/rpl_parallel_stop_on_con_kill.test index adec2dc631c..b5b2a09b6cc 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_stop_on_con_kill.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_stop_on_con_kill.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_stop_on_con_kill.inc +--source suite/rpl/t/rpl_parallel_stop_on_con_kill.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_stop_slave.test b/mysql-test/suite/binlog_encryption/rpl_parallel_stop_slave.test index c59b2805569..a7a9c3b9e78 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_stop_slave.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_stop_slave.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_stop_slave.inc +--source suite/rpl/t/rpl_parallel_stop_slave.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_binlog_order.test b/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_binlog_order.test index 4141dfce6d6..ac683dafd83 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_binlog_order.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_binlog_order.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_wrong_binlog_order.inc +--source suite/rpl/t/rpl_parallel_wrong_binlog_order.test diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_exec_master_pos.test b/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_exec_master_pos.test index 34268eb6622..ab0e1af5092 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_exec_master_pos.test +++ b/mysql-test/suite/binlog_encryption/rpl_parallel_wrong_exec_master_pos.test @@ -1 +1 @@ ---source suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc +--source suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test diff --git a/mysql-test/suite/rpl/include/rpl_parallel_analyze_table_hang.inc b/mysql-test/suite/rpl/include/rpl_parallel_analyze_table_hang.inc deleted file mode 100644 index 62a7501c36b..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_analyze_table_hang.inc +++ /dev/null @@ -1,73 +0,0 @@ ---echo *** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang *** ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode='conservative'; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; - ---connection server_1 -# Inject two group commits. The bug was that ANALYZE TABLE would call -# wakeup_subsequent_commits() too early, allowing the following transaction -# in the same group to run ahead and binlog and free the GCO. Then we get -# wrong binlog order and later access freed GCO, which causes lost wakeup -# of following GCO and thus replication hang. -# We injected a small sleep in ANALYZE to make the race easier to hit (this -# can only cause false negatives in versions with the bug, not false positives, -# so sleep is ok here. And it's in general not possible to trigger reliably -# the race with debug_sync, since the bugfix makes the race impossible). - -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -# Group commit with cid=10000, two event groups. -SET @commit_id= 10000; -ANALYZE TABLE t2; -INSERT INTO t3 VALUES (120, 0); - -# Group commit with cid=10001, one event group. -SET @commit_id= 10001; -INSERT INTO t3 VALUES (121, 0); - -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a >= 120 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a >= 120 ORDER BY a; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t2,t3; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc b/mysql-test/suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc deleted file mode 100644 index 592ffd3b068..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_deadlock_corrupt_binlog.inc +++ /dev/null @@ -1,80 +0,0 @@ ---echo *** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption *** ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=1; -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; -CALL mtr.add_suppression("Unexpected break of being relay-logged GTID"); - ---connection server_1 -INSERT INTO t2 VALUES (101); -INSERT INTO t2 VALUES (102); -INSERT INTO t2 VALUES (103); -INSERT INTO t2 VALUES (104); -INSERT INTO t2 VALUES (105); -# Inject a partial event group (missing XID at the end). The bug was that such -# partial group was not handled appropriately, leading to server deadlock. -SET gtid_seq_no=1000; -INSERT INTO t2 VALUES (106); -INSERT INTO t2 VALUES (107); -INSERT INTO t2 VALUES (108); -INSERT INTO t2 VALUES (109); -INSERT INTO t2 VALUES (110); -INSERT INTO t2 VALUES (111); -INSERT INTO t2 VALUES (112); -INSERT INTO t2 VALUES (113); -INSERT INTO t2 VALUES (114); -INSERT INTO t2 VALUES (115); -INSERT INTO t2 VALUES (116); -INSERT INTO t2 VALUES (117); -INSERT INTO t2 VALUES (118); -INSERT INTO t2 VALUES (119); -INSERT INTO t2 VALUES (120); -INSERT INTO t2 VALUES (121); -INSERT INTO t2 VALUES (122); -INSERT INTO t2 VALUES (123); -INSERT INTO t2 VALUES (124); -INSERT INTO t2 VALUES (125); -INSERT INTO t2 VALUES (126); -INSERT INTO t2 VALUES (127); -INSERT INTO t2 VALUES (128); -INSERT INTO t2 VALUES (129); -INSERT INTO t2 VALUES (130); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -# The partial event group (a=106) should be rolled back and thus missing. -SELECT * FROM t2 WHERE a >= 100 ORDER BY a; - -# Cleanup ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t2; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_domain.inc b/mysql-test/suite/rpl/include/rpl_parallel_domain.inc deleted file mode 100644 index eda08cc2916..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_domain.inc +++ /dev/null @@ -1,87 +0,0 @@ -# Test should work with both conservative and optimistic modes - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---error ER_SLAVE_MUST_STOP -SET GLOBAL slave_parallel_threads=10; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; - -# Check that we do not spawn any worker threads when no slave is running. -SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; - -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - -# Check that worker threads get spawned when slave starts. -SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; -# ... and that worker threads get removed when slave stops. ---source include/stop_slave.inc -SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; ---source include/start_slave.inc -SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; - ---echo *** Test long-running query in domain 1 can run in parallel with short queries in domain 0 *** - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); ---save_master_pos - ---connection server_2 ---sync_with_master - -# Block the table t1 to simulate a replicated query taking a long time. ---connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -LOCK TABLE t1 WRITE; - ---connection server_1 -SET gtid_domain_id=1; -# This query will be blocked on the slave until UNLOCK TABLES. -INSERT INTO t1 VALUES (2); -SET gtid_domain_id=0; -# These t2 queries can be replicated in parallel with the prior t1 query, as -# they are in a separate replication domain. -INSERT INTO t2 VALUES (2); -INSERT INTO t2 VALUES (3); -BEGIN; -INSERT INTO t2 VALUES (4); -INSERT INTO t2 VALUES (5); -COMMIT; -INSERT INTO t2 VALUES (6); - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 6 FROM t2 ---source include/wait_condition.inc - -SELECT * FROM t2 ORDER by a; - ---connection con_temp1 -SELECT * FROM t1; -UNLOCK TABLES; - ---connection server_2 ---let $wait_condition= SELECT COUNT(*) = 2 FROM t1 ---source include/wait_condition.inc - -SELECT * FROM t1 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t1,t2; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc b/mysql-test/suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc deleted file mode 100644 index 856efd065df..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_domain_slave_single_grp.inc +++ /dev/null @@ -1,128 +0,0 @@ -# Test is independent of slave_parallel_mode ---echo *** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - -SET @old_format= @@SESSION.binlog_format; -SET binlog_format='statement'; -SET gtid_domain_id=1; -INSERT INTO t2 VALUES (foo(10, - 'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', - 'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); - ---connection server_2 -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; -SET @old_format=@@GLOBAL.binlog_format; -SET GLOBAL binlog_format=statement; -# We need to restart all parallel threads for the new global setting to -# be copied to the session-level values. -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - -# First make sure the first insert is ready to commit, but not queued yet. -SET debug_sync='now WAIT_FOR ready1'; - ---connection server_1 -SET gtid_domain_id=2; -INSERT INTO t2 VALUES (foo(11, - 'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', - 'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); -SET gtid_domain_id=0; -SELECT * FROM t2 WHERE a >= 10 ORDER BY a; - ---connection server_2 -# Now wait for the second insert to queue itself as the leader, and then -# wait for more commits to queue up. -SET debug_sync='now WAIT_FOR ready3'; -SET debug_sync='now SIGNAL cont3'; -SET debug_sync='now WAIT_FOR ready4'; -# Now allow the first insert to queue up to participate in group commit. -SET debug_sync='now SIGNAL cont1'; -SET debug_sync='now WAIT_FOR ready2'; -# Finally allow the second insert to proceed and do the group commit. -SET debug_sync='now SIGNAL cont4'; - ---let $wait_condition= SELECT COUNT(*) = 2 FROM t2 WHERE a >= 10 ---source include/wait_condition.inc -SELECT * FROM t2 WHERE a >= 10 ORDER BY a; -# The two INSERT transactions should have been committed in opposite order, -# but in the same group commit (seen by precense of cid=# in the SHOW -# BINLOG output). ---let $binlog_file= slave-bin.000002 ---source include/show_binlog_events.inc -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc - - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; -SET GLOBAL binlog_format=@old_format; - ---connection server_1 -DROP function foo; -DROP TABLE t1,t2; -SET DEBUG_SYNC= 'RESET'; -SET GLOBAL binlog_format=@old_format; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_free_deferred_event.inc b/mysql-test/suite/rpl/include/rpl_parallel_free_deferred_event.inc deleted file mode 100644 index 41f372eddf8..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_free_deferred_event.inc +++ /dev/null @@ -1,67 +0,0 @@ ---echo *** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication *** - ---source include/have_innodb.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -# Use just two worker threads, so we are sure to get the rpl_group_info added -# to the free list, which is what triggered the bug. ---source include/stop_slave.inc -SET GLOBAL replicate_ignore_table="test.t3"; -SET GLOBAL slave_parallel_threads=2; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t3 VALUES (100, rand()); -INSERT INTO t3 VALUES (101, rand()); ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -INSERT INTO t3 VALUES (102, rand()); -INSERT INTO t3 VALUES (103, rand()); -INSERT INTO t3 VALUES (104, rand()); -INSERT INTO t3 VALUES (105, rand()); ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET GLOBAL replicate_ignore_table=""; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t3 VALUES (106, rand()); -INSERT INTO t3 VALUES (107, rand()); ---save_master_pos - ---connection server_2 ---sync_with_master ---replace_column 2 # -SELECT * FROM t3 WHERE a >= 100 ORDER BY a; - - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t3; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc deleted file mode 100644 index d918b2ea692..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc +++ /dev/null @@ -1,366 +0,0 @@ ---echo *** Test killing thread that is waiting to start transaction until previous transaction commits *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET sql_log_bin=0; -CALL mtr.add_suppression("Query execution was interrupted"); -CALL mtr.add_suppression("Slave: Connection was killed"); -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); -SET sql_log_bin=1; -SET GLOBAL slave_parallel_threads=10; -SET GLOBAL slave_parallel_mode= 'conservative'; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; -# We need to restart all parallel threads for the new global setting to -# be copied to the session-level values. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=4; ---source include/start_slave.inc - - -# We set up four transactions T1, T2, T3, and T4 on the master. T2, T3, and T4 -# can run in parallel with each other (same group commit and commit id), -# but not in parallel with T1. -# -# We use four worker threads, each Ti will be queued on each their own -# worker thread. We will delay T1 commit, T3 will wait for T1 to begin -# commit before it can start. We will kill T3 during this wait, and -# check that everything works correctly. -# -# It is rather tricky to get the correct thread id of the worker to kill. -# We start by injecting four dummy transactions in a debug_sync-controlled -# manner to be able to get known thread ids for the workers in a pool with -# just 4 worker threads. Then we let in each of the real test transactions -# T1-T4 one at a time in a way which allows us to know which transaction -# ends up with which thread id. - ---connection server_1 -SET gtid_domain_id=2; -BEGIN; -# This debug_sync will linger on and be used to control T4 later. -INSERT INTO t3 VALUES (70, foo(70, - 'rpl_parallel_start_waiting_for_prior SIGNAL t4_waiting', '')); -INSERT INTO t3 VALUES (60, foo(60, - 'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2', - 'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d2_query'; ---let $d2_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(60%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=1; -BEGIN; -# These debug_sync's will linger on and be used to control T3 later. -INSERT INTO t3 VALUES (61, foo(61, - 'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting', - 'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed')); -INSERT INTO t3 VALUES (62, foo(62, - 'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2', - 'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d1_query'; ---let $d1_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(62%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=0; -INSERT INTO t3 VALUES (63, foo(63, - 'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2', - 'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont')); - ---connection server_2 -SET debug_sync='now WAIT_FOR d0_query'; ---let $d0_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(63%' AND INFO NOT LIKE '%LIKE%'` - ---connection server_1 -SET gtid_domain_id=3; -BEGIN; -# These debug_sync's will linger on and be used to control T2 later. -INSERT INTO t3 VALUES (68, foo(68, - 'rpl_parallel_start_waiting_for_prior SIGNAL t2_waiting', '')); -INSERT INTO t3 VALUES (69, foo(69, - 'ha_write_row_end SIGNAL d3_query WAIT_FOR d3_cont2', - 'rpl_parallel_end_of_group SIGNAL d3_done WAIT_FOR d3_cont')); -COMMIT; -SET gtid_domain_id=0; - ---connection server_2 -SET debug_sync='now WAIT_FOR d3_query'; ---let $d3_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(69%' AND INFO NOT LIKE '%LIKE%'` - -SET debug_sync='now SIGNAL d2_cont2'; -SET debug_sync='now WAIT_FOR d2_done'; -SET debug_sync='now SIGNAL d1_cont2'; -SET debug_sync='now WAIT_FOR d1_done'; -SET debug_sync='now SIGNAL d0_cont2'; -SET debug_sync='now WAIT_FOR d0_done'; -SET debug_sync='now SIGNAL d3_cont2'; -SET debug_sync='now WAIT_FOR d3_done'; - -# Now prepare the real transactions T1, T2, T3, T4 on the master. - ---connection con_temp3 -# Create transaction T1. -INSERT INTO t3 VALUES (64, foo(64, - 'rpl_parallel_before_mark_start_commit SIGNAL t1_waiting WAIT_FOR t1_cont', '')); - -# Create transaction T2, as a group commit leader on the master. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2'; -send INSERT INTO t3 VALUES (65, foo(65, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp4 -# Create transaction T3, participating in T2's group commit. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (66, foo(66, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; - ---connection con_temp5 -# Create transaction T4, participating in group commit with T2 and T3. -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4'; -send INSERT INTO t3 VALUES (67, foo(67, '', '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued4'; -SET debug_sync='now SIGNAL master_cont2'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 60 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Now we have the four transactions pending for replication on the slave. -# Let them be queued for our three worker threads in a controlled fashion. -# We put them at a stage where T1 is delayed and T3 is waiting for T1 to -# commit before T3 can start. Then we kill T3. - -# Make the worker D0 free, and wait for T1 to be queued in it. -SET debug_sync='now SIGNAL d0_cont'; -SET debug_sync='now WAIT_FOR t1_waiting'; - -# Make the worker D3 free, and wait for T2 to be queued in it. -SET debug_sync='now SIGNAL d3_cont'; -SET debug_sync='now WAIT_FOR t2_waiting'; - -# Now release worker D1, and wait for T3 to be queued in it. -# T3 will wait for T1 to commit before it can start. -SET debug_sync='now SIGNAL d1_cont'; -SET debug_sync='now WAIT_FOR t3_waiting'; - -# Release worker D2. Wait for T4 to be queued, so we are sure it has -# received the debug_sync signal (else we might overwrite it with the -# next debug_sync). -SET debug_sync='now SIGNAL d2_cont'; -SET debug_sync='now WAIT_FOR t4_waiting'; - -# Now we kill the waiting transaction T3 in worker D1. ---replace_result $d1_thd_id THD_ID -eval KILL $d1_thd_id; - -# Wait until T3 has reacted on the kill. -SET debug_sync='now WAIT_FOR t3_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; -# Since T2, T3, and T4 run in parallel, we can not be sure if T2 will have time -# to commit or not before the stop. However, T1 should commit, and T3/T4 may -# not have committed. (After slave restart we check that all become committed -# eventually). -SELECT * FROM t3 WHERE a >= 60 AND a != 65 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -UPDATE t3 SET b=b+1 WHERE a=60; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 60 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - ---echo *** 5. Test killing thread that is waiting for queue of max length to shorten *** - -# Find the thread id of the driver SQL thread that we want to kill. ---let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' ---source include/wait_condition.inc ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` -SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; -SET GLOBAL slave_parallel_max_queued=9000; - ---connection server_1 ---let bigstring= `SELECT REPEAT('x', 10000)` -# Create an event that will wait to be signalled. -INSERT INTO t3 VALUES (80, foo(0, - 'ha_write_row_end SIGNAL query_waiting WAIT_FOR query_cont', '')); - ---connection server_2 -SET debug_sync='now WAIT_FOR query_waiting'; -# Inject that the SQL driver thread will signal `wait_queue_ready' to debug_sync -# as it goes to wait for the event queue to become smaller than the value of -# @@slave_parallel_max_queued. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,rpl_parallel_wait_queue_max"; - ---connection server_1 ---disable_query_log -# Create an event that will fill up the queue. -# The Xid event at the end of the event group will have to wait for the Query -# event with the INSERT to drain so the queue becomes shorter. However that in -# turn waits for the prior event group to continue. -eval INSERT INTO t3 VALUES (81, LENGTH('$bigstring')); ---enable_query_log -SELECT * FROM t3 WHERE a >= 80 ORDER BY a; - ---connection server_2 -SET debug_sync='now WAIT_FOR wait_queue_ready'; - ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -SET debug_sync='now WAIT_FOR wait_queue_killed'; -SET debug_sync='now SIGNAL query_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; - -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_max_queued= @old_max_queued; - ---connection server_1 -INSERT INTO t3 VALUES (82,0); ---save_master_pos - ---connection server_2 -SET debug_sync='RESET'; ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 80 ORDER BY a; - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP function foo; -DROP TABLE t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc b/mysql-test/suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc deleted file mode 100644 index da1a07d3b87..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_gtid_slave_pos_update_fail.inc +++ /dev/null @@ -1,98 +0,0 @@ -# MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried. - -# The problem was that when a transaction updates the mysql.gtid_slave_pos -# table, it clears the flag that marks that there is a GTID position that -# needs to be updated. Then, if the transaction got killed after that due -# to a deadlock, the subsequent retry would fail to notice that the GTID needs -# to be recorded in gtid_slave_pos. -# -# (In the original bug report, the symptom was an assertion; this was however -# just a side effect of the missing update of gtid_slave_pos, which also -# happened to cause a missing clear of OPTION_GTID_BEGIN). ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc -# Must use statement-based binlogging. Otherwise the transaction will not be -# binlogged at all, as it modifies no rows. ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - -# Create two transactions that can run in parallel on the slave but cause -# a deadlock if the second runs before the first. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 1; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos ---let $last_gtid= `SELECT @@last_gtid` - ---connection server_2 -# Disable the usual skip of gap locks for transactions that are run in -# parallel, using DBUG. This allows the deadlock to occur, and this in turn -# triggers a retry of the second transaction, and the code that was buggy and -# caused the gtid_slave_pos update to be skipped in the retry. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with"; ---source include/start_slave.inc ---sync_with_master -SET GLOBAL debug_dbug=@old_dbug; - -SELECT * FROM t4 ORDER BY a; -# Check that the GTID of the second transaction was correctly recorded in -# gtid_slave_pos, in the variable as well as in the table. ---replace_result $last_gtid GTID -eval SET @last_gtid= '$last_gtid'; -SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok", - CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos)) - AS result; -SELECT "ROW FOUND" AS `Is the row found?` - FROM mysql.gtid_slave_pos - WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t4; -SET DEBUG_SYNC= 'RESET'; ---disconnect con1 ---disconnect con2 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc b/mysql-test/suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc deleted file mode 100644 index 2fab9f8032b..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_ignore_error_on_rotate.inc +++ /dev/null @@ -1,96 +0,0 @@ ---echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 *** - ---source include/have_innodb.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET GLOBAL slave_parallel_threads=1; -CHANGE MASTER TO master_use_gtid=slave_pos; -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -SET gtid_domain_id=1; -INSERT INTO t2 VALUES (1); -SET gtid_domain_id=0; -SET gtid_domain_id=2; -INSERT INTO t2 VALUES (2); -SET gtid_domain_id=0; -INSERT INTO t2 VALUES (31); ---let $gtid1= `SELECT @@LAST_GTID` ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads= 0; ---source include/start_slave.inc - -# Force a duplicate key error on the slave. -SET sql_log_bin= 0; -INSERT INTO t2 VALUES (32); -SET sql_log_bin= 1; - ---connection server_1 -INSERT INTO t2 VALUES (32); ---let $gtid2= `SELECT @@LAST_GTID` -# Rotate the binlog; the bug is triggered when the master binlog file changes -# after the event group that causes the duplicate key error. -FLUSH LOGS; -INSERT INTO t2 VALUES (33); -INSERT INTO t2 VALUES (34); -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - ---connection server_2 ---source include/stop_slave_io.inc -SET GLOBAL slave_parallel_threads=10; -START SLAVE; - ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - -# Note: IO thread is still running at this point. -# The bug seems to have been that restarting the SQL thread after an error with -# the IO thread still running, somehow picks up a later relay log position and -# thus ends up skipping the failing event, rather than re-executing. - -START SLAVE SQL_THREAD; ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc - -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; - -# Skip the duplicate error, so we can proceed. ---error ER_SLAVE_SKIP_NOT_IN_GTID -SET sql_slave_skip_counter= 1; ---source include/stop_slave_io.inc ---disable_query_log -eval SET GLOBAL gtid_slave_pos = REPLACE(@@gtid_slave_pos, "$gtid1", "$gtid2"); ---enable_query_log ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t2 WHERE a >= 30 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t2; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc b/mysql-test/suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc deleted file mode 100644 index 90304937445..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_innodb_lock_conflict.inc +++ /dev/null @@ -1,107 +0,0 @@ ---echo ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET sql_log_bin=0; -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); -SET sql_log_bin=1; -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) - -# Create a group commit with UPDATE and DELETE, in that order. -# The bug was that while the UPDATE's row lock does not block the DELETE, the -# DELETE's gap lock _does_ block the UPDATE. This could cause a deadlock -# on the slave. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master ---source include/stop_slave.inc - -SELECT * FROM t4 ORDER BY a; - - -# Another example, this one with INSERT vs. DELETE ---connection server_1 -DELETE FROM t4; -INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); - -# Create a group commit with INSERT and DELETE, in that order. -# The bug was that while the INSERT's insert intention lock does not block -# the DELETE, the DELETE's gap lock _does_ block the INSERT. This could cause -# a deadlock on the slave. ---connection con1 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t4 VALUES (7, NULL); ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master ---source include/stop_slave.inc - -SELECT * FROM t4 ORDER BY a; - - -# Clean up. ---connection server_2 -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 ---disconnect con1 ---disconnect con2 -DROP TABLE t4; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_missed_error_handling.inc b/mysql-test/suite/rpl/include/rpl_parallel_missed_error_handling.inc deleted file mode 100644 index 33b1bcb11d9..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_missed_error_handling.inc +++ /dev/null @@ -1,87 +0,0 @@ ---echo *** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -INSERT INTO t3 VALUES (110, 1); ---save_master_pos - ---connection server_2 ---sync_with_master -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; -# Inject a duplicate key error. -SET sql_log_bin=0; -INSERT INTO t3 VALUES (111, 666); -SET sql_log_bin=1; - ---connection server_1 - -# Create a group commit with two inserts, the first one conflicts with a row on the slave ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (111, 2); ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send INSERT INTO t3 VALUES (112, 3); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; ---connection con2 -REAP; -SET debug_sync='RESET'; ---save_master_pos - ---connection server_2 ---let $slave_sql_errno= 1062 ---source include/wait_for_slave_sql_error.inc ---source include/wait_for_slave_sql_to_stop.inc -# We should not see the row (112,3) here, it should be rolled back due to -# error signal from the prior transaction. -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; -SET sql_log_bin=0; -DELETE FROM t3 WHERE a=111 AND b=666; -SET sql_log_bin=1; -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 110 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 ---disconnect con1 ---disconnect con2 -DROP TABLE t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_mode.inc b/mysql-test/suite/rpl/include/rpl_parallel_mode.inc deleted file mode 100644 index 67104069e9a..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_mode.inc +++ /dev/null @@ -1,87 +0,0 @@ ---echo *** MDEV-6676 - test syntax of @@slave_parallel_mode *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode='aggressive'; ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc -SET GLOBAL slave_parallel_mode='conservative'; ---let $status_items= Parallel_Mode ---source include/show_slave_status.inc - ---echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel *** ---connection server_1 -INSERT INTO t2 VALUES (1040); ---source include/save_master_gtid.inc - ---connection server_2 -SET GLOBAL slave_parallel_mode='none'; -# Test that we do not use parallel apply, by injecting an unconditional -# crash in the parallel apply code. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply"; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; - - ---echo *** MDEV-6676 - test disabling domain-based parallel replication *** ---connection server_1 -# Let's do a bunch of transactions that will conflict if run out-of-order in -# domain-based parallel replication mode. -SET gtid_domain_id = 1; -INSERT INTO t2 VALUES (1041); -INSERT INTO t2 VALUES (1042); -INSERT INTO t2 VALUES (1043); -INSERT INTO t2 VALUES (1044); -INSERT INTO t2 VALUES (1045); -INSERT INTO t2 VALUES (1046); -DELETE FROM t2 WHERE a >= 1041; -SET gtid_domain_id = 2; -INSERT INTO t2 VALUES (1041); -INSERT INTO t2 VALUES (1042); -INSERT INTO t2 VALUES (1043); -INSERT INTO t2 VALUES (1044); -INSERT INTO t2 VALUES (1045); -INSERT INTO t2 VALUES (1046); -SET gtid_domain_id = 0; ---source include/save_master_gtid.inc ---connection server_2 -SET GLOBAL slave_parallel_mode=minimal; ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; - -# Cleanup ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t2; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_partial_binlog_trans.inc b/mysql-test/suite/rpl/include/rpl_parallel_partial_binlog_trans.inc deleted file mode 100644 index 7247925285f..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_partial_binlog_trans.inc +++ /dev/null @@ -1,71 +0,0 @@ ---echo *** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=1; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t6 (a INT) ENGINE=MyISAM; -CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1; ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) - ---connection con1 ---let $conid = `SELECT CONNECTION_ID()` -SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont'; -send INSERT INTO t6 VALUES (1), (2), (3); - ---connection server_1 -SET debug_sync='now WAIT_FOR ready'; ---replace_result $conid CONID -eval KILL QUERY $conid; -SET debug_sync='now SIGNAL cont'; - ---connection con1 ---error ER_QUERY_INTERRUPTED ---reap -SET debug_sync='RESET'; ---let $after_error_gtid_pos= `SELECT @@gtid_binlog_pos` - ---connection server_1 -SET debug_sync='RESET'; - ---connection server_2 ---let $slave_sql_errno= 1317 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; ---replace_result $after_error_gtid_pos AFTER_ERROR_GTID_POS -eval SET GLOBAL gtid_slave_pos= '$after_error_gtid_pos'; ---source include/start_slave.inc - ---connection server_1 -INSERT INTO t6 VALUES (4); -SELECT * FROM t6 ORDER BY a; ---save_master_pos - ---connection server_2 ---sync_with_master -SELECT * FROM t6 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t6; -SET DEBUG_SYNC= 'RESET'; ---disconnect con1 - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc b/mysql-test/suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc deleted file mode 100644 index 0f94d8f9943..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_record_gtid_wakeup.inc +++ /dev/null @@ -1,72 +0,0 @@ ---echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; - ---connection server_1 -# Inject two group commits. The bug was that record_gtid for a -# non-transactional event group would commit its own transaction, which would -# cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This -# in turn lead to access to freed group_commit_orderer object, losing a wakeup -# and causing slave threads to hang. -# We inject a small sleep in the corresponding record_gtid() to make the race -# easier to hit. - -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -# Group commit with cid=10010, two event groups. -SET @old_server_id= @@SESSION.server_id; -SET SESSION server_id= 100; -SET @commit_id= 10010; -ALTER TABLE t1 COMMENT "Hulubulu!"; -SET SESSION server_id= @old_server_id; -INSERT INTO t3 VALUES (130, 0); - -# Group commit with cid=10011, one event group. -SET @commit_id= 10011; -INSERT INTO t3 VALUES (131, 0); - -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a >= 130 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a >= 130 ORDER BY a; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t1,t3; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_retry_deadlock.inc b/mysql-test/suite/rpl/include/rpl_parallel_retry_deadlock.inc deleted file mode 100644 index 54ac859bb33..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_retry_deadlock.inc +++ /dev/null @@ -1,281 +0,0 @@ ---echo *** MDEV-7326 Server deadlock in connection with parallel replication *** ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -# Test assumes that 'conservative' mode is in effect. i.e -# Do not start parallel execution of this event group until all prior groups -# have reached the commit phase. Refer 'rpl_parallel_start_waiting_for_prior' -# debug simumation. -SET GLOBAL slave_parallel_mode='conservative'; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t6 (a INT) ENGINE=MyISAM; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - -# We use three transactions, each in a separate group commit. -# T1 does mark_start_commit(), then gets a deadlock error. -# T2 wakes up and starts running -# T1 does unmark_start_commit() -# T3 goes to wait for T2 to start its commit -# T2 does mark_start_commit() -# The bug was that at this point, T3 got deadlocked. Because T1 has unmarked(), -# T3 did not yet see the count_committing_event_groups reach its target value -# yet. But when T1 later re-did mark_start_commit(), it failed to send a wakeup -# to T3. - ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=3; -SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; ---source include/start_slave.inc - ---connection server_1 -SET @old_format= @@SESSION.binlog_format; -SET binlog_format= STATEMENT; -# This debug_sync will linger on and be used to control T3 later. -INSERT INTO t1 VALUES (foo(50, - "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", - "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); ---save_master_pos ---connection server_2 -# Wait for the debug_sync point for T3 to be set. But let the preparation -# transaction remain hanging, so that T1 and T2 will be scheduled for the -# remaining two worker threads. -SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; - ---connection server_1 -INSERT INTO t2 VALUES (foo(50, - "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", - "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); ---save_master_pos - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; -# T1 has now done mark_start_commit(). It will later do a rollback and retry. - ---connection server_1 -# Use a MyISAM table for T2 and T3, so they do not trigger the -# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. -INSERT INTO t1 VALUES (foo(51, - "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", - "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; -# T2 has now started running, but has not yet done mark_start_commit() -SET DEBUG_SYNC= "now SIGNAL t1_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; -# T1 has now done unmark_start_commit() in preparation for its retry. - ---connection server_1 -INSERT INTO t1 VALUES (52); -SET BINLOG_FORMAT= @old_format; -SELECT * FROM t2 WHERE a>=50 ORDER BY a; -SELECT * FROM t1 WHERE a>=50 ORDER BY a; - ---connection server_2 -# Let the preparation transaction complete, so that the same worker thread -# can continue with the transaction T3. -SET DEBUG_SYNC= "now SIGNAL prep_cont"; -SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; -# T3 has now gone to wait for T2 to start committing -SET DEBUG_SYNC= "now SIGNAL t2_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; -# T2 has now done mark_start_commit(). -# Let things run, and check that T3 does not get deadlocked. -SET DEBUG_SYNC= "now SIGNAL t1_cont2"; ---sync_with_master - ---connection server_1 ---save_master_pos ---connection server_2 ---sync_with_master -SELECT * FROM t2 WHERE a>=50 ORDER BY a; -SELECT * FROM t1 WHERE a>=50 ORDER BY a; -SET DEBUG_SYNC="reset"; - -# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** MDEV-7326 Server deadlock in connection with parallel replication *** -# Similar to the previous test, but with T2 and T3 in the same GCO. -# We use three transactions, T1 in one group commit and T2/T3 in another. -# T1 does mark_start_commit(), then gets a deadlock error. -# T2 wakes up and starts running -# T1 does unmark_start_commit() -# T3 goes to wait for T1 to start its commit -# T2 does mark_start_commit() -# The bug was that at this point, T3 got deadlocked. T2 increments the -# count_committing_event_groups but does not signal T3, as they are in -# the same GCO. Then later when T1 increments, it would also not signal -# T3, because now the count_committing_event_groups is not equal to the -# wait_count of T3 (it is one larger). - ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; -SET GLOBAL slave_parallel_mode='conservative'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=3; -SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; ---source include/start_slave.inc - ---connection server_1 -SET @old_format= @@SESSION.binlog_format; -SET binlog_format= STATEMENT; -# This debug_sync will linger on and be used to control T3 later. -INSERT INTO t1 VALUES (foo(60, - "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", - "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); ---save_master_pos ---connection server_2 -# Wait for the debug_sync point for T3 to be set. But let the preparation -# transaction remain hanging, so that T1 and T2 will be scheduled for the -# remaining two worker threads. -SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; - ---connection server_1 -INSERT INTO t2 VALUES (foo(60, - "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", - "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); ---save_master_pos - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; -# T1 has now done mark_start_commit(). It will later do a rollback and retry. - -# Do T2 and T3 in a single group commit. -# Use a MyISAM table for T2 and T3, so they do not trigger the -# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t1 VALUES (foo(61, - "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", - "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send INSERT INTO t6 VALUES (62); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; - ---connection server_1 -SET debug_sync='RESET'; -SET BINLOG_FORMAT= @old_format; -SELECT * FROM t2 WHERE a>=60 ORDER BY a; -SELECT * FROM t1 WHERE a>=60 ORDER BY a; -SELECT * FROM t6 WHERE a>=60 ORDER BY a; - ---connection server_2 -SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; -# T2 has now started running, but has not yet done mark_start_commit() -SET DEBUG_SYNC= "now SIGNAL t1_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; -# T1 has now done unmark_start_commit() in preparation for its retry. - ---connection server_2 -# Let the preparation transaction complete, so that the same worker thread -# can continue with the transaction T3. -SET DEBUG_SYNC= "now SIGNAL prep_cont"; -SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; -# T3 has now gone to wait for T2 to start committing -SET DEBUG_SYNC= "now SIGNAL t2_cont1"; -SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; -# T2 has now done mark_start_commit(). -# Let things run, and check that T3 does not get deadlocked. -SET DEBUG_SYNC= "now SIGNAL t1_cont2"; ---sync_with_master - ---connection server_1 ---save_master_pos ---connection server_2 ---sync_with_master -SELECT * FROM t2 WHERE a>=60 ORDER BY a; -SELECT * FROM t1 WHERE a>=60 ORDER BY a; -SELECT * FROM t6 WHERE a>=60 ORDER BY a; -SET DEBUG_SYNC="reset"; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP function foo; -DROP TABLE t1,t2,t6; ---disconnect con_temp3 ---disconnect con_temp4 -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_rollback_assert.inc b/mysql-test/suite/rpl/include/rpl_parallel_rollback_assert.inc deleted file mode 100644 index eec331b3d64..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_rollback_assert.inc +++ /dev/null @@ -1,62 +0,0 @@ ---echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** ---source include/have_innodb.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB -# in a transaction. The bug was an assertion on the ROLLBACK due to -# mark_start_commit() being already called. ---disable_warnings -BEGIN; -INSERT INTO t2 VALUES (2000); -INSERT INTO t1 VALUES (2000); -INSERT INTO t2 VALUES (2001); -ROLLBACK; ---enable_warnings -SELECT * FROM t1 WHERE a>=2000 ORDER BY a; -SELECT * FROM t2 WHERE a>=2000 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc - ---connection server_1 -INSERT INTO t2 VALUES (2020); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc -SELECT * FROM t2 WHERE a>=2000 ORDER BY a; -let $rows_in_t1= `SELECT COUNT(*) FROM t1 WHERE a>=2000 ORDER BY a`; -if ($rows_in_t1 == 0) -{ ---query_vertical SHOW SLAVE STATUS -} -SELECT * FROM t1 WHERE a>=2000 ORDER BY a; - -# Clean up. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t1,t2; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_single_grpcmt.inc b/mysql-test/suite/rpl/include/rpl_parallel_single_grpcmt.inc deleted file mode 100644 index cf4c547b73b..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_single_grpcmt.inc +++ /dev/null @@ -1,170 +0,0 @@ ---echo *** Test that group-committed transactions on the master can replicate in parallel on the slave. *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_1 -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 ---source include/stop_slave.inc -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - -# We need to restart all parallel threads for the new global setting to -# be copied to the session-level values. -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -# Create some sentinel rows so that the rows inserted in parallel fall into -# separate gaps and do not cause gap lock conflicts. -INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7); ---save_master_pos ---connection server_2 ---sync_with_master - - -# We want to test that the transactions can execute out-of-order on -# the slave, but still end up committing in-order, and in a single -# group commit. -# -# The idea is to group-commit three transactions together on the master: -# A, B, and C. On the slave, C will execute the insert first, then A, -# and then B. But B manages to complete before A has time to commit, so -# all three end up committing together. -# -# So we start by setting up some row locks that will block transactions -# A and B from executing, allowing C to run first. - ---connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -BEGIN; -INSERT INTO t3 VALUES (2,102); ---connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) -BEGIN; -INSERT INTO t3 VALUES (4,104); - -# On the master, queue three INSERT transactions as a single group commit. ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (2, foo(12, - 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (4, foo(14, - 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -SET binlog_format=statement; -send INSERT INTO t3 VALUES (6, foo(16, - 'group_commit_waiting_for_prior SIGNAL slave_queued3', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; -SET debug_sync='RESET'; - ---connection server_1 -SELECT * FROM t3 ORDER BY a; ---let $binlog_file= master-bin.000001 ---source include/show_binlog_events.inc - -# First, wait until insert 3 is ready to queue up for group commit, but is -# waiting for insert 2 to commit before it can do so itself. ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued3'; - -# Next, let insert 1 proceed, and allow it to queue up as the group commit -# leader, but let it wait for insert 2 to also queue up before proceeding. ---connection con_temp1 -ROLLBACK; ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued1'; - -# Now let insert 2 proceed and queue up. ---connection con_temp2 -ROLLBACK; ---connection server_2 -SET debug_sync='now WAIT_FOR slave_queued2'; -# And finally, we can let insert 1 proceed and do the group commit with all -# three insert transactions together. -SET debug_sync='now SIGNAL slave_cont1'; - -# Wait for the commit to complete and check that all three transactions -# group-committed together (will be seen in the binlog as all three having -# cid=# on their GTID event). ---let $wait_condition= SELECT COUNT(*) = 3 FROM t3 WHERE a IN (2,4,6) ---source include/wait_condition.inc -SELECT * FROM t3 ORDER BY a; ---let $binlog_file= slave-bin.000001 ---source include/show_binlog_events.inc - - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP function foo; -DROP TABLE t3; -SET DEBUG_SYNC= 'RESET'; - ---disable_connect_log ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc deleted file mode 100644 index a78dbad052f..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc +++ /dev/null @@ -1,454 +0,0 @@ ---echo *** Test killing slave threads at various wait points *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - -# Test various aspects of parallel replication. - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -SET GLOBAL slave_parallel_mode='conservative'; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 ---connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master - ---connection server_1 -# Use a stored function to inject a debug_sync into the appropriate THD. -# The function does nothing on the master, and on the slave it injects the -# desired debug_sync action(s). -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_2 -SET sql_log_bin=0; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---echo *** 1. Test killing transaction waiting in commit for previous transaction to commit *** - -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (31, foo(31, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (32, foo(32, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (33, foo(33, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (34, foo(34, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -SET sql_log_bin=0; -CALL mtr.add_suppression("Query execution was interrupted"); -CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); -CALL mtr.add_suppression("Slave: Connection was killed"); -SET sql_log_bin=1; -# Wait until T2 is inside executing its insert of 32, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(32%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -STOP SLAVE IO_THREAD; -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (39,0); ---save_master_pos - ---connection server_2 ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t3 WHERE a >= 30 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** 2. Same as (1), but without restarting IO thread after kill of SQL threads *** - -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (41, foo(41, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (42, foo(42, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (43, foo(43, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (44, foo(44, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 40 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Wait until T2 is inside executing its insert of 42, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(42%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (49,0); ---save_master_pos - ---connection server_2 -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 40 ORDER BY a; -# Restore the foo() function. -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - IF d1 != '' THEN - SET debug_sync = d1; - END IF; - IF d2 != '' THEN - SET debug_sync = d2; - END IF; - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; ---source include/start_slave.inc - - ---echo *** 3. Same as (2), but not using gtid mode *** - ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=no; ---source include/start_slave.inc - ---connection server_1 -# Set up three transactions on the master that will be group-committed -# together so they can be replicated in parallel on the slave. ---connection con_temp3 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send INSERT INTO t3 VALUES (51, foo(51, - 'commit_before_prepare_ordered WAIT_FOR t2_waiting', - 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con_temp4 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -BEGIN; -# This insert is just so we can get T2 to wait while a query is running that we -# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. -INSERT INTO t3 VALUES (52, foo(52, - 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', - '')); -# This insert sets up debug_sync points so that T2 will tell when it is at its -# wait point where we want to kill it - and when it has been killed. -INSERT INTO t3 VALUES (53, foo(53, - 'group_commit_waiting_for_prior SIGNAL t2_waiting', - 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); -send COMMIT; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; - ---connection con_temp5 -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; -send INSERT INTO t3 VALUES (54, foo(54, - '', - '')); - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued3'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con_temp3 -REAP; ---connection con_temp4 -REAP; ---connection con_temp5 -REAP; - ---connection server_1 -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; -SET debug_sync='RESET'; - ---connection server_2 -# Wait until T2 is inside executing its insert of 52, then find it in SHOW -# PROCESSLIST to know its thread id for KILL later. -SET debug_sync='now WAIT_FOR t2_query'; ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(52%' AND INFO NOT LIKE '%LIKE%'` -SET debug_sync='now SIGNAL t2_cont'; - -# Wait until T2 has entered its wait for T1 to commit, and T1 has -# progressed into its commit phase. -SET debug_sync='now WAIT_FOR t1_ready'; - -# Now kill the transaction T2. ---replace_result $thd_id THD_ID -eval KILL $thd_id; - -# Wait until T2 has reacted on the kill. -SET debug_sync='now WAIT_FOR t2_killed'; - -# Now we can allow T1 to proceed. -SET debug_sync='now SIGNAL t1_cont'; - ---let $slave_sql_errno= 1317,1927,1964 ---source include/wait_for_slave_sql_error.inc -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; - -# Now we have to disable the debug_sync statements, so they do not trigger -# when the events are retried. -SET debug_sync='RESET'; -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; -SET sql_log_bin=0; -DROP FUNCTION foo; ---delimiter || -CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) - RETURNS INT DETERMINISTIC - BEGIN - RETURN x; - END -|| ---delimiter ; -SET sql_log_bin=1; - ---connection server_1 -INSERT INTO t3 VALUES (59,0); ---save_master_pos - ---connection server_2 -START SLAVE SQL_THREAD; ---sync_with_master -SELECT * FROM t3 WHERE a >= 50 ORDER BY a; - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=slave_pos; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; -SET GLOBAL slave_parallel_mode=@old_parallel_mode; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP function foo; -DROP TABLE t1,t2,t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_stop_on_con_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_stop_on_con_kill.inc deleted file mode 100644 index 63c483ea6ad..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_stop_on_con_kill.inc +++ /dev/null @@ -1,129 +0,0 @@ ---echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; -INSERT INTO t3 VALUES (201,0), (202,0); ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_mdev8031'; - ---connection server_1 -# We artificially create a situation that hopefully resembles the original -# bug which was only seen "in the wild", and only once. -# Setup a fake group commit with lots of conflicts that will lead to deadloc -# kill. The slave DBUG injection causes the slave to be deadlock killed at -# a particular point during the retry, and then later do a small sleep at -# another critical point where the prior transaction then has a chance to -# complete. Finally an extra KILL check catches an unhandled, lingering -# deadlock kill. So rather artificial, but at least it exercises the -# relevant code paths. -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - -SET @commit_id= 10200; -INSERT INTO t3 VALUES (203, 1); -INSERT INTO t3 VALUES (204, 1); -INSERT INTO t3 VALUES (205, 1); -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=201; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=202; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=204; -UPDATE t3 SET b=b+1 WHERE a=203; -UPDATE t3 SET b=b+1 WHERE a=205; -UPDATE t3 SET b=b+1 WHERE a=205; -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_dbug; ---source include/start_slave.inc - - ---echo *** Check getting deadlock killed inside open_binlog() during retry. *** - ---connection server_2 ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; -SET @old_max= @@GLOBAL.max_relay_log_size; -SET GLOBAL max_relay_log_size= 4096; - ---connection server_1 -SET @old_dbug= @@SESSION.debug_dbug; -SET SESSION debug_dbug="+d,binlog_force_commit_id"; - ---let $large= `SELECT REPEAT("*", 8192)` -SET @commit_id= 10210; ---echo Omit long queries that cause relaylog rotations and transaction retries... ---disable_query_log -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; -eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; ---enable_query_log -SET SESSION debug_dbug=@old_dbug; - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; ---source include/save_master_gtid.inc - ---connection server_2 ---source include/start_slave.inc ---source include/sync_with_master_gtid.inc - -SELECT * FROM t3 WHERE a>=200 ORDER BY a; - -# Cleanup ---source include/stop_slave.inc -SET GLOBAL debug_dbug= @old_debg; -SET GLOBAL max_relay_log_size= @old_max; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t3; - ---source include/rpl_end.inc - diff --git a/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc b/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc deleted file mode 100644 index 4eeddc927e0..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc +++ /dev/null @@ -1,114 +0,0 @@ ---echo *** Test STOP SLAVE in parallel mode *** - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -SET GLOBAL slave_parallel_mode='conservative'; - -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc ---connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) ---connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ---save_master_pos - ---connection server_2 ---sync_with_master ---source include/stop_slave.inc - ---connection server_1 -# Set up a couple of transactions. The first will be blocked halfway -# through on a lock, and while it is blocked we initiate STOP SLAVE. -# We then test that the halfway-initiated transaction is allowed to -# complete, but no subsequent ones. -# We have to use statement-based mode and set -# binlog_direct_non_transactional_updates=0; otherwise the binlog will -# be split into two event groups, one for the MyISAM part and one for the -# InnoDB part. -SET binlog_direct_non_transactional_updates=0; -SET sql_log_bin=0; -CALL mtr.add_suppression("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"); -SET sql_log_bin=1; -BEGIN; -INSERT INTO t2 VALUES (20); ---disable_warnings -INSERT INTO t1 VALUES (20); ---enable_warnings -INSERT INTO t2 VALUES (21); -INSERT INTO t3 VALUES (20, 20); -COMMIT; -INSERT INTO t3 VALUES(21, 21); -INSERT INTO t3 VALUES(22, 22); ---save_master_pos - -# Start a connection that will block the replicated transaction halfway. ---connection con_temp1 -BEGIN; -INSERT INTO t2 VALUES (21); - ---connection server_2 -START SLAVE; -# Wait for the MyISAM change to be visible, after which replication will wait -# for con_temp1 to roll back. ---let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20 ---source include/wait_condition.inc - ---connection con_temp2 -# Initiate slave stop. It will have to wait for the current event group -# to complete. -# The dbug injection causes debug_sync to signal 'wait_for_done_waiting' -# when the SQL driver thread is ready. -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; -send STOP SLAVE; - ---connection con_temp1 -SET debug_sync='now WAIT_FOR wait_for_done_waiting'; -ROLLBACK; - ---connection con_temp2 -reap; -SET GLOBAL debug_dbug=@old_dbug; -SET debug_sync='RESET'; - ---connection server_2 ---source include/wait_for_slave_to_stop.inc -# We should see the first transaction applied, but not the two others. -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT * FROM t2 WHERE a >= 20 ORDER BY a; -SELECT * FROM t3 WHERE a >= 20 ORDER BY a; - ---source include/start_slave.inc ---sync_with_master -SELECT * FROM t1 WHERE a >= 20 ORDER BY a; -SELECT * FROM t2 WHERE a >= 20 ORDER BY a; -SELECT * FROM t3 WHERE a >= 20 ORDER BY a; - ---connection server_2 -# Respawn all worker threads to clear any left-over debug_sync or other stuff. ---source include/stop_slave.inc -SET GLOBAL slave_parallel_mode=@old_parallel_mode; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; ---disconnect con_temp1 ---disconnect con_temp2 - ---connection server_1 -DROP TABLE t1,t2,t3; -SET DEBUG_SYNC= 'RESET'; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_wrong_binlog_order.inc b/mysql-test/suite/rpl/include/rpl_parallel_wrong_binlog_order.inc deleted file mode 100644 index 093693d453e..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_wrong_binlog_order.inc +++ /dev/null @@ -1,91 +0,0 @@ ---echo *** MDEV-6775: Wrong binlog order in parallel replication *** - -# A bit tricky bug to reproduce. On the master, we binlog in statement-mode -# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate -# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, -# is not binlogged. Then we inject a wait in the group commit code on the -# slave, shortly before the actual commit of the UPDATE. The bug was that the -# DELETE could wake up from wait_for_prior_commit() before the commit of the -# UPDATE. So the test could see the slave position updated to after DELETE, -# while the UPDATE was still not visible. - ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/have_debug_sync.inc ---source include/master-slave.inc - ---connection server_2 -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=10; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; -INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); ---connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) ---source include/save_master_gtid.inc - ---connection server_2 ---source include/sync_with_master_gtid.inc ---source include/stop_slave.inc -SET @old_dbug= @@GLOBAL.debug_dbug; -SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; -SET @old_format=@@GLOBAL.binlog_format; -SET GLOBAL binlog_format=ROW; -# Re-spawn the worker threads to be sure they pick up the new binlog format -SET GLOBAL slave_parallel_threads=0; -SET GLOBAL slave_parallel_threads=10; - ---connection con1 -SET @old_format= @@binlog_format; -SET binlog_format= statement; -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; -send UPDATE t4 SET b=NULL WHERE a=6; ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued1'; - ---connection con2 -SET @old_format= @@binlog_format; -SET binlog_format= statement; -SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; -send DELETE FROM t4 WHERE b <= 3; - ---connection server_1 -SET debug_sync='now WAIT_FOR master_queued2'; -SET debug_sync='now SIGNAL master_cont1'; - ---connection con1 -REAP; -SET binlog_format= @old_format; ---connection con2 -REAP; -SET binlog_format= @old_format; -SET debug_sync='RESET'; ---save_master_pos -SELECT * FROM t4 ORDER BY a; - ---connection server_2 ---source include/start_slave.inc -SET debug_sync= 'now WAIT_FOR waiting'; ---sync_with_master -SELECT * FROM t4 ORDER BY a; -SET debug_sync= 'now SIGNAL cont'; - -# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. ---source include/stop_slave.inc -SET GLOBAL debug_dbug=@old_dbug; -SET GLOBAL binlog_format= @old_format; -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc -SET DEBUG_SYNC= 'RESET'; - ---connection server_1 -DROP TABLE t4; -SET DEBUG_SYNC= 'RESET'; ---disconnect con1 ---disconnect con2 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc b/mysql-test/suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc deleted file mode 100644 index 672ade57ca3..00000000000 --- a/mysql-test/suite/rpl/include/rpl_parallel_wrong_exec_master_pos.inc +++ /dev/null @@ -1,56 +0,0 @@ ---echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication *** ---source include/have_innodb.inc ---source include/master-slave.inc - ---connection server_2 ---source include/stop_slave.inc -SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; -SET GLOBAL slave_parallel_threads=1; -CHANGE MASTER TO master_use_gtid=slave_pos; ---source include/start_slave.inc - ---connection server_1 -ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; -CREATE TABLE t5 (a INT PRIMARY KEY, b INT); -INSERT INTO t5 VALUES (1,1); -INSERT INTO t5 VALUES (2,2), (3,8); -INSERT INTO t5 VALUES (4,16); ---save_master_pos - ---connection server_2 ---sync_with_master -let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); -let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); -let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); ---disable_query_log -eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; -eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; ---enable_query_log - ---connection server_1 -FLUSH LOGS; ---source include/wait_for_binlog_checkpoint.inc ---save_master_pos - ---connection server_2 ---sync_with_master -let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); -let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); -let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); -let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); ---disable_query_log -eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; -eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; ---enable_query_log - -# Clean up. ---connection server_2 ---source include/stop_slave.inc -SET GLOBAL slave_parallel_threads=@old_parallel_threads; ---source include/start_slave.inc - ---connection server_1 -DROP TABLE t5; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test b/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test index c1f1b9bac43..62a7501c36b 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_analyze_table_hang.test @@ -1 +1,73 @@ ---source include/rpl_parallel_analyze_table_hang.inc +--echo *** MDEV-7888: ANALYZE TABLE does wakeup_subsequent_commits(), causing wrong binlog order and parallel replication hang *** +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_analyze_table_sleep'; + +--connection server_1 +# Inject two group commits. The bug was that ANALYZE TABLE would call +# wakeup_subsequent_commits() too early, allowing the following transaction +# in the same group to run ahead and binlog and free the GCO. Then we get +# wrong binlog order and later access freed GCO, which causes lost wakeup +# of following GCO and thus replication hang. +# We injected a small sleep in ANALYZE to make the race easier to hit (this +# can only cause false negatives in versions with the bug, not false positives, +# so sleep is ok here. And it's in general not possible to trigger reliably +# the race with debug_sync, since the bugfix makes the race impossible). + +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +# Group commit with cid=10000, two event groups. +SET @commit_id= 10000; +ANALYZE TABLE t2; +INSERT INTO t3 VALUES (120, 0); + +# Group commit with cid=10001, one event group. +SET @commit_id= 10001; +INSERT INTO t3 VALUES (121, 0); + +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a >= 120 ORDER BY a; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t2,t3; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test index 9ee06f59858..592ffd3b068 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_corrupt_binlog.test @@ -1 +1,80 @@ ---source include/rpl_parallel_deadlock_corrupt_binlog.inc +--echo *** MDEV-7335: Potential parallel slave deadlock with specific binlog corruption *** +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=1; +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; +CALL mtr.add_suppression("Unexpected break of being relay-logged GTID"); + +--connection server_1 +INSERT INTO t2 VALUES (101); +INSERT INTO t2 VALUES (102); +INSERT INTO t2 VALUES (103); +INSERT INTO t2 VALUES (104); +INSERT INTO t2 VALUES (105); +# Inject a partial event group (missing XID at the end). The bug was that such +# partial group was not handled appropriately, leading to server deadlock. +SET gtid_seq_no=1000; +INSERT INTO t2 VALUES (106); +INSERT INTO t2 VALUES (107); +INSERT INTO t2 VALUES (108); +INSERT INTO t2 VALUES (109); +INSERT INTO t2 VALUES (110); +INSERT INTO t2 VALUES (111); +INSERT INTO t2 VALUES (112); +INSERT INTO t2 VALUES (113); +INSERT INTO t2 VALUES (114); +INSERT INTO t2 VALUES (115); +INSERT INTO t2 VALUES (116); +INSERT INTO t2 VALUES (117); +INSERT INTO t2 VALUES (118); +INSERT INTO t2 VALUES (119); +INSERT INTO t2 VALUES (120); +INSERT INTO t2 VALUES (121); +INSERT INTO t2 VALUES (122); +INSERT INTO t2 VALUES (123); +INSERT INTO t2 VALUES (124); +INSERT INTO t2 VALUES (125); +INSERT INTO t2 VALUES (126); +INSERT INTO t2 VALUES (127); +INSERT INTO t2 VALUES (128); +INSERT INTO t2 VALUES (129); +INSERT INTO t2 VALUES (130); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +# The partial event group (a=106) should be rolled back and thus missing. +SELECT * FROM t2 WHERE a >= 100 ORDER BY a; + +# Cleanup +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t2; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_domain.test b/mysql-test/suite/rpl/t/rpl_parallel_domain.test index f5864380f02..eda08cc2916 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_domain.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_domain.test @@ -1 +1,87 @@ ---source include/rpl_parallel_domain.inc +# Test should work with both conservative and optimistic modes + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--error ER_SLAVE_MUST_STOP +SET GLOBAL slave_parallel_threads=10; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; + +# Check that we do not spawn any worker threads when no slave is running. +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; + +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +# Check that worker threads get spawned when slave starts. +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +# ... and that worker threads get removed when slave stops. +--source include/stop_slave.inc +SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; +--source include/start_slave.inc +SELECT IF(COUNT(*) >= 10, "OK", CONCAT("Found too few system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user"; + +--echo *** Test long-running query in domain 1 can run in parallel with short queries in domain 0 *** + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +--save_master_pos + +--connection server_2 +--sync_with_master + +# Block the table t1 to simulate a replicated query taking a long time. +--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +LOCK TABLE t1 WRITE; + +--connection server_1 +SET gtid_domain_id=1; +# This query will be blocked on the slave until UNLOCK TABLES. +INSERT INTO t1 VALUES (2); +SET gtid_domain_id=0; +# These t2 queries can be replicated in parallel with the prior t1 query, as +# they are in a separate replication domain. +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +BEGIN; +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +COMMIT; +INSERT INTO t2 VALUES (6); + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 6 FROM t2 +--source include/wait_condition.inc + +SELECT * FROM t2 ORDER by a; + +--connection con_temp1 +SELECT * FROM t1; +UNLOCK TABLES; + +--connection server_2 +--let $wait_condition= SELECT COUNT(*) = 2 FROM t1 +--source include/wait_condition.inc + +SELECT * FROM t1 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1,t2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test b/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test index 5ddd2af323c..856efd065df 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_domain_slave_single_grp.test @@ -1 +1,128 @@ ---source include/rpl_parallel_domain_slave_single_grp.inc +# Test is independent of slave_parallel_mode +--echo *** Test two transactions in different domains committed in opposite order on slave but in a single group commit. *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +SET gtid_domain_id=1; +INSERT INTO t2 VALUES (foo(10, + 'commit_before_enqueue SIGNAL ready1 WAIT_FOR cont1', + 'commit_after_release_LOCK_prepare_ordered SIGNAL ready2')); + +--connection server_2 +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=statement; +# We need to restart all parallel threads for the new global setting to +# be copied to the session-level values. +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +# First make sure the first insert is ready to commit, but not queued yet. +SET debug_sync='now WAIT_FOR ready1'; + +--connection server_1 +SET gtid_domain_id=2; +INSERT INTO t2 VALUES (foo(11, + 'commit_before_enqueue SIGNAL ready3 WAIT_FOR cont3', + 'commit_after_release_LOCK_prepare_ordered SIGNAL ready4 WAIT_FOR cont4')); +SET gtid_domain_id=0; +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; + +--connection server_2 +# Now wait for the second insert to queue itself as the leader, and then +# wait for more commits to queue up. +SET debug_sync='now WAIT_FOR ready3'; +SET debug_sync='now SIGNAL cont3'; +SET debug_sync='now WAIT_FOR ready4'; +# Now allow the first insert to queue up to participate in group commit. +SET debug_sync='now SIGNAL cont1'; +SET debug_sync='now WAIT_FOR ready2'; +# Finally allow the second insert to proceed and do the group commit. +SET debug_sync='now SIGNAL cont4'; + +--let $wait_condition= SELECT COUNT(*) = 2 FROM t2 WHERE a >= 10 +--source include/wait_condition.inc +SELECT * FROM t2 WHERE a >= 10 ORDER BY a; +# The two INSERT transactions should have been committed in opposite order, +# but in the same group commit (seen by precense of cid=# in the SHOW +# BINLOG output). +--let $binlog_file= slave-bin.000002 +--source include/show_binlog_events.inc +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL binlog_format=@old_format; + +--connection server_1 +DROP function foo; +DROP TABLE t1,t2; +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL binlog_format=@old_format; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test b/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test index e2a41d0db7e..41f372eddf8 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_free_deferred_event.test @@ -1 +1,67 @@ ---source include/rpl_parallel_free_deferred_event.inc +--echo *** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication *** + +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +# Use just two worker threads, so we are sure to get the rpl_group_info added +# to the free list, which is what triggered the bug. +--source include/stop_slave.inc +SET GLOBAL replicate_ignore_table="test.t3"; +SET GLOBAL slave_parallel_threads=2; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t3 VALUES (100, rand()); +INSERT INTO t3 VALUES (101, rand()); +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +INSERT INTO t3 VALUES (102, rand()); +INSERT INTO t3 VALUES (103, rand()); +INSERT INTO t3 VALUES (104, rand()); +INSERT INTO t3 VALUES (105, rand()); +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET GLOBAL replicate_ignore_table=""; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t3 VALUES (106, rand()); +INSERT INTO t3 VALUES (107, rand()); +--save_master_pos + +--connection server_2 +--sync_with_master +--replace_column 2 # +SELECT * FROM t3 WHERE a >= 100 ORDER BY a; + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t3; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test index d9dc4dfd293..d918b2ea692 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test @@ -1 +1,366 @@ ---source include/rpl_parallel_gco_wait_kill.inc +--echo *** Test killing thread that is waiting to start transaction until previous transaction commits *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET sql_log_bin=0; +CALL mtr.add_suppression("Query execution was interrupted"); +CALL mtr.add_suppression("Slave: Connection was killed"); +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +SET sql_log_bin=1; +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode= 'conservative'; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; +# We need to restart all parallel threads for the new global setting to +# be copied to the session-level values. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=4; +--source include/start_slave.inc + + +# We set up four transactions T1, T2, T3, and T4 on the master. T2, T3, and T4 +# can run in parallel with each other (same group commit and commit id), +# but not in parallel with T1. +# +# We use four worker threads, each Ti will be queued on each their own +# worker thread. We will delay T1 commit, T3 will wait for T1 to begin +# commit before it can start. We will kill T3 during this wait, and +# check that everything works correctly. +# +# It is rather tricky to get the correct thread id of the worker to kill. +# We start by injecting four dummy transactions in a debug_sync-controlled +# manner to be able to get known thread ids for the workers in a pool with +# just 4 worker threads. Then we let in each of the real test transactions +# T1-T4 one at a time in a way which allows us to know which transaction +# ends up with which thread id. + +--connection server_1 +SET gtid_domain_id=2; +BEGIN; +# This debug_sync will linger on and be used to control T4 later. +INSERT INTO t3 VALUES (70, foo(70, + 'rpl_parallel_start_waiting_for_prior SIGNAL t4_waiting', '')); +INSERT INTO t3 VALUES (60, foo(60, + 'ha_write_row_end SIGNAL d2_query WAIT_FOR d2_cont2', + 'rpl_parallel_end_of_group SIGNAL d2_done WAIT_FOR d2_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d2_query'; +--let $d2_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(60%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=1; +BEGIN; +# These debug_sync's will linger on and be used to control T3 later. +INSERT INTO t3 VALUES (61, foo(61, + 'rpl_parallel_start_waiting_for_prior SIGNAL t3_waiting', + 'rpl_parallel_start_waiting_for_prior_killed SIGNAL t3_killed')); +INSERT INTO t3 VALUES (62, foo(62, + 'ha_write_row_end SIGNAL d1_query WAIT_FOR d1_cont2', + 'rpl_parallel_end_of_group SIGNAL d1_done WAIT_FOR d1_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d1_query'; +--let $d1_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(62%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=0; +INSERT INTO t3 VALUES (63, foo(63, + 'ha_write_row_end SIGNAL d0_query WAIT_FOR d0_cont2', + 'rpl_parallel_end_of_group SIGNAL d0_done WAIT_FOR d0_cont')); + +--connection server_2 +SET debug_sync='now WAIT_FOR d0_query'; +--let $d0_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(63%' AND INFO NOT LIKE '%LIKE%'` + +--connection server_1 +SET gtid_domain_id=3; +BEGIN; +# These debug_sync's will linger on and be used to control T2 later. +INSERT INTO t3 VALUES (68, foo(68, + 'rpl_parallel_start_waiting_for_prior SIGNAL t2_waiting', '')); +INSERT INTO t3 VALUES (69, foo(69, + 'ha_write_row_end SIGNAL d3_query WAIT_FOR d3_cont2', + 'rpl_parallel_end_of_group SIGNAL d3_done WAIT_FOR d3_cont')); +COMMIT; +SET gtid_domain_id=0; + +--connection server_2 +SET debug_sync='now WAIT_FOR d3_query'; +--let $d3_thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(69%' AND INFO NOT LIKE '%LIKE%'` + +SET debug_sync='now SIGNAL d2_cont2'; +SET debug_sync='now WAIT_FOR d2_done'; +SET debug_sync='now SIGNAL d1_cont2'; +SET debug_sync='now WAIT_FOR d1_done'; +SET debug_sync='now SIGNAL d0_cont2'; +SET debug_sync='now WAIT_FOR d0_done'; +SET debug_sync='now SIGNAL d3_cont2'; +SET debug_sync='now WAIT_FOR d3_done'; + +# Now prepare the real transactions T1, T2, T3, T4 on the master. + +--connection con_temp3 +# Create transaction T1. +INSERT INTO t3 VALUES (64, foo(64, + 'rpl_parallel_before_mark_start_commit SIGNAL t1_waiting WAIT_FOR t1_cont', '')); + +# Create transaction T2, as a group commit leader on the master. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2 WAIT_FOR master_cont2'; +send INSERT INTO t3 VALUES (65, foo(65, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp4 +# Create transaction T3, participating in T2's group commit. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (66, foo(66, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; + +--connection con_temp5 +# Create transaction T4, participating in group commit with T2 and T3. +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued4'; +send INSERT INTO t3 VALUES (67, foo(67, '', '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued4'; +SET debug_sync='now SIGNAL master_cont2'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Now we have the four transactions pending for replication on the slave. +# Let them be queued for our three worker threads in a controlled fashion. +# We put them at a stage where T1 is delayed and T3 is waiting for T1 to +# commit before T3 can start. Then we kill T3. + +# Make the worker D0 free, and wait for T1 to be queued in it. +SET debug_sync='now SIGNAL d0_cont'; +SET debug_sync='now WAIT_FOR t1_waiting'; + +# Make the worker D3 free, and wait for T2 to be queued in it. +SET debug_sync='now SIGNAL d3_cont'; +SET debug_sync='now WAIT_FOR t2_waiting'; + +# Now release worker D1, and wait for T3 to be queued in it. +# T3 will wait for T1 to commit before it can start. +SET debug_sync='now SIGNAL d1_cont'; +SET debug_sync='now WAIT_FOR t3_waiting'; + +# Release worker D2. Wait for T4 to be queued, so we are sure it has +# received the debug_sync signal (else we might overwrite it with the +# next debug_sync). +SET debug_sync='now SIGNAL d2_cont'; +SET debug_sync='now WAIT_FOR t4_waiting'; + +# Now we kill the waiting transaction T3 in worker D1. +--replace_result $d1_thd_id THD_ID +eval KILL $d1_thd_id; + +# Wait until T3 has reacted on the kill. +SET debug_sync='now WAIT_FOR t3_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +# Since T2, T3, and T4 run in parallel, we can not be sure if T2 will have time +# to commit or not before the stop. However, T1 should commit, and T3/T4 may +# not have committed. (After slave restart we check that all become committed +# eventually). +SELECT * FROM t3 WHERE a >= 60 AND a != 65 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +UPDATE t3 SET b=b+1 WHERE a=60; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 60 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + +--echo *** 5. Test killing thread that is waiting for queue of max length to shorten *** + +# Find the thread id of the driver SQL thread that we want to kill. +--let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' +--source include/wait_condition.inc +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` +SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; +SET GLOBAL slave_parallel_max_queued=9000; + +--connection server_1 +--let bigstring= `SELECT REPEAT('x', 10000)` +# Create an event that will wait to be signalled. +INSERT INTO t3 VALUES (80, foo(0, + 'ha_write_row_end SIGNAL query_waiting WAIT_FOR query_cont', '')); + +--connection server_2 +SET debug_sync='now WAIT_FOR query_waiting'; +# Inject that the SQL driver thread will signal `wait_queue_ready' to debug_sync +# as it goes to wait for the event queue to become smaller than the value of +# @@slave_parallel_max_queued. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_queue_max"; + +--connection server_1 +--disable_query_log +# Create an event that will fill up the queue. +# The Xid event at the end of the event group will have to wait for the Query +# event with the INSERT to drain so the queue becomes shorter. However that in +# turn waits for the prior event group to continue. +eval INSERT INTO t3 VALUES (81, LENGTH('$bigstring')); +--enable_query_log +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; + +--connection server_2 +SET debug_sync='now WAIT_FOR wait_queue_ready'; + +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +SET debug_sync='now WAIT_FOR wait_queue_killed'; +SET debug_sync='now SIGNAL query_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; + +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_max_queued= @old_max_queued; + +--connection server_1 +INSERT INTO t3 VALUES (82,0); +--save_master_pos + +--connection server_2 +SET debug_sync='RESET'; +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 80 ORDER BY a; + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP function foo; +DROP TABLE t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test b/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test index 0756caca084..da1a07d3b87 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_gtid_slave_pos_update_fail.test @@ -1 +1,98 @@ ---source include/rpl_parallel_gtid_slave_pos_update_fail.inc +# MDEV-6549, failing to update gtid_slave_pos for a transaction that was retried. + +# The problem was that when a transaction updates the mysql.gtid_slave_pos +# table, it clears the flag that marks that there is a GTID position that +# needs to be updated. Then, if the transaction got killed after that due +# to a deadlock, the subsequent retry would fail to notice that the GTID needs +# to be recorded in gtid_slave_pos. +# +# (In the original bug report, the symptom was an assertion; this was however +# just a side effect of the missing update of gtid_slave_pos, which also +# happened to cause a missing clear of OPTION_GTID_BEGIN). +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +# Must use statement-based binlogging. Otherwise the transaction will not be +# binlogged at all, as it modifies no rows. +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +# Create two transactions that can run in parallel on the slave but cause +# a deadlock if the second runs before the first. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 1; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos +--let $last_gtid= `SELECT @@last_gtid` + +--connection server_2 +# Disable the usual skip of gap locks for transactions that are run in +# parallel, using DBUG. This allows the deadlock to occur, and this in turn +# triggers a retry of the second transaction, and the code that was buggy and +# caused the gtid_slave_pos update to be skipped in the retry. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,disable_thd_need_ordering_with"; +--source include/start_slave.inc +--sync_with_master +SET GLOBAL debug_dbug=@old_dbug; + +SELECT * FROM t4 ORDER BY a; +# Check that the GTID of the second transaction was correctly recorded in +# gtid_slave_pos, in the variable as well as in the table. +--replace_result $last_gtid GTID +eval SET @last_gtid= '$last_gtid'; +SELECT IF(@@gtid_slave_pos LIKE CONCAT('%',@last_gtid,'%'), "GTID found ok", + CONCAT("GTID ", @last_gtid, " not found in gtid_slave_pos=", @@gtid_slave_pos)) + AS result; +SELECT "ROW FOUND" AS `Is the row found?` + FROM mysql.gtid_slave_pos + WHERE CONCAT(domain_id, "-", server_id, "-", seq_no) = @last_gtid; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t4; +SET DEBUG_SYNC= 'RESET'; +--disconnect con1 +--disconnect con2 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test b/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test index 92c84d497a7..2fab9f8032b 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_ignore_error_on_rotate.test @@ -1 +1,96 @@ ---source include/rpl_parallel_ignore_error_on_rotate.inc +--echo *** MDEV-6551: Some replication errors are ignored if slave_parallel_threads > 0 *** + +--source include/have_innodb.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_threads=1; +CHANGE MASTER TO master_use_gtid=slave_pos; +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +SET gtid_domain_id=1; +INSERT INTO t2 VALUES (1); +SET gtid_domain_id=0; +SET gtid_domain_id=2; +INSERT INTO t2 VALUES (2); +SET gtid_domain_id=0; +INSERT INTO t2 VALUES (31); +--let $gtid1= `SELECT @@LAST_GTID` +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads= 0; +--source include/start_slave.inc + +# Force a duplicate key error on the slave. +SET sql_log_bin= 0; +INSERT INTO t2 VALUES (32); +SET sql_log_bin= 1; + +--connection server_1 +INSERT INTO t2 VALUES (32); +--let $gtid2= `SELECT @@LAST_GTID` +# Rotate the binlog; the bug is triggered when the master binlog file changes +# after the event group that causes the duplicate key error. +FLUSH LOGS; +INSERT INTO t2 VALUES (33); +INSERT INTO t2 VALUES (34); +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +--connection server_2 +--source include/stop_slave_io.inc +SET GLOBAL slave_parallel_threads=10; +START SLAVE; + +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +# Note: IO thread is still running at this point. +# The bug seems to have been that restarting the SQL thread after an error with +# the IO thread still running, somehow picks up a later relay log position and +# thus ends up skipping the failing event, rather than re-executing. + +START SLAVE SQL_THREAD; +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc + +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; + +# Skip the duplicate error, so we can proceed. +--error ER_SLAVE_SKIP_NOT_IN_GTID +SET sql_slave_skip_counter= 1; +--source include/stop_slave_io.inc +--disable_query_log +eval SET GLOBAL gtid_slave_pos = REPLACE(@@gtid_slave_pos, "$gtid1", "$gtid2"); +--enable_query_log +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t2 WHERE a >= 30 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test index 3838973c201..90304937445 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test @@ -1 +1,107 @@ ---source include/rpl_parallel_innodb_lock_conflict.inc +--echo ***MDEV-5914: Parallel replication deadlock due to InnoDB lock conflicts *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET sql_log_bin=0; +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +SET sql_log_bin=1; +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) + +# Create a group commit with UPDATE and DELETE, in that order. +# The bug was that while the UPDATE's row lock does not block the DELETE, the +# DELETE's gap lock _does_ block the UPDATE. This could cause a deadlock +# on the slave. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +--source include/stop_slave.inc + +SELECT * FROM t4 ORDER BY a; + + +# Another example, this one with INSERT vs. DELETE +--connection server_1 +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); + +# Create a group commit with INSERT and DELETE, in that order. +# The bug was that while the INSERT's insert intention lock does not block +# the DELETE, the DELETE's gap lock _does_ block the INSERT. This could cause +# a deadlock on the slave. +--connection con1 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t4 VALUES (7, NULL); +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +--source include/stop_slave.inc + +SELECT * FROM t4 ORDER BY a; + + +# Clean up. +--connection server_2 +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +--disconnect con1 +--disconnect con2 +DROP TABLE t4; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test index de9dc7f782a..33b1bcb11d9 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_missed_error_handling.test @@ -1 +1,87 @@ ---source include/rpl_parallel_missed_error_handling.inc +--echo *** MDEV-5921: In parallel replication, an error is not correctly signalled to the next transaction *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +INSERT INTO t3 VALUES (110, 1); +--save_master_pos + +--connection server_2 +--sync_with_master +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +# Inject a duplicate key error. +SET sql_log_bin=0; +INSERT INTO t3 VALUES (111, 666); +SET sql_log_bin=1; + +--connection server_1 + +# Create a group commit with two inserts, the first one conflicts with a row on the slave +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (111, 2); +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send INSERT INTO t3 VALUES (112, 3); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +--connection con2 +REAP; +SET debug_sync='RESET'; +--save_master_pos + +--connection server_2 +--let $slave_sql_errno= 1062 +--source include/wait_for_slave_sql_error.inc +--source include/wait_for_slave_sql_to_stop.inc +# We should not see the row (112,3) here, it should be rolled back due to +# error signal from the prior transaction. +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; +SET sql_log_bin=0; +DELETE FROM t3 WHERE a=111 AND b=666; +SET sql_log_bin=1; +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 110 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +--disconnect con1 +--disconnect con2 +DROP TABLE t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_mode.test b/mysql-test/suite/rpl/t/rpl_parallel_mode.test index afd9e038912..67104069e9a 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_mode.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_mode.test @@ -1 +1,87 @@ ---source include/rpl_parallel_mode.inc +--echo *** MDEV-6676 - test syntax of @@slave_parallel_mode *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode='aggressive'; +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc +SET GLOBAL slave_parallel_mode='conservative'; +--let $status_items= Parallel_Mode +--source include/show_slave_status.inc + +--echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel *** +--connection server_1 +INSERT INTO t2 VALUES (1040); +--source include/save_master_gtid.inc + +--connection server_2 +SET GLOBAL slave_parallel_mode='none'; +# Test that we do not use parallel apply, by injecting an unconditional +# crash in the parallel apply code. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply"; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; + + +--echo *** MDEV-6676 - test disabling domain-based parallel replication *** +--connection server_1 +# Let's do a bunch of transactions that will conflict if run out-of-order in +# domain-based parallel replication mode. +SET gtid_domain_id = 1; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +DELETE FROM t2 WHERE a >= 1041; +SET gtid_domain_id = 2; +INSERT INTO t2 VALUES (1041); +INSERT INTO t2 VALUES (1042); +INSERT INTO t2 VALUES (1043); +INSERT INTO t2 VALUES (1044); +INSERT INTO t2 VALUES (1045); +INSERT INTO t2 VALUES (1046); +SET gtid_domain_id = 0; +--source include/save_master_gtid.inc +--connection server_2 +SET GLOBAL slave_parallel_mode=minimal; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a >= 1040 ORDER BY a; + +# Cleanup +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test b/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test index 7be26edabb8..7247925285f 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_partial_binlog_trans.test @@ -1 +1,71 @@ ---source include/rpl_parallel_partial_binlog_trans.inc +--echo *** MDEV_6435: Incorrect error handling when query binlogged partially on master with "killed" error *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=1; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t6 (a INT) ENGINE=MyISAM; +CREATE TRIGGER tr AFTER INSERT ON t6 FOR EACH ROW SET @a = 1; +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) + +--connection con1 +--let $conid = `SELECT CONNECTION_ID()` +SET debug_sync='sp_head_execute_before_loop SIGNAL ready WAIT_FOR cont'; +send INSERT INTO t6 VALUES (1), (2), (3); + +--connection server_1 +SET debug_sync='now WAIT_FOR ready'; +--replace_result $conid CONID +eval KILL QUERY $conid; +SET debug_sync='now SIGNAL cont'; + +--connection con1 +--error ER_QUERY_INTERRUPTED +--reap +SET debug_sync='RESET'; +--let $after_error_gtid_pos= `SELECT @@gtid_binlog_pos` + +--connection server_1 +SET debug_sync='RESET'; + +--connection server_2 +--let $slave_sql_errno= 1317 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +--replace_result $after_error_gtid_pos AFTER_ERROR_GTID_POS +eval SET GLOBAL gtid_slave_pos= '$after_error_gtid_pos'; +--source include/start_slave.inc + +--connection server_1 +INSERT INTO t6 VALUES (4); +SELECT * FROM t6 ORDER BY a; +--save_master_pos + +--connection server_2 +--sync_with_master +SELECT * FROM t6 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t6; +SET DEBUG_SYNC= 'RESET'; +--disconnect con1 + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test b/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test index 4529a268103..0f94d8f9943 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_record_gtid_wakeup.test @@ -1 +1,72 @@ ---source include/rpl_parallel_record_gtid_wakeup.inc +--echo *** MDEV-7929: record_gtid() for non-transactional event group calls wakeup_subsequent_commits() too early, causing slave hang. *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_record_gtid_serverid_100_sleep'; + +--connection server_1 +# Inject two group commits. The bug was that record_gtid for a +# non-transactional event group would commit its own transaction, which would +# cause ha_commit_trans() to call wakeup_subsequent_commits() too early. This +# in turn lead to access to freed group_commit_orderer object, losing a wakeup +# and causing slave threads to hang. +# We inject a small sleep in the corresponding record_gtid() to make the race +# easier to hit. + +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +# Group commit with cid=10010, two event groups. +SET @old_server_id= @@SESSION.server_id; +SET SESSION server_id= 100; +SET @commit_id= 10010; +ALTER TABLE t1 COMMENT "Hulubulu!"; +SET SESSION server_id= @old_server_id; +INSERT INTO t3 VALUES (130, 0); + +# Group commit with cid=10011, one event group. +SET @commit_id= 10011; +INSERT INTO t3 VALUES (131, 0); + +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a >= 130 ORDER BY a; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1,t3; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test b/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test index 50b216b6f58..54ac859bb33 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_retry_deadlock.test @@ -1 +1,281 @@ ---source include/rpl_parallel_retry_deadlock.inc +--echo *** MDEV-7326 Server deadlock in connection with parallel replication *** +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +# Test assumes that 'conservative' mode is in effect. i.e +# Do not start parallel execution of this event group until all prior groups +# have reached the commit phase. Refer 'rpl_parallel_start_waiting_for_prior' +# debug simumation. +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t6 (a INT) ENGINE=MyISAM; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +# We use three transactions, each in a separate group commit. +# T1 does mark_start_commit(), then gets a deadlock error. +# T2 wakes up and starts running +# T1 does unmark_start_commit() +# T3 goes to wait for T2 to start its commit +# T2 does mark_start_commit() +# The bug was that at this point, T3 got deadlocked. Because T1 has unmarked(), +# T3 did not yet see the count_committing_event_groups reach its target value +# yet. But when T1 later re-did mark_start_commit(), it failed to send a wakeup +# to T3. + +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +--source include/start_slave.inc + +--connection server_1 +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +# This debug_sync will linger on and be used to control T3 later. +INSERT INTO t1 VALUES (foo(50, + "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", + "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +--save_master_pos +--connection server_2 +# Wait for the debug_sync point for T3 to be set. But let the preparation +# transaction remain hanging, so that T1 and T2 will be scheduled for the +# remaining two worker threads. +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; + +--connection server_1 +INSERT INTO t2 VALUES (foo(50, + "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", + "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +--save_master_pos + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +# T1 has now done mark_start_commit(). It will later do a rollback and retry. + +--connection server_1 +# Use a MyISAM table for T2 and T3, so they do not trigger the +# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. +INSERT INTO t1 VALUES (foo(51, + "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", + "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +# T2 has now started running, but has not yet done mark_start_commit() +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +# T1 has now done unmark_start_commit() in preparation for its retry. + +--connection server_1 +INSERT INTO t1 VALUES (52); +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +SELECT * FROM t1 WHERE a>=50 ORDER BY a; + +--connection server_2 +# Let the preparation transaction complete, so that the same worker thread +# can continue with the transaction T3. +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +# T3 has now gone to wait for T2 to start committing +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +# T2 has now done mark_start_commit(). +# Let things run, and check that T3 does not get deadlocked. +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +--sync_with_master + +--connection server_1 +--save_master_pos +--connection server_2 +--sync_with_master +SELECT * FROM t2 WHERE a>=50 ORDER BY a; +SELECT * FROM t1 WHERE a>=50 ORDER BY a; +SET DEBUG_SYNC="reset"; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** MDEV-7326 Server deadlock in connection with parallel replication *** +# Similar to the previous test, but with T2 and T3 in the same GCO. +# We use three transactions, T1 in one group commit and T2/T3 in another. +# T1 does mark_start_commit(), then gets a deadlock error. +# T2 wakes up and starts running +# T1 does unmark_start_commit() +# T3 goes to wait for T1 to start its commit +# T2 does mark_start_commit() +# The bug was that at this point, T3 got deadlocked. T2 increments the +# count_committing_event_groups but does not signal T3, as they are in +# the same GCO. Then later when T1 increments, it would also not signal +# T3, because now the count_committing_event_groups is not equal to the +# wait_count of T3 (it is one larger). + +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; +SET GLOBAL slave_parallel_mode='conservative'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=3; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +--source include/start_slave.inc + +--connection server_1 +SET @old_format= @@SESSION.binlog_format; +SET binlog_format= STATEMENT; +# This debug_sync will linger on and be used to control T3 later. +INSERT INTO t1 VALUES (foo(60, + "rpl_parallel_start_waiting_for_prior SIGNAL t3_ready", + "rpl_parallel_end_of_group SIGNAL prep_ready WAIT_FOR prep_cont")); +--save_master_pos +--connection server_2 +# Wait for the debug_sync point for T3 to be set. But let the preparation +# transaction remain hanging, so that T1 and T2 will be scheduled for the +# remaining two worker threads. +SET DEBUG_SYNC= "now WAIT_FOR prep_ready"; + +--connection server_1 +INSERT INTO t2 VALUES (foo(60, + "rpl_parallel_simulate_temp_err_xid SIGNAL t1_ready1 WAIT_FOR t1_cont1", + "rpl_parallel_retry_after_unmark SIGNAL t1_ready2 WAIT_FOR t1_cont2")); +--save_master_pos + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t1_ready1"; +# T1 has now done mark_start_commit(). It will later do a rollback and retry. + +# Do T2 and T3 in a single group commit. +# Use a MyISAM table for T2 and T3, so they do not trigger the +# rpl_parallel_simulate_temp_err_xid DBUG insertion on XID event. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t1 VALUES (foo(61, + "rpl_parallel_before_mark_start_commit SIGNAL t2_ready1 WAIT_FOR t2_cont1", + "rpl_parallel_after_mark_start_commit SIGNAL t2_ready2")); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send INSERT INTO t6 VALUES (62); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; + +--connection server_1 +SET debug_sync='RESET'; +SET BINLOG_FORMAT= @old_format; +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +SELECT * FROM t6 WHERE a>=60 ORDER BY a; + +--connection server_2 +SET DEBUG_SYNC= "now WAIT_FOR t2_ready1"; +# T2 has now started running, but has not yet done mark_start_commit() +SET DEBUG_SYNC= "now SIGNAL t1_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t1_ready2"; +# T1 has now done unmark_start_commit() in preparation for its retry. + +--connection server_2 +# Let the preparation transaction complete, so that the same worker thread +# can continue with the transaction T3. +SET DEBUG_SYNC= "now SIGNAL prep_cont"; +SET DEBUG_SYNC= "now WAIT_FOR t3_ready"; +# T3 has now gone to wait for T2 to start committing +SET DEBUG_SYNC= "now SIGNAL t2_cont1"; +SET DEBUG_SYNC= "now WAIT_FOR t2_ready2"; +# T2 has now done mark_start_commit(). +# Let things run, and check that T3 does not get deadlocked. +SET DEBUG_SYNC= "now SIGNAL t1_cont2"; +--sync_with_master + +--connection server_1 +--save_master_pos +--connection server_2 +--sync_with_master +SELECT * FROM t2 WHERE a>=60 ORDER BY a; +SELECT * FROM t1 WHERE a>=60 ORDER BY a; +SELECT * FROM t6 WHERE a>=60 ORDER BY a; +SET DEBUG_SYNC="reset"; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP function foo; +DROP TABLE t1,t2,t6; +--disconnect con_temp3 +--disconnect con_temp4 +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test b/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test index f66375b7fb4..eec331b3d64 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_rollback_assert.test @@ -1 +1,62 @@ ---source include/rpl_parallel_rollback_assert.inc +--echo *** MDEV-8725: Assertion on ROLLBACK statement in the binary log *** +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Inject an event group terminated by ROLLBACK, by mixing MyISAM and InnoDB +# in a transaction. The bug was an assertion on the ROLLBACK due to +# mark_start_commit() being already called. +--disable_warnings +BEGIN; +INSERT INTO t2 VALUES (2000); +INSERT INTO t1 VALUES (2000); +INSERT INTO t2 VALUES (2001); +ROLLBACK; +--enable_warnings +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc + +--connection server_1 +INSERT INTO t2 VALUES (2020); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +SELECT * FROM t2 WHERE a>=2000 ORDER BY a; +let $rows_in_t1= `SELECT COUNT(*) FROM t1 WHERE a>=2000 ORDER BY a`; +if ($rows_in_t1 == 0) +{ +--query_vertical SHOW SLAVE STATUS +} +SELECT * FROM t1 WHERE a>=2000 ORDER BY a; + +# Clean up. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1,t2; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test b/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test index 20919823945..cf4c547b73b 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_single_grpcmt.test @@ -1 +1,170 @@ ---source include/rpl_parallel_single_grpcmt.inc +--echo *** Test that group-committed transactions on the master can replicate in parallel on the slave. *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_1 +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +--source include/stop_slave.inc +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +# We need to restart all parallel threads for the new global setting to +# be copied to the session-level values. +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +# Create some sentinel rows so that the rows inserted in parallel fall into +# separate gaps and do not cause gap lock conflicts. +INSERT INTO t3 VALUES (1,1), (3,3), (5,5), (7,7); +--save_master_pos +--connection server_2 +--sync_with_master + + +# We want to test that the transactions can execute out-of-order on +# the slave, but still end up committing in-order, and in a single +# group commit. +# +# The idea is to group-commit three transactions together on the master: +# A, B, and C. On the slave, C will execute the insert first, then A, +# and then B. But B manages to complete before A has time to commit, so +# all three end up committing together. +# +# So we start by setting up some row locks that will block transactions +# A and B from executing, allowing C to run first. + +--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +BEGIN; +INSERT INTO t3 VALUES (2,102); +--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +BEGIN; +INSERT INTO t3 VALUES (4,104); + +# On the master, queue three INSERT transactions as a single group commit. +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (2, foo(12, + 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued1 WAIT_FOR slave_cont1', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (4, foo(14, + 'commit_after_release_LOCK_prepare_ordered SIGNAL slave_queued2', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +SET binlog_format=statement; +send INSERT INTO t3 VALUES (6, foo(16, + 'group_commit_waiting_for_prior SIGNAL slave_queued3', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; +SET debug_sync='RESET'; + +--connection server_1 +SELECT * FROM t3 ORDER BY a; +--let $binlog_file= master-bin.000001 +--source include/show_binlog_events.inc + +# First, wait until insert 3 is ready to queue up for group commit, but is +# waiting for insert 2 to commit before it can do so itself. +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued3'; + +# Next, let insert 1 proceed, and allow it to queue up as the group commit +# leader, but let it wait for insert 2 to also queue up before proceeding. +--connection con_temp1 +ROLLBACK; +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued1'; + +# Now let insert 2 proceed and queue up. +--connection con_temp2 +ROLLBACK; +--connection server_2 +SET debug_sync='now WAIT_FOR slave_queued2'; +# And finally, we can let insert 1 proceed and do the group commit with all +# three insert transactions together. +SET debug_sync='now SIGNAL slave_cont1'; + +# Wait for the commit to complete and check that all three transactions +# group-committed together (will be seen in the binlog as all three having +# cid=# on their GTID event). +--let $wait_condition= SELECT COUNT(*) = 3 FROM t3 WHERE a IN (2,4,6) +--source include/wait_condition.inc +SELECT * FROM t3 ORDER BY a; +--let $binlog_file= slave-bin.000001 +--source include/show_binlog_events.inc + + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP function foo; +DROP TABLE t3; +SET DEBUG_SYNC= 'RESET'; + +--disable_connect_log +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test index 7b0f9485e5e..a78dbad052f 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_slave_bgc_kill.test @@ -1 +1,454 @@ ---source include/rpl_parallel_slave_bgc_kill.inc +--echo *** Test killing slave threads at various wait points *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +# Test various aspects of parallel replication. + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode='conservative'; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master + +--connection server_1 +# Use a stored function to inject a debug_sync into the appropriate THD. +# The function does nothing on the master, and on the slave it injects the +# desired debug_sync action(s). +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_2 +SET sql_log_bin=0; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--echo *** 1. Test killing transaction waiting in commit for previous transaction to commit *** + +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (31, foo(31, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (32, foo(32, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (33, foo(33, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (34, foo(34, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +SET sql_log_bin=0; +CALL mtr.add_suppression("Query execution was interrupted"); +CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); +CALL mtr.add_suppression("Slave: Connection was killed"); +SET sql_log_bin=1; +# Wait until T2 is inside executing its insert of 32, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(32%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +STOP SLAVE IO_THREAD; +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (39,0); +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t3 WHERE a >= 30 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** 2. Same as (1), but without restarting IO thread after kill of SQL threads *** + +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (41, foo(41, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (42, foo(42, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (43, foo(43, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (44, foo(44, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Wait until T2 is inside executing its insert of 42, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(42%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (49,0); +--save_master_pos + +--connection server_2 +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 40 ORDER BY a; +# Restore the foo() function. +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + IF d1 != '' THEN + SET debug_sync = d1; + END IF; + IF d2 != '' THEN + SET debug_sync = d2; + END IF; + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + +--echo *** 3. Same as (2), but not using gtid mode *** + +--connection server_2 +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +--source include/start_slave.inc + +--connection server_1 +# Set up three transactions on the master that will be group-committed +# together so they can be replicated in parallel on the slave. +--connection con_temp3 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send INSERT INTO t3 VALUES (51, foo(51, + 'commit_before_prepare_ordered WAIT_FOR t2_waiting', + 'commit_after_prepare_ordered SIGNAL t1_ready WAIT_FOR t1_cont')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con_temp4 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +BEGIN; +# This insert is just so we can get T2 to wait while a query is running that we +# can see in SHOW PROCESSLIST so we can get its thread_id to kill later. +INSERT INTO t3 VALUES (52, foo(52, + 'ha_write_row_end SIGNAL t2_query WAIT_FOR t2_cont', + '')); +# This insert sets up debug_sync points so that T2 will tell when it is at its +# wait point where we want to kill it - and when it has been killed. +INSERT INTO t3 VALUES (53, foo(53, + 'group_commit_waiting_for_prior SIGNAL t2_waiting', + 'group_commit_waiting_for_prior_killed SIGNAL t2_killed')); +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connection con_temp5 +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send INSERT INTO t3 VALUES (54, foo(54, + '', + '')); + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con_temp3 +REAP; +--connection con_temp4 +REAP; +--connection con_temp5 +REAP; + +--connection server_1 +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; +SET debug_sync='RESET'; + +--connection server_2 +# Wait until T2 is inside executing its insert of 52, then find it in SHOW +# PROCESSLIST to know its thread id for KILL later. +SET debug_sync='now WAIT_FOR t2_query'; +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%foo(52%' AND INFO NOT LIKE '%LIKE%'` +SET debug_sync='now SIGNAL t2_cont'; + +# Wait until T2 has entered its wait for T1 to commit, and T1 has +# progressed into its commit phase. +SET debug_sync='now WAIT_FOR t1_ready'; + +# Now kill the transaction T2. +--replace_result $thd_id THD_ID +eval KILL $thd_id; + +# Wait until T2 has reacted on the kill. +SET debug_sync='now WAIT_FOR t2_killed'; + +# Now we can allow T1 to proceed. +SET debug_sync='now SIGNAL t1_cont'; + +--let $slave_sql_errno= 1317,1927,1964 +--source include/wait_for_slave_sql_error.inc +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; + +# Now we have to disable the debug_sync statements, so they do not trigger +# when the events are retried. +SET debug_sync='RESET'; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET sql_log_bin=0; +DROP FUNCTION foo; +--delimiter || +CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500)) + RETURNS INT DETERMINISTIC + BEGIN + RETURN x; + END +|| +--delimiter ; +SET sql_log_bin=1; + +--connection server_1 +INSERT INTO t3 VALUES (59,0); +--save_master_pos + +--connection server_2 +START SLAVE SQL_THREAD; +--sync_with_master +SELECT * FROM t3 WHERE a >= 50 ORDER BY a; + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP function foo; +DROP TABLE t1,t2,t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test index 64b4cb77dd4..63c483ea6ad 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_stop_on_con_kill.test @@ -1 +1,129 @@ ---source include/rpl_parallel_stop_on_con_kill.inc +--echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +INSERT INTO t3 VALUES (201,0), (202,0); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_mdev8031'; + +--connection server_1 +# We artificially create a situation that hopefully resembles the original +# bug which was only seen "in the wild", and only once. +# Setup a fake group commit with lots of conflicts that will lead to deadloc +# kill. The slave DBUG injection causes the slave to be deadlock killed at +# a particular point during the retry, and then later do a small sleep at +# another critical point where the prior transaction then has a chance to +# complete. Finally an extra KILL check catches an unhandled, lingering +# deadlock kill. So rather artificial, but at least it exercises the +# relevant code paths. +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +SET @commit_id= 10200; +INSERT INTO t3 VALUES (203, 1); +INSERT INTO t3 VALUES (204, 1); +INSERT INTO t3 VALUES (205, 1); +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=201; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=202; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=204; +UPDATE t3 SET b=b+1 WHERE a=203; +UPDATE t3 SET b=b+1 WHERE a=205; +UPDATE t3 SET b=b+1 WHERE a=205; +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_dbug; +--source include/start_slave.inc + + +--echo *** Check getting deadlock killed inside open_binlog() during retry. *** + +--connection server_2 +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill'; +SET @old_max= @@GLOBAL.max_relay_log_size; +SET GLOBAL max_relay_log_size= 4096; + +--connection server_1 +SET @old_dbug= @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,binlog_force_commit_id"; + +--let $large= `SELECT REPEAT("*", 8192)` +SET @commit_id= 10210; +--echo Omit long queries that cause relaylog rotations and transaction retries... +--disable_query_log +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; +eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */; +--enable_query_log +SET SESSION debug_dbug=@old_dbug; + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +SELECT * FROM t3 WHERE a>=200 ORDER BY a; + +# Cleanup +--source include/stop_slave.inc +SET GLOBAL debug_dbug= @old_debg; +SET GLOBAL max_relay_log_size= @old_max; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t3; + +--source include/rpl_end.inc + diff --git a/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test b/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test index 131ddc2efd9..4eeddc927e0 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_stop_slave.test @@ -1 +1,114 @@ ---source include/rpl_parallel_stop_slave.inc +--echo *** Test STOP SLAVE in parallel mode *** + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +SET GLOBAL slave_parallel_mode='conservative'; + +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc +--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_2,) +--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_2,) + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc + +--connection server_1 +# Set up a couple of transactions. The first will be blocked halfway +# through on a lock, and while it is blocked we initiate STOP SLAVE. +# We then test that the halfway-initiated transaction is allowed to +# complete, but no subsequent ones. +# We have to use statement-based mode and set +# binlog_direct_non_transactional_updates=0; otherwise the binlog will +# be split into two event groups, one for the MyISAM part and one for the +# InnoDB part. +SET binlog_direct_non_transactional_updates=0; +SET sql_log_bin=0; +CALL mtr.add_suppression("Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"); +SET sql_log_bin=1; +BEGIN; +INSERT INTO t2 VALUES (20); +--disable_warnings +INSERT INTO t1 VALUES (20); +--enable_warnings +INSERT INTO t2 VALUES (21); +INSERT INTO t3 VALUES (20, 20); +COMMIT; +INSERT INTO t3 VALUES(21, 21); +INSERT INTO t3 VALUES(22, 22); +--save_master_pos + +# Start a connection that will block the replicated transaction halfway. +--connection con_temp1 +BEGIN; +INSERT INTO t2 VALUES (21); + +--connection server_2 +START SLAVE; +# Wait for the MyISAM change to be visible, after which replication will wait +# for con_temp1 to roll back. +--let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20 +--source include/wait_condition.inc + +--connection con_temp2 +# Initiate slave stop. It will have to wait for the current event group +# to complete. +# The dbug injection causes debug_sync to signal 'wait_for_done_waiting' +# when the SQL driver thread is ready. +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; +send STOP SLAVE; + +--connection con_temp1 +SET debug_sync='now WAIT_FOR wait_for_done_waiting'; +ROLLBACK; + +--connection con_temp2 +reap; +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; + +--connection server_2 +--source include/wait_for_slave_to_stop.inc +# We should see the first transaction applied, but not the two others. +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; + +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 20 ORDER BY a; +SELECT * FROM t2 WHERE a >= 20 ORDER BY a; +SELECT * FROM t3 WHERE a >= 20 ORDER BY a; + +--connection server_2 +# Respawn all worker threads to clear any left-over debug_sync or other stuff. +--source include/stop_slave.inc +SET GLOBAL slave_parallel_mode=@old_parallel_mode; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; +--disconnect con_temp1 +--disconnect con_temp2 + +--connection server_1 +DROP TABLE t1,t2,t3; +SET DEBUG_SYNC= 'RESET'; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test b/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test index 3c920e1539a..093693d453e 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_wrong_binlog_order.test @@ -1 +1,91 @@ ---source include/rpl_parallel_wrong_binlog_order.inc +--echo *** MDEV-6775: Wrong binlog order in parallel replication *** + +# A bit tricky bug to reproduce. On the master, we binlog in statement-mode +# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate +# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, +# is not binlogged. Then we inject a wait in the group commit code on the +# slave, shortly before the actual commit of the UPDATE. The bug was that the +# DELETE could wake up from wait_for_prior_commit() before the commit of the +# UPDATE. So the test could see the slave position updated to after DELETE, +# while the UPDATE was still not visible. + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/master-slave.inc + +--connection server_2 +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=10; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t4 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +# Re-spawn the worker threads to be sure they pick up the new binlog format +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; + +--connection con1 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +SET binlog_format= @old_format; +--connection con2 +REAP; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +--save_master_pos +SELECT * FROM t4 ORDER BY a; + +--connection server_2 +--source include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +--sync_with_master +SELECT * FROM t4 ORDER BY a; +SET debug_sync= 'now SIGNAL cont'; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc +SET DEBUG_SYNC= 'RESET'; + +--connection server_1 +DROP TABLE t4; +SET DEBUG_SYNC= 'RESET'; +--disconnect con1 +--disconnect con2 +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test b/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test index 9cd700f57fa..672ade57ca3 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_wrong_exec_master_pos.test @@ -1 +1,56 @@ ---source include/rpl_parallel_wrong_exec_master_pos.inc +--echo *** MDEV-5938: Exec_master_log_pos not updated at log rotate in parallel replication *** +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection server_2 +--source include/stop_slave.inc +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +SET GLOBAL slave_parallel_threads=1; +CHANGE MASTER TO master_use_gtid=slave_pos; +--source include/start_slave.inc + +--connection server_1 +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +CREATE TABLE t5 (a INT PRIMARY KEY, b INT); +INSERT INTO t5 VALUES (1,1); +INSERT INTO t5 VALUES (2,2), (3,8); +INSERT INTO t5 VALUES (4,16); +--save_master_pos + +--connection server_2 +--sync_with_master +let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); +let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); +let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; +eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; +--enable_query_log + +--connection server_1 +FLUSH LOGS; +--source include/wait_for_binlog_checkpoint.inc +--save_master_pos + +--connection server_2 +--sync_with_master +let $io_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); +let $io_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +let $sql_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1); +let $sql_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT IF('$io_file' = '$sql_file', "OK", "Not ok, $io_file <> $sql_file") AS test_check; +eval SELECT IF('$io_pos' = '$sql_pos', "OK", "Not ok, $io_pos <> $sql_pos") AS test_check; +--enable_query_log + +# Clean up. +--connection server_2 +--source include/stop_slave.inc +SET GLOBAL slave_parallel_threads=@old_parallel_threads; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t5; + +--source include/rpl_end.inc From 15ca6c5a2f3cc8a0a4bdec016af8748823004797 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 24 Mar 2023 11:18:19 +1100 Subject: [PATCH 05/14] rpl_reporting: sprintf -> snprintf This was failing to compile with AppleClang 14.0.0.14000029. Thanks to Arunesh Choudhary for noticing. --- sql/rpl_reporting.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sql/rpl_reporting.h b/sql/rpl_reporting.h index 46a71ff5ad6..8c10f3f04c1 100644 --- a/sql/rpl_reporting.h +++ b/sql/rpl_reporting.h @@ -93,13 +93,13 @@ public: localtime_r(&skr, &tm_tmp); start=&tm_tmp; - sprintf(timestamp, "%02d%02d%02d %02d:%02d:%02d", - start->tm_year % 100, - start->tm_mon+1, - start->tm_mday, - start->tm_hour, - start->tm_min, - start->tm_sec); + snprintf(timestamp, sizeof(timestamp), "%02d%02d%02d %02d:%02d:%02d", + start->tm_year % 100, + start->tm_mon+1, + start->tm_mday, + start->tm_hour, + start->tm_min, + start->tm_sec); timestamp[15]= '\0'; } From 50c8ef01fc63e32acd38788107ae4029d0f1b9ce Mon Sep 17 00:00:00 2001 From: Otto Kekalainen Date: Sat, 11 Mar 2023 11:07:48 -0800 Subject: [PATCH 06/14] Fix trivial spelling errors - agressively -> aggressively - exising -> existing - occured -> occurred - releated -> related - seperated -> separated - sucess -> success - use use -> use All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- mysql-test/main/backup_syntax.test | 2 +- mysql-test/main/mysqld--help.result | 4 +- .../suite/perfschema/r/table_schema.result | 2 +- mysql-test/suite/rpl/r/rpl_mdev-11092.result | 2 +- mysql-test/suite/rpl/t/rpl_mdev-11092.test | 2 +- .../r/sysvars_server_embedded,32bit.rdiff | 2 +- .../sys_vars/r/sysvars_server_embedded.result | 2 +- .../r/sysvars_server_notembedded,32bit.rdiff | 2 +- .../r/sysvars_server_notembedded.result | 4 +- .../t/innodb_max_dirty_pages_pct_func.test | 2 +- sql/ha_partition.cc | 2 +- sql/replication.h | 48 +++++++++---------- sql/sp_head.cc | 2 +- sql/sql_delete.cc | 2 +- sql/sql_partition.cc | 2 +- sql/sql_statistics.h | 2 +- sql/sys_vars.cc | 4 +- storage/connect/tabrest.cpp | 2 +- .../dictionary/html/js/jquery-1.7.2.js | 2 +- ...plication_applier_status_by_coordinator.cc | 2 +- vio/viossl.c | 2 +- 21 files changed, 47 insertions(+), 47 deletions(-) diff --git a/mysql-test/main/backup_syntax.test b/mysql-test/main/backup_syntax.test index f02c69bdd85..8aaef824f89 100644 --- a/mysql-test/main/backup_syntax.test +++ b/mysql-test/main/backup_syntax.test @@ -1,5 +1,5 @@ ######################################################################## -# Tests things releated to syntax of BACKUP STAGE (MDEV-5336) +# Tests things related to syntax of BACKUP STAGE (MDEV-5336) ######################################################################## --source include/have_innodb.inc diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 5720988df2f..58917cbadbc 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -367,7 +367,7 @@ The following specify which files/extra groups are read (specified before remain log. Slave stops with an error if it encounters an event that would cause it to generate an out-of-order binlog if executed. When ON the same server-id semisync-replicated - transactions that duplicate exising ones in binlog are + transactions that duplicate existing ones in binlog are ignored without error and slave interruption. -?, --help Display this help and exit. --histogram-size=# Number of bytes used for a histogram. If set to 0, no @@ -722,7 +722,7 @@ The following specify which files/extra groups are read (specified before remain (Automatically configured unless set explicitly) --optimizer-extra-pruning-depth=# If the optimizer needs to enumerate join prefix of this - size or larger, then it will try agressively prune away + size or larger, then it will try aggressively prune away the search space. --optimizer-max-sel-arg-weight=# The maximum weight of the SEL_ARG graph. Set to 0 for no diff --git a/mysql-test/suite/perfschema/r/table_schema.result b/mysql-test/suite/perfschema/r/table_schema.result index 8b33d467163..50334091579 100644 --- a/mysql-test/suite/perfschema/r/table_schema.result +++ b/mysql-test/suite/perfschema/r/table_schema.result @@ -864,7 +864,7 @@ def performance_schema replication_applier_status_by_coordinator THREAD_ID 2 NUL def performance_schema replication_applier_status_by_coordinator SERVICE_STATE 3 NULL NO enum 3 9 NULL NULL NULL utf8mb3 utf8mb3_general_ci enum('ON','OFF') select,insert,update,references ON (thread exists and is active or idle) or OFF (thread no longer exists). NEVER NULL def performance_schema replication_applier_status_by_coordinator LAST_ERROR_NUMBER 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references Last error number that caused the SQL/coordinator thread to stop. NEVER NULL def performance_schema replication_applier_status_by_coordinator LAST_ERROR_MESSAGE 5 NULL NO varchar 1024 3072 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(1024) select,insert,update,references Last error message that caused the SQL/coordinator thread to stop. NEVER NULL -def performance_schema replication_applier_status_by_coordinator LAST_ERROR_TIMESTAMP 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references Timestamp that shows when the most recent SQL/coordinator error occured. NEVER NULL +def performance_schema replication_applier_status_by_coordinator LAST_ERROR_TIMESTAMP 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references Timestamp that shows when the most recent SQL/coordinator error occurred. NEVER NULL def performance_schema replication_applier_status_by_coordinator LAST_SEEN_TRANSACTION 7 NULL NO char 57 171 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(57) select,insert,update,references The transaction the worker has last seen. NEVER NULL def performance_schema replication_applier_status_by_coordinator LAST_TRANS_RETRY_COUNT 8 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references Total number of retries attempted by last transaction. NEVER NULL def performance_schema replication_applier_status_by_worker CHANNEL_NAME 1 NULL NO varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) select,insert,update,references Name of replication channel through which the transaction is received. NEVER NULL diff --git a/mysql-test/suite/rpl/r/rpl_mdev-11092.result b/mysql-test/suite/rpl/r/rpl_mdev-11092.result index b40f21e3b84..b38e5a18020 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev-11092.result +++ b/mysql-test/suite/rpl/r/rpl_mdev-11092.result @@ -1,7 +1,7 @@ include/master-slave.inc [connection master] call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*"); +call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*"); call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size.* "); call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.* "); call mtr.add_suppression("Incident event write to the binary log file failed"); diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.test b/mysql-test/suite/rpl/t/rpl_mdev-11092.test index 0c020386b98..fa8a685b1f5 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev-11092.test +++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.test @@ -7,7 +7,7 @@ ######################################################################################## call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*"); +call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*"); call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size.* "); call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.* "); call mtr.add_suppression("Incident event write to the binary log file failed"); diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff index a632e049c5e..bacc733e7fe 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff @@ -719,7 +719,7 @@ VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try agressively prune away the search space. + VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try aggressively prune away the search space. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 @@ -2304,17 +2304,17 @@ READ_ONLY NO diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index f896421559c..9eb21144742 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2295,7 +2295,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try agressively prune away the search space. +VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try aggressively prune away the search space. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 NUMERIC_BLOCK_SIZE 1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index 38dc9d215b8..9f4e2021015 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -719,7 +719,7 @@ VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try agressively prune away the search space. + VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try aggressively prune away the search space. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 @@ -2474,17 +2474,17 @@ READ_ONLY NO diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 23942418b07..f8ac3b545d8 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -1205,7 +1205,7 @@ COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME GTID_STRICT_MODE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Enforce strict seq_no ordering of events in the binary log. Slave stops with an error if it encounters an event that would cause it to generate an out-of-order binlog if executed. When ON the same server-id semisync-replicated transactions that duplicate exising ones in binlog are ignored without error and slave interruption. +VARIABLE_COMMENT Enforce strict seq_no ordering of events in the binary log. Slave stops with an error if it encounters an event that would cause it to generate an out-of-order binlog if executed. When ON the same server-id semisync-replicated transactions that duplicate existing ones in binlog are ignored without error and slave interruption. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -2465,7 +2465,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try agressively prune away the search space. +VARIABLE_COMMENT If the optimizer needs to enumerate join prefix of this size or larger, then it will try aggressively prune away the search space. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 62 NUMERIC_BLOCK_SIZE 1 diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test index 0720aca65b9..45432290f7a 100644 --- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test @@ -156,7 +156,7 @@ let $wait_condition= SELECT (dirty_pct() <= @@global.innodb_max_dirty_pages_pct) --source include/wait_condition.inc --echo 'We expect dirty pages pct to be BELOW_MAX after some time depending on performance' -# Value For $sucess will be set from include/wait_condition.inc file. It can have values 1 or 0. It will be 1 if dirty_pct() <= @@global.innodb_max_dirty_pages_pct else it will be 0. +# Value For $success will be set from include/wait_condition.inc file. It can have values 1 or 0. It will be 1 if dirty_pct() <= @@global.innodb_max_dirty_pages_pct else it will be 0. eval CALL check_pct($success); DROP PROCEDURE add_records; DROP PROCEDURE add_until; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index c5c683b6666..a366988009e 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -10250,7 +10250,7 @@ void ha_partition::print_error(int error, myf errflag) /* We choose a main handler's print_error if: * m_file has not been initialized, like in bug#42438 - * lookup_errkey is set, which means that an error has occured in the + * lookup_errkey is set, which means that an error has occurred in the main handler, not in individual partitions */ if (m_file && lookup_errkey == (uint)-1) diff --git a/sql/replication.h b/sql/replication.h index 49d896ff1a7..9a5254b490e 100644 --- a/sql/replication.h +++ b/sql/replication.h @@ -83,7 +83,7 @@ typedef struct Trans_observer { @param param The parameter for transaction observers - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_commit)(Trans_param *param); @@ -104,7 +104,7 @@ typedef struct Trans_observer { @note This hook is called wo/ any global mutex held - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_rollback)(Trans_param *param); @@ -151,7 +151,7 @@ typedef struct Binlog_storage_observer { @param log_pos Binlog position after update @param flags flags for binlog storage - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_flush)(Binlog_storage_param *param, @@ -171,7 +171,7 @@ typedef struct Binlog_storage_observer { @param log_pos Binlog position after update @param flags flags for binlog storage - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_sync)(Binlog_storage_param *param, @@ -201,7 +201,7 @@ typedef struct Binlog_transmit_observer { @param log_file Binlog file name to transmit from @param log_pos Binlog position to transmit from - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*transmit_start)(Binlog_transmit_param *param, @@ -212,7 +212,7 @@ typedef struct Binlog_transmit_observer { @param param Observer common parameter - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*transmit_stop)(Binlog_transmit_param *param); @@ -232,7 +232,7 @@ typedef struct Binlog_transmit_observer { @param size Size of the header buffer @param len Header length reserved by this observer - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*reserve_header)(Binlog_transmit_param *param, @@ -249,7 +249,7 @@ typedef struct Binlog_transmit_observer { @param log_file Binlog file name of the event packet to send @param log_pos Binlog position of the event packet to send - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*before_send_event)(Binlog_transmit_param *param, @@ -263,7 +263,7 @@ typedef struct Binlog_transmit_observer { @param event_buf Binlog event packet buffer sent @param len length of the event packet buffer - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_send_event)(Binlog_transmit_param *param, @@ -277,7 +277,7 @@ typedef struct Binlog_transmit_observer { @param param Observer common parameter - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_reset_master)(Binlog_transmit_param *param); @@ -320,7 +320,7 @@ typedef struct Binlog_relay_IO_observer { @param param Observer common parameter - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*thread_start)(Binlog_relay_IO_param *param); @@ -330,7 +330,7 @@ typedef struct Binlog_relay_IO_observer { @param param Observer common parameter - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*thread_stop)(Binlog_relay_IO_param *param); @@ -344,7 +344,7 @@ typedef struct Binlog_relay_IO_observer { @param param Observer common parameter @param flags binlog dump flags - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*before_request_transmit)(Binlog_relay_IO_param *param, uint32 flags); @@ -358,7 +358,7 @@ typedef struct Binlog_relay_IO_observer { @param event_buf The event packet return after process @param event_len The length of event packet return after process - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_read_event)(Binlog_relay_IO_param *param, @@ -373,7 +373,7 @@ typedef struct Binlog_relay_IO_observer { @param event_len Length of the event packet written to relay log @param flags flags for relay log - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_queue_event)(Binlog_relay_IO_param *param, @@ -385,7 +385,7 @@ typedef struct Binlog_relay_IO_observer { @param param Observer common parameter - @retval 0 Sucess + @retval 0 Success @retval 1 Failure */ int (*after_reset_slave)(Binlog_relay_IO_param *param); @@ -398,7 +398,7 @@ typedef struct Binlog_relay_IO_observer { @param observer The transaction observer to register @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer already exists */ int register_trans_observer(Trans_observer *observer, void *p); @@ -409,7 +409,7 @@ int register_trans_observer(Trans_observer *observer, void *p); @param observer The transaction observer to unregister @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer not exists */ int unregister_trans_observer(Trans_observer *observer, void *p); @@ -420,7 +420,7 @@ int unregister_trans_observer(Trans_observer *observer, void *p); @param observer The binlog storage observer to register @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer already exists */ int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p); @@ -431,7 +431,7 @@ int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p) @param observer The binlog storage observer to unregister @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer not exists */ int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void *p); @@ -442,7 +442,7 @@ int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void * @param observer The binlog transmit observer to register @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer already exists */ int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p); @@ -453,7 +453,7 @@ int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void * @param observer The binlog transmit observer to unregister @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer not exists */ int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p); @@ -464,7 +464,7 @@ int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void @param observer The binlog relay IO observer to register @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer already exists */ int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p); @@ -475,7 +475,7 @@ int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void * @param observer The binlog relay IO observer to unregister @param p pointer to the internal plugin structure - @retval 0 Sucess + @retval 0 Success @retval 1 Observer not exists */ int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 35bdd4f9f1c..d24c8067b78 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1356,7 +1356,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) /* Cursors will use thd->packet, so they may corrupt data which was prepared for sending by upper level. OTOH cursors in the same routine can share this - buffer safely so let use use routine-local packet instead of having own + buffer safely so let use routine-local packet instead of having own packet buffer for each cursor. It is probably safe to use same thd->convert_buff everywhere. diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index d31d0b949ba..9236ced8fe3 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1602,7 +1602,7 @@ int multi_delete::do_table_deletes(TABLE *table, SORT_INFO *sort_info, /* Send ok to the client - return: 0 sucess + return: 0 success 1 error */ diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index ba9a370a068..c1e618ee5f5 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4441,7 +4441,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index, RETURN VALUE TRUE Error - FALSE Sucess + FALSE Success DESCRIPTION Read the partition syntax from the current position in the frm file. diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index c0df15ea4ad..a0e6a89a1ca 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -373,7 +373,7 @@ class Basic_stats_collector { ulonglong count; /* number of values retrieved */ ulonglong count_distinct; /* number of distinct values retrieved */ - /* number of distinct values that occured only once */ + /* number of distinct values that occurred only once */ ulonglong count_distinct_single_occurence; public: diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 1ed3d61bcf8..b1d2b4919f2 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2063,7 +2063,7 @@ Sys_gtid_strict_mode( "stops with an error if it encounters an event that would cause it to " "generate an out-of-order binlog if executed. " "When ON the same server-id semisync-replicated transactions that " - "duplicate exising ones in binlog are ignored without error " + "duplicate existing ones in binlog are ignored without error " "and slave interruption.", GLOBAL_VAR(opt_gtid_strict_mode), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); @@ -2828,7 +2828,7 @@ static Sys_var_ulong Sys_optimizer_search_depth( static Sys_var_ulong Sys_optimizer_extra_pruning_depth( "optimizer_extra_pruning_depth", "If the optimizer needs to enumerate join prefix of this size or " - "larger, then it will try agressively prune away the search space.", + "larger, then it will try aggressively prune away the search space.", SESSION_VAR(optimizer_extra_pruning_depth), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, MAX_TABLES+1), DEFAULT(8), BLOCK_SIZE(1)); diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index b38168622e9..e75e2006905 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -336,7 +336,7 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) // Do make the table/view definition if (Tdp && Tdp->Define(g, Cat, Name, Schema, "REST")) - Tdp = NULL; // Error occured + Tdp = NULL; // Error occurred if (xt) htrc("Tdp defined\n", rc); diff --git a/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js index 75ce2617772..b6624f31b0d 100644 --- a/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js +++ b/storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-1.7.2.js @@ -2338,7 +2338,7 @@ jQuery.fn.extend({ classNames = value.split( rspace ); while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list + // check each className given, space separated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } diff --git a/storage/perfschema/table_replication_applier_status_by_coordinator.cc b/storage/perfschema/table_replication_applier_status_by_coordinator.cc index 91821eeb979..c795cdb6624 100644 --- a/storage/perfschema/table_replication_applier_status_by_coordinator.cc +++ b/storage/perfschema/table_replication_applier_status_by_coordinator.cc @@ -65,7 +65,7 @@ table_replication_applier_status_by_coordinator::m_share= "SERVICE_STATE ENUM('ON','OFF') not null comment 'ON (thread exists and is active or idle) or OFF (thread no longer exists).'," "LAST_ERROR_NUMBER INTEGER not null comment 'Last error number that caused the SQL/coordinator thread to stop.'," "LAST_ERROR_MESSAGE VARCHAR(1024) not null comment 'Last error message that caused the SQL/coordinator thread to stop.'," - "LAST_ERROR_TIMESTAMP TIMESTAMP(0) not null comment 'Timestamp that shows when the most recent SQL/coordinator error occured.'," + "LAST_ERROR_TIMESTAMP TIMESTAMP(0) not null comment 'Timestamp that shows when the most recent SQL/coordinator error occurred.'," "LAST_SEEN_TRANSACTION CHAR(57) not null comment 'The transaction the worker has last seen.'," "LAST_TRANS_RETRY_COUNT INTEGER not null comment 'Total number of retries attempted by last transaction.')") }, false, /* m_perpetual */ diff --git a/vio/viossl.c b/vio/viossl.c index 94c4bcb46cf..6fdebca1874 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -145,7 +145,7 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event @param[in] ret return from the failed IO operation @return 0 - should retry last read/write operation - 1 - some error has occured + 1 - some error has occurred */ static int handle_ssl_io_error(Vio *vio, int ret) { From 07460c31e30cc1f6b56dab6e9a54a7618e26050b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 24 Mar 2023 07:59:27 +0200 Subject: [PATCH 07/14] MDEV-30900 Crash on macOS due to zero-initialized buf_dblwr.write_cond buf_dblwr_t::init(), buf_dblwr_t::close(): Cover also write_cond, which was added in commit a55b951e6082a4ce9a1f2ed5ee176ea7dbbaf1f2 without explicit initialization. On GNU/Linux, PTHREAD_COND_INITIALIZER is a zero-initializer. That is why the default zero initialization happened to work on that platform. --- storage/innobase/buf/buf0dblwr.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 72b1ba5ca2b..c3f221c6f61 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -53,6 +53,7 @@ void buf_dblwr_t::init() active_slot= &slots[0]; mysql_mutex_init(buf_dblwr_mutex_key, &mutex, nullptr); pthread_cond_init(&cond, nullptr); + pthread_cond_init(&write_cond, nullptr); } } @@ -468,6 +469,7 @@ void buf_dblwr_t::close() ut_ad(!batch_running); pthread_cond_destroy(&cond); + pthread_cond_destroy(&write_cond); for (int i= 0; i < 2; i++) { aligned_free(slots[i].write_buf); From e06c6046d25052d8ad7a8c1f72ea666bc983c674 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 24 Mar 2023 15:20:21 +0530 Subject: [PATCH 08/14] MDEV-29545 InnoDB: Can't find record during replace stmt Problem: ======== - InnoDB replace statement returns can't find record as result during bulk insert operation. InnoDB returns DB_END_OF_INDEX blindly when bulk transaction is visible to current transaction even though the search tuple is inserted as a part of current replace statement. Solution: ========= row_search_mvcc(): InnoDB should allow the transaction to read all the rows when innodb intends to do any locking on the record even though bulk insert transaction changes are visible to the current transaction --- .../suite/innodb/r/insert_into_empty.result | 22 +++++++++++++++++++ .../suite/innodb/t/insert_into_empty.test | 22 +++++++++++++++++++ storage/innobase/row/row0sel.cc | 6 ++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index 25cc489bdab..ef7d015f7f3 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -229,4 +229,26 @@ commit; SELECT * FROM t; c DROP TABLE t; +# +# MDEV-29545 InnoDB: Can't find record during replace stmt +# +CREATE TABLE t1(c1 INT PRIMARY KEY)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(3331); +connect con1,localhost,root,,,; +BEGIN; +SELECT c1 FROM t1; +c1 +connection default; +COMMIT; +connection con1; +REPLACE INTO t1 VALUES(1984), (1984); +COMMIT; +connection default; +disconnect con1; +SELECT * FROM t1; +c1 +1984 +3331 +DROP TABLE t1; # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index 932ab4c2a23..010b7ecb43a 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -247,4 +247,26 @@ SAVEPOINT a; commit; SELECT * FROM t; DROP TABLE t; + +--echo # +--echo # MDEV-29545 InnoDB: Can't find record during replace stmt +--echo # +CREATE TABLE t1(c1 INT PRIMARY KEY)ENGINE=InnoDB; +BEGIN; +INSERT INTO t1 VALUES(3331); + +connect(con1,localhost,root,,,); +BEGIN; +SELECT c1 FROM t1; + +connection default; +COMMIT; + +connection con1; +REPLACE INTO t1 VALUES(1984), (1984); +COMMIT; +connection default; +disconnect con1; +SELECT * FROM t1; +DROP TABLE t1; --echo # End of 10.6 tests diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index e44cc466295..d1d264a7e8a 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -4892,7 +4892,11 @@ page_corrupted: if (trx->isolation_level == TRX_ISO_READ_UNCOMMITTED || !trx->read_view.is_open()) { } else if (trx_id_t bulk_trx_id = index->table->bulk_trx_id) { - if (!trx->read_view.changes_visible(bulk_trx_id)) { + /* InnoDB should allow the transaction to read all + the rows when InnoDB intends to do any locking + on the record */ + if (prebuilt->select_lock_type == LOCK_NONE + && !trx->read_view.changes_visible(bulk_trx_id)) { trx->op_info = ""; err = DB_END_OF_INDEX; goto normal_return; From 216d99bb395c4fda43b4e3583672ef925103fae5 Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 24 Mar 2023 11:25:14 +0200 Subject: [PATCH 09/14] =?UTF-8?q?MDEV-26071:=20rpl.rpl=5Fperfschema=5Fappl?= =?UTF-8?q?ier=5Fstatus=5Fby=5Fworker=20failed=20in=20bb=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …with: Test assertion failed Problem: ======= Assertion text: 'Value returned by SSS and PS table for Last_Error_Number should be same.' Assertion condition: '"1146" = "0"' Assertion condition, interpolated: '"1146" = "0"' Assertion result: '0' Analysis: ======== In parallel replication when slave is started the worker pool gets activated and it gets cleared when slave stops. Each time the worker pool gets activated a backup worker pool also gets created to store worker specific perforance schema information in case of errors. On error, all relevant information is copied from rpl_parallel_thread to rli and it gets cleared from thread. Then server waits for all workers to complete their work, during this stage performance schema table specific worker info is stored into the backup pool and finally the actual pool gets cleared. If users query the performance schema table to know the status of workers the information from backup pool will be used. The test simulates ER_NO_SUCH_TABLE error and verifies the worker information in pfs table. Test works fine if execution occurs in following order. Step 1. Error occurred 'worker information is copied to backup pool'. Step 2. handle_slave_sql invokes 'rpl_parallel_resize_pool_if_no_slaves' to deactivate worker pool, it marks the pool->count=0 Step 3. PFS table is queried, since actual pool is deactivated backup pool information is read. If the Step 3 happens prior to Step2 the pool is yet to be deactivated and the actual pool is read, which doesn't have any error details as they were cleared. Hence test ocasionally fails. Fix: === Upon error mark the back pool as being active so that if PFS table is quried since the backup pool is flagged as valid its information will be read, in case it is not flagged regular pool will be read. This work is one of the last pieces created by the late Sujatha Sivakumar. --- sql/rpl_parallel.cc | 4 +- sql/rpl_parallel.h | 3 +- ...le_replication_applier_status_by_worker.cc | 49 +++++++++---------- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index a96f63039e2..05c6773c470 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -1781,6 +1781,7 @@ rpl_parallel_activate_pool(rpl_parallel_thread_pool *pool) } else bkp->init(pool->count); + bkp->is_valid= false; // Mark backup as stale during pool init } } @@ -2050,7 +2051,7 @@ rpl_parallel_thread::rpl_parallel_thread() rpl_parallel_thread_pool::rpl_parallel_thread_pool() : threads(0), free_list(0), count(0), inited(false), busy(false), - pfs_bkp{0, false, NULL} + pfs_bkp{0, false, false, NULL} { } @@ -2179,6 +2180,7 @@ rpl_parallel_thread_pool::copy_pool_for_pfs(Relay_log_info *rli) pfs_rpt->worker_idle_time= rpt->get_worker_idle_time(); pfs_rpt->last_trans_retry_count= rpt->last_trans_retry_count; } + pfs_bkp.is_valid= true; } } diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index d3c46301ff8..85aa8ca33c8 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -260,7 +260,7 @@ struct rpl_parallel_thread { struct pool_bkp_for_pfs{ uint32 count; - bool inited; + bool inited, is_valid; struct rpl_parallel_thread **rpl_thread_arr; void init(uint32 thd_count) { @@ -287,6 +287,7 @@ struct pool_bkp_for_pfs{ my_free(rpl_thread_arr); rpl_thread_arr= NULL; } + inited= false; } }; diff --git a/storage/perfschema/table_replication_applier_status_by_worker.cc b/storage/perfschema/table_replication_applier_status_by_worker.cc index 1ccf75e5d25..e982b5203ec 100644 --- a/storage/perfschema/table_replication_applier_status_by_worker.cc +++ b/storage/perfschema/table_replication_applier_status_by_worker.cc @@ -100,72 +100,67 @@ ha_rows table_replication_applier_status_by_worker::get_row_count() int table_replication_applier_status_by_worker::rnd_next(void) { rpl_parallel_thread_pool *pool= &global_rpl_thread_pool; - if (pool->inited && pool->count) + struct pool_bkp_for_pfs *bkp_pool= &pool->pfs_bkp; + mysql_mutex_lock(&pool->LOCK_rpl_thread_pool); + if (bkp_pool->inited && bkp_pool->count && bkp_pool->is_valid) { - mysql_mutex_lock(&pool->LOCK_rpl_thread_pool); - uint worker_count= pool->count; for (m_pos.set_at(&m_next_pos); - m_pos.has_more_workers(worker_count); + m_pos.has_more_workers(bkp_pool->count); m_pos.next_worker()) { - rpl_parallel_thread *rpt= pool->threads[m_pos.m_index]; + rpl_parallel_thread *rpt= bkp_pool->rpl_thread_arr[m_pos.m_index]; make_row(rpt); m_next_pos.set_after(&m_pos); mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool); return 0; } - mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool); } else { - mysql_mutex_lock(&pool->LOCK_rpl_thread_pool); - struct pool_bkp_for_pfs *bkp_pool= &pool->pfs_bkp; - if (bkp_pool->inited && bkp_pool->count) + if (pool->inited && pool->count) { + uint worker_count= pool->count; for (m_pos.set_at(&m_next_pos); - m_pos.has_more_workers(bkp_pool->count); - m_pos.next_worker()) + m_pos.has_more_workers(worker_count); + m_pos.next_worker()) { - rpl_parallel_thread *rpt= bkp_pool->rpl_thread_arr[m_pos.m_index]; + rpl_parallel_thread *rpt= pool->threads[m_pos.m_index]; make_row(rpt); m_next_pos.set_after(&m_pos); mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool); return 0; } } - mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool); } + mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool); return HA_ERR_END_OF_FILE; } int table_replication_applier_status_by_worker::rnd_pos(const void *pos) { int res= HA_ERR_RECORD_DELETED; + rpl_parallel_thread_pool *pool= &global_rpl_thread_pool; + struct pool_bkp_for_pfs *bkp_pool= &pool->pfs_bkp; set_position(pos); - - if (global_rpl_thread_pool.inited && global_rpl_thread_pool.count) + mysql_mutex_lock(&pool->LOCK_rpl_thread_pool); + if (bkp_pool->inited && bkp_pool->count && bkp_pool->is_valid + && m_pos.m_index < bkp_pool->count) { - rpl_parallel_thread_pool *pool= &global_rpl_thread_pool; - mysql_mutex_lock(&pool->LOCK_rpl_thread_pool); - if(m_pos.m_index < pool->count) - { - rpl_parallel_thread *rpt= pool->threads[m_pos.m_index]; - make_row(rpt); - mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool); - res= 0; - } + rpl_parallel_thread *rpt= bkp_pool->rpl_thread_arr[m_pos.m_index]; + make_row(rpt); + res= 0; } else { - struct pool_bkp_for_pfs *bkp_pool= &global_rpl_thread_pool.pfs_bkp; - if (bkp_pool->inited && bkp_pool->count && m_pos.m_index < bkp_pool->count) + if (pool->inited && pool->count && m_pos.m_index < pool->count) { - rpl_parallel_thread *rpt= bkp_pool->rpl_thread_arr[m_pos.m_index]; + rpl_parallel_thread *rpt= pool->threads[m_pos.m_index]; make_row(rpt); res= 0; } } + mysql_mutex_unlock(&pool->LOCK_rpl_thread_pool); return res; } From d9808f79de992964ed802d27984c9031d72e7b9a Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Sun, 19 Mar 2023 02:57:39 +0200 Subject: [PATCH 10/14] MDEV-19629: format_pico_time implementation --- libmysqld/CMakeLists.txt | 2 +- .../suite/perfschema/r/pfs_functions.result | 213 ++++++++++++++++++ .../suite/perfschema/t/pfs_functions.test | 120 ++++++++++ sql/CMakeLists.txt | 2 +- sql/item.h | 1 + sql/item_create.cc | 23 ++ sql/item_pfsfunc.cc | 135 +++++++++++ sql/item_pfsfunc.h | 54 +++++ 8 files changed, 548 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/perfschema/r/pfs_functions.result create mode 100644 mysql-test/suite/perfschema/t/pfs_functions.test create mode 100644 sql/item_pfsfunc.cc create mode 100644 sql/item_pfsfunc.h diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 5d5cc35e1be..8727aa54992 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -64,7 +64,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/item.cc ../sql/item_create.cc ../sql/item_func.cc ../sql/item_geofunc.cc ../sql/item_row.cc ../sql/item_strfunc.cc ../sql/item_subselect.cc ../sql/item_sum.cc ../sql/item_timefunc.cc - ../sql/item_xmlfunc.cc ../sql/item_jsonfunc.cc + ../sql/item_xmlfunc.cc ../sql/item_jsonfunc.cc ../sql/item_pfsfunc.cc ../sql/key.cc ../sql/lock.cc ../sql/log.cc ../sql/log_event.cc ../sql/log_event_server.cc ../sql/mf_iocache.cc ../sql/my_decimal.cc diff --git a/mysql-test/suite/perfschema/r/pfs_functions.result b/mysql-test/suite/perfschema/r/pfs_functions.result new file mode 100644 index 00000000000..322f64c1ce7 --- /dev/null +++ b/mysql-test/suite/perfschema/r/pfs_functions.result @@ -0,0 +1,213 @@ +# MDEV-19629: Implement MySQL 8.0 native functions: format_bytes(), format_pico_time() and ps_thread_id() +# +# Tests for the Performance Schema native function format_pico_time() +# + +SELECT format_pico_time(NULL); +format_pico_time(NULL) +NULL + +SELECT format_pico_time(0); +format_pico_time(0) + 0 ps + +SELECT format_pico_time(1); +format_pico_time(1) + 1 ps + +SELECT format_pico_time(999); +format_pico_time(999) +999 ps + +SELECT format_pico_time(1000); +format_pico_time(1000) +1.00 ns + +SELECT format_pico_time(1001); +format_pico_time(1001) +1.00 ns + +SELECT format_pico_time(999999); +format_pico_time(999999) +1000.00 ns + +SELECT format_pico_time(1000000); +format_pico_time(1000000) +1.00 us + +SELECT format_pico_time(1000001); +format_pico_time(1000001) +1.00 us + +SELECT format_pico_time(1010000); +format_pico_time(1010000) +1.01 us + +SELECT format_pico_time(987654321); +format_pico_time(987654321) +987.65 us + +SELECT format_pico_time(1000000000); +format_pico_time(1000000000) +1.00 ms + +SELECT format_pico_time(999876000000); +format_pico_time(999876000000) +999.88 ms + +SELECT format_pico_time(999999999999); +format_pico_time(999999999999) +1000.00 ms + +SELECT format_pico_time(1000000000000); +format_pico_time(1000000000000) +1.00 s + +SELECT format_pico_time(59000000000000); +format_pico_time(59000000000000) +59.00 s + +SELECT format_pico_time(60000000000000); +format_pico_time(60000000000000) +1.00 min + +SELECT format_pico_time(3549000000000000); +format_pico_time(3549000000000000) +59.15 min + +SELECT format_pico_time(3599000000000000); +format_pico_time(3599000000000000) +59.98 min + +SELECT format_pico_time(3600000000000000); +format_pico_time(3600000000000000) +1.00 h + +SELECT format_pico_time(power(2, 63)); +format_pico_time(power(2, 63)) +106.75 d + +SELECT format_pico_time((power(2, 63) - 1) * 2 + 1); +format_pico_time((power(2, 63) - 1) * 2 + 1) +213.50 d + +SELECT format_pico_time(36000000.495523); +format_pico_time(36000000.495523) +36.00 us + +SELECT format_pico_time(1000 * pow(10,12) * 86400); +format_pico_time(1000 * pow(10,12) * 86400) +1000.00 d + +SELECT format_pico_time(86400000000000000000); +format_pico_time(86400000000000000000) +1000.00 d + +SELECT format_pico_time(86400000000000000000+5000); +format_pico_time(86400000000000000000+5000) +1000.00 d + +## Negative values are ok +SELECT format_pico_time(1010000 * -1); +format_pico_time(1010000 * -1) +-1.01 us + +## Force exponent +SELECT format_pico_time(8650000000000000000099); +format_pico_time(8650000000000000000099) +1.00e+05 d + +SELECT format_pico_time(-8650000000000000000099); +format_pico_time(-8650000000000000000099) +-1.00e+05 d + +SELECT format_pico_time(8640000000000000000099 * 2); +format_pico_time(8640000000000000000099 * 2) +2.00e+05 d + + +## Text input +SELECT format_pico_time("foo"); +format_pico_time("foo") + 0 ps +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'foo' + +SELECT format_pico_time(""); +format_pico_time("") + 0 ps +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' + +SELECT format_pico_time("118059162071741143500099"); +format_pico_time("118059162071741143500099") +1.37e+06 d + +SELECT format_pico_time("-118059162071741143500099"); +format_pico_time("-118059162071741143500099") +-1.37e+06 d + +## Recognizes up to first non-numeric +SELECT format_pico_time("40000 * 2000"); +format_pico_time("40000 * 2000") +40.00 ns +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '40000 * 2000' + +SELECT format_pico_time("40000 foo 2000"); +format_pico_time("40000 foo 2000") +40.00 ns +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '40000 foo 2000' +## Aggregate functions +USE test; + +CREATE TABLE timer_waits (id VARCHAR(10), wait BIGINT UNSIGNED DEFAULT NULL) DEFAULT CHARSET = utf8mb4; + +INSERT INTO timer_waits VALUES ('1 sec', 1000000000000); +INSERT INTO timer_waits VALUES ('1 min', 60000000000000); +INSERT INTO timer_waits VALUES ('1 hour', 3600000000000000); +INSERT INTO timer_waits VALUES ('1 day', 86400000000000000); +INSERT INTO timer_waits VALUES ('100 days', 8640000000000000000); + +SELECT id, format_pico_time(wait), wait FROM timer_waits; +id format_pico_time(wait) wait +1 sec 1.00 s 1000000000000 +1 min 1.00 min 60000000000000 +1 hour 1.00 h 3600000000000000 +1 day 1.00 d 86400000000000000 +100 days 100.00 d 8640000000000000000 + +SELECT sum(wait), format_pico_time(sum(wait)) FROM timer_waits; +sum(wait) format_pico_time(sum(wait)) +8730061000000000000 101.04 d + +SELECT avg(wait), format_pico_time(avg(wait)) FROM timer_waits; +avg(wait) format_pico_time(avg(wait)) +1746012200000000000.0000 20.21 d + +SELECT min(wait), format_pico_time(min(wait)) FROM timer_waits; +min(wait) format_pico_time(min(wait)) +1000000000000 1.00 s + +SELECT max(wait), format_pico_time(max(wait)) FROM timer_waits; +max(wait) format_pico_time(max(wait)) +8640000000000000000 100.00 d + +DROP TABLE timer_waits; +## Using Scientific Notation +SELECT format_pico_time(3e9); +format_pico_time(3e9) +3.00 ms + +SELECT format_pico_time(4e6); +format_pico_time(4e6) +4.00 us + +SELECT format_pico_time(5e3); +format_pico_time(5e3) +5.00 ns + +SELECT format_pico_time(6e2); +format_pico_time(6e2) +600 ps diff --git a/mysql-test/suite/perfschema/t/pfs_functions.test b/mysql-test/suite/perfschema/t/pfs_functions.test new file mode 100644 index 00000000000..a175d3edeea --- /dev/null +++ b/mysql-test/suite/perfschema/t/pfs_functions.test @@ -0,0 +1,120 @@ +# Testcases for PFS functions are backported from MySQL + +--echo # MDEV-19629: Implement MySQL 8.0 native functions: format_bytes(), format_pico_time() and ps_thread_id() +--echo # +--echo # Tests for the Performance Schema native function format_pico_time() +--echo # +--echo + +SELECT format_pico_time(NULL); +--echo +SELECT format_pico_time(0); +--echo +SELECT format_pico_time(1); +--echo +SELECT format_pico_time(999); +--echo +SELECT format_pico_time(1000); +--echo +SELECT format_pico_time(1001); +--echo +SELECT format_pico_time(999999); +--echo +SELECT format_pico_time(1000000); +--echo +SELECT format_pico_time(1000001); +--echo +SELECT format_pico_time(1010000); +--echo +SELECT format_pico_time(987654321); +--echo +SELECT format_pico_time(1000000000); +--echo +SELECT format_pico_time(999876000000); +--echo +SELECT format_pico_time(999999999999); +--echo +SELECT format_pico_time(1000000000000); +--echo +SELECT format_pico_time(59000000000000); +--echo +SELECT format_pico_time(60000000000000); +--echo +SELECT format_pico_time(3549000000000000); +--echo +SELECT format_pico_time(3599000000000000); +--echo +SELECT format_pico_time(3600000000000000); +--echo +SELECT format_pico_time(power(2, 63)); +--echo +SELECT format_pico_time((power(2, 63) - 1) * 2 + 1); +--echo +SELECT format_pico_time(36000000.495523); +--echo +SELECT format_pico_time(1000 * pow(10,12) * 86400); +--echo +SELECT format_pico_time(86400000000000000000); +--echo +SELECT format_pico_time(86400000000000000000+5000); + +--echo +--echo ## Negative values are ok +SELECT format_pico_time(1010000 * -1); + +--echo +--echo ## Force exponent +SELECT format_pico_time(8650000000000000000099); +--echo +SELECT format_pico_time(-8650000000000000000099); +--echo +SELECT format_pico_time(8640000000000000000099 * 2); +--echo + +--echo +--echo ## Text input +SELECT format_pico_time("foo"); +--echo +SELECT format_pico_time(""); +--echo +SELECT format_pico_time("118059162071741143500099"); +--echo +SELECT format_pico_time("-118059162071741143500099"); +--echo +--echo ## Recognizes up to first non-numeric +SELECT format_pico_time("40000 * 2000"); +--echo +SELECT format_pico_time("40000 foo 2000"); + +--echo ## Aggregate functions +USE test; +--echo +CREATE TABLE timer_waits (id VARCHAR(10), wait BIGINT UNSIGNED DEFAULT NULL) DEFAULT CHARSET = utf8mb4; +--echo +# Max BIGINT unsigned is 18 446 744 073 709 551 615 +INSERT INTO timer_waits VALUES ('1 sec', 1000000000000); +INSERT INTO timer_waits VALUES ('1 min', 60000000000000); +INSERT INTO timer_waits VALUES ('1 hour', 3600000000000000); +INSERT INTO timer_waits VALUES ('1 day', 86400000000000000); +INSERT INTO timer_waits VALUES ('100 days', 8640000000000000000); +--echo +SELECT id, format_pico_time(wait), wait FROM timer_waits; +--echo +SELECT sum(wait), format_pico_time(sum(wait)) FROM timer_waits; +--echo +SELECT avg(wait), format_pico_time(avg(wait)) FROM timer_waits; +--echo +SELECT min(wait), format_pico_time(min(wait)) FROM timer_waits; +--echo +SELECT max(wait), format_pico_time(max(wait)) FROM timer_waits; +--echo +DROP TABLE timer_waits; + +--echo ## Using Scientific Notation +SELECT format_pico_time(3e9); +--echo +SELECT format_pico_time(4e6); +--echo +SELECT format_pico_time(5e3); +--echo +SELECT format_pico_time(6e2); diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 4938f8da02b..be0e2d214e0 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -104,7 +104,7 @@ SET (SQL_SOURCE handler.cc hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc item_create.cc item_func.cc item_geofunc.cc item_row.cc - item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc + item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc item_pfsfunc.cc key.cc log.cc lock.cc log_event.cc log_event_server.cc rpl_record.cc rpl_reporting.cc diff --git a/sql/item.h b/sql/item.h index 5956b810d51..515a9abb310 100644 --- a/sql/item.h +++ b/sql/item.h @@ -6371,6 +6371,7 @@ public: #include "item_jsonfunc.h" #include "item_create.h" #include "item_vers.h" +#include "item_pfsfunc.h" #endif /** diff --git a/sql/item_create.cc b/sql/item_create.cc index 0e2bcc7b1be..dc8359346a0 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -761,6 +761,19 @@ protected: }; +class Create_func_format_pico_time : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_format_pico_time s_singleton; + +protected: + Create_func_format_pico_time() = default; + virtual ~Create_func_format_pico_time() = default; +}; + + class Create_func_format : public Create_native_func { public: @@ -3570,6 +3583,15 @@ Create_func_floor::create_1_arg(THD *thd, Item *arg1) } +Create_func_format_pico_time Create_func_format_pico_time::s_singleton; + +Item* +Create_func_format_pico_time::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_pfs_format_pico_time(thd, arg1); +} + + Create_func_format Create_func_format::s_singleton; Item* @@ -5762,6 +5784,7 @@ Native_func_registry func_array[] = { { STRING_WITH_LEN("FIELD") }, BUILDER(Create_func_field)}, { { STRING_WITH_LEN("FIND_IN_SET") }, BUILDER(Create_func_find_in_set)}, { { STRING_WITH_LEN("FLOOR") }, BUILDER(Create_func_floor)}, + { { STRING_WITH_LEN("FORMAT_PICO_TIME") }, BUILDER(Create_func_format_pico_time)}, { { STRING_WITH_LEN("FORMAT") }, BUILDER(Create_func_format)}, { { STRING_WITH_LEN("FOUND_ROWS") }, BUILDER(Create_func_found_rows)}, { { STRING_WITH_LEN("FROM_BASE64") }, BUILDER(Create_func_from_base64)}, diff --git a/sql/item_pfsfunc.cc b/sql/item_pfsfunc.cc new file mode 100644 index 00000000000..8ac7df50866 --- /dev/null +++ b/sql/item_pfsfunc.cc @@ -0,0 +1,135 @@ +/* Copyright (c) 2000, 2023, Oracle and/or its affiliates. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License, version 2.0, + as published by the Free Software Foundation. + + This program is also distributed with certain software (including + but not limited to OpenSSL) that is licensed under separate terms, + as designated in a particular file or component or in included license + documentation. The authors of MySQL hereby grant you an additional + permission to link the program and your derivative works with the + separately licensed software that they have included with MySQL. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License, version 2.0, for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + @file + + @brief + This file defines all performance schema native functions + FORMAT_PICO_TIME() +*/ + +#ifdef USE_PRAGMA_IMPLEMENTATION +#pragma implementation // gcc: Class implementation +#endif + +#include "mariadb.h" // HAVE_* + +/* + It is necessary to include set_var.h instead of item.h because there + are dependencies on include order for set_var.h and item.h. This + will be resolved later. +*/ +#include "set_var.h" + +/** format_pico_time() */ + +bool Item_func_pfs_format_pico_time::fix_length_and_dec(THD *) +{ + set_maybe_null(); + /* Format is 'AAAA.BB UUU' = 11 characters or 'AAA ps' = 6 characters. */ + m_value.set_charset(&my_charset_utf8mb3_general_ci); + return false; +} + + +String *Item_func_pfs_format_pico_time::val_str(String *str __attribute__ ((__unused__))) +{ + /* Evaluate the argument */ + double time_val= args[0]->val_real(); + + /* If argument is null, return null. */ + null_value= args[0]->null_value; + if (null_value) + return 0; + + constexpr uint64_t nano{1000}; + constexpr uint64_t micro{1000 * nano}; + constexpr uint64_t milli{1000 * micro}; + constexpr uint64_t sec{1000 * milli}; + constexpr uint64_t min{60 * sec}; + constexpr uint64_t hour{60 * min}; + constexpr uint64_t day{24 * hour}; + + /* Declaring 'volatile' as workaround for 32-bit optimization bug. */ + volatile double time_abs= abs(time_val); + + uint64_t divisor; + int len; + const char *unit; + + /* SI-approved time units. */ + if (time_abs >= day) + { + divisor= day; + unit= "d"; + } + else if (time_abs >= hour) + { + divisor= hour; + unit= "h"; + } + else if (time_abs >= min) + { + divisor= min; + unit= "min"; + } + else if (time_abs >= sec) + { + divisor= sec; + unit= "s"; + } + else if (time_abs >= milli) + { + divisor= milli; + unit= "ms"; + } + else if (time_abs >= micro) + { + divisor= micro; + unit= "us"; + } + else if (time_abs >= nano) + { + divisor= nano; + unit= "ns"; + } + else + { + divisor= 1; + unit= "ps"; + } + + if (divisor == 1) + len= snprintf(m_value_buffer, sizeof(m_value_buffer), "%3d %s", (int)time_val, unit); + else + { + double value= time_val / divisor; + if (abs(value) >= 100000.0) + len= snprintf(m_value_buffer, sizeof(m_value_buffer), "%4.2e %s", value, unit); + else + len= snprintf(m_value_buffer, sizeof(m_value_buffer), "%4.2f %s", value, unit); + } + + m_value.set(m_value_buffer, len, &my_charset_utf8mb3_general_ci); + return &m_value; +} diff --git a/sql/item_pfsfunc.h b/sql/item_pfsfunc.h new file mode 100644 index 00000000000..ee3c111e15c --- /dev/null +++ b/sql/item_pfsfunc.h @@ -0,0 +1,54 @@ +#ifndef ITEM_PFS_FUNC_INCLUDED +#define ITEM_PFS_FUNC_INCLUDED + +/* Copyright (c) 2000, 2023, Oracle and/or its affiliates. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License, version 2.0, + as published by the Free Software Foundation. + + This program is also distributed with certain software (including + but not limited to OpenSSL) that is licensed under separate terms, + as designated in a particular file or component or in included license + documentation. The authors of MySQL hereby grant you an additional + permission to link the program and your derivative works with the + separately licensed software that they have included with MySQL. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License, version 2.0, for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif + +#include "item_func.h" // Item_str_func, Item_int_func + +/** format_pico_time() */ + +class Item_func_pfs_format_pico_time : public Item_str_func { + String m_value; + char m_value_buffer[12]; + +public: + Item_func_pfs_format_pico_time(THD *thd, Item *a) + : Item_str_func(thd, a){}; + String *val_str(String *str __attribute__ ((__unused__))) override; + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("format_pico_time")}; + return name; + } + bool fix_length_and_dec(THD *thd) override; + Item *get_copy(THD *thd) override + { + return get_item_copy(thd, this); + } +}; + +#endif From c2b69163934016afa4bb3b274cddaacec92fcb61 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 27 Mar 2023 18:50:49 +0200 Subject: [PATCH 11/14] MDEV-19629 post-merge fixes * it isn't "pfs" function, don't call it Item_func_pfs, don't use item_pfsfunc.* * tests don't depend on performance schema, put in the main suite * inherit from Item_str_ascii_func * use connection collation, not utf8mb3_general_ci * set result length in fix_length_and_dec * do not set maybe_null * use my_snprintf() where possible * don't set m_value.ptr on every invocation * update sys schema to use the format_pico_time() * len must be size_t (compilation error on Windows) * the correct function name for double->double is fabs() * drop volatile hack --- libmysqld/CMakeLists.txt | 2 +- .../func_format.result} | 0 .../func_format.test} | 0 .../suite/sysschema/r/v_host_summary.result | 6 +- .../r/v_host_summary_by_file_io.result | 2 +- .../r/v_host_summary_by_file_io_type.result | 4 +- .../r/v_host_summary_by_stages.result | 4 +- ...v_host_summary_by_statement_latency.result | 6 +- .../r/v_host_summary_by_statement_type.result | 6 +- .../r/v_io_by_thread_by_latency.result | 8 +- .../r/v_io_global_by_file_by_latency.result | 8 +- .../r/v_io_global_by_wait_by_bytes.result | 8 +- .../r/v_io_global_by_wait_by_latency.result | 12 +- .../suite/sysschema/r/v_latest_file_io.result | 2 +- .../suite/sysschema/r/v_processlist.result | 10 +- .../r/v_schema_index_statistics.result | 8 +- .../r/v_schema_table_statistics.result | 16 +-- ...schema_table_statistics_with_buffer.result | 14 +- ...schema_tables_with_full_table_scans.result | 2 +- mysql-test/suite/sysschema/r/v_session.result | 10 +- .../sysschema/r/v_statement_analysis.result | 8 +- .../v_statements_with_full_table_scans.result | 2 +- ...ts_with_runtimes_in_95th_percentile.result | 6 +- .../r/v_statements_with_sorting.result | 2 +- .../r/v_statements_with_temp_tables.result | 2 +- .../suite/sysschema/r/v_user_summary.result | 6 +- .../r/v_user_summary_by_file_io.result | 2 +- .../r/v_user_summary_by_file_io_type.result | 4 +- .../r/v_user_summary_by_stages.result | 4 +- ...v_user_summary_by_statement_latency.result | 6 +- .../r/v_user_summary_by_statement_type.result | 6 +- ..._wait_classes_global_by_avg_latency.result | 8 +- .../r/v_wait_classes_global_by_latency.result | 8 +- .../r/v_waits_by_host_by_latency.result | 6 +- .../r/v_waits_by_user_by_latency.result | 6 +- .../r/v_waits_global_by_latency.result | 6 +- scripts/sys_schema/README.md | 4 +- scripts/sys_schema/functions/format_time.sql | 4 +- .../functions/ps_thread_trx_info.sql | 4 +- scripts/sys_schema/procedures/diagnostics.sql | 12 +- .../procedures/ps_trace_statement_digest.sql | 12 +- .../sys_schema/procedures/ps_trace_thread.sql | 4 +- .../procedures/ps_trace_thread_57.sql | 4 +- .../statement_performance_analyzer.sql | 6 +- scripts/sys_schema/views/p_s/host_summary.sql | 6 +- .../sys_schema/views/p_s/host_summary_57.sql | 6 +- .../views/p_s/host_summary_by_file_io.sql | 2 +- .../p_s/host_summary_by_file_io_type.sql | 4 +- .../views/p_s/host_summary_by_stages.sql | 4 +- .../p_s/host_summary_by_statement_latency.sql | 6 +- .../p_s/host_summary_by_statement_type.sql | 6 +- .../views/p_s/io_by_thread_by_latency.sql | 8 +- .../p_s/io_global_by_file_by_latency.sql | 8 +- .../views/p_s/io_global_by_wait_by_bytes.sql | 8 +- .../p_s/io_global_by_wait_by_latency.sql | 12 +- .../sys_schema/views/p_s/latest_file_io.sql | 2 +- scripts/sys_schema/views/p_s/processlist.sql | 8 +- .../sys_schema/views/p_s/processlist_57.sql | 10 +- .../views/p_s/schema_index_statistics.sql | 8 +- .../views/p_s/schema_table_statistics.sql | 16 +-- .../schema_table_statistics_with_buffer.sql | 14 +- .../schema_tables_with_full_table_scans.sql | 2 +- .../views/p_s/statement_analysis.sql | 8 +- .../p_s/statements_with_full_table_scans.sql | 2 +- ...ments_with_runtimes_in_95th_percentile.sql | 6 +- .../views/p_s/statements_with_sorting.sql | 2 +- .../views/p_s/statements_with_temp_tables.sql | 2 +- scripts/sys_schema/views/p_s/user_summary.sql | 6 +- .../sys_schema/views/p_s/user_summary_57.sql | 6 +- .../views/p_s/user_summary_by_file_io.sql | 2 +- .../p_s/user_summary_by_file_io_type.sql | 4 +- .../views/p_s/user_summary_by_stages.sql | 4 +- .../p_s/user_summary_by_statement_latency.sql | 6 +- .../p_s/user_summary_by_statement_type.sql | 6 +- .../wait_classes_global_by_avg_latency.sql | 8 +- .../p_s/wait_classes_global_by_latency.sql | 8 +- .../views/p_s/waits_by_host_by_latency.sql | 6 +- .../views/p_s/waits_by_user_by_latency.sql | 6 +- .../views/p_s/waits_global_by_latency.sql | 6 +- sql/CMakeLists.txt | 2 +- sql/item.h | 1 - sql/item_create.cc | 2 +- sql/item_pfsfunc.cc | 135 ------------------ sql/item_pfsfunc.h | 54 ------- sql/item_strfunc.cc | 78 ++++++++++ sql/item_strfunc.h | 27 ++++ 86 files changed, 347 insertions(+), 430 deletions(-) rename mysql-test/{suite/perfschema/r/pfs_functions.result => main/func_format.result} (100%) rename mysql-test/{suite/perfschema/t/pfs_functions.test => main/func_format.test} (100%) delete mode 100644 sql/item_pfsfunc.cc delete mode 100644 sql/item_pfsfunc.h diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 8727aa54992..5d5cc35e1be 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -64,7 +64,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/item.cc ../sql/item_create.cc ../sql/item_func.cc ../sql/item_geofunc.cc ../sql/item_row.cc ../sql/item_strfunc.cc ../sql/item_subselect.cc ../sql/item_sum.cc ../sql/item_timefunc.cc - ../sql/item_xmlfunc.cc ../sql/item_jsonfunc.cc ../sql/item_pfsfunc.cc + ../sql/item_xmlfunc.cc ../sql/item_jsonfunc.cc ../sql/key.cc ../sql/lock.cc ../sql/log.cc ../sql/log_event.cc ../sql/log_event_server.cc ../sql/mf_iocache.cc ../sql/my_decimal.cc diff --git a/mysql-test/suite/perfschema/r/pfs_functions.result b/mysql-test/main/func_format.result similarity index 100% rename from mysql-test/suite/perfschema/r/pfs_functions.result rename to mysql-test/main/func_format.result diff --git a/mysql-test/suite/perfschema/t/pfs_functions.test b/mysql-test/main/func_format.test similarity index 100% rename from mysql-test/suite/perfschema/t/pfs_functions.test rename to mysql-test/main/func_format.test diff --git a/mysql-test/suite/sysschema/r/v_host_summary.result b/mysql-test/suite/sysschema/r/v_host_summary.result index b619a8a55fd..6eef4a41532 100644 --- a/mysql-test/suite/sysschema/r/v_host_summary.result +++ b/mysql-test/suite/sysschema/r/v_host_summary.result @@ -2,11 +2,11 @@ DESC sys.host_summary; Field Type Null Key Default Extra host varchar(255) YES NULL statements decimal(64,0) YES NULL -statement_latency text YES NULL -statement_avg_latency text YES NULL +statement_latency varchar(12) YES NULL +statement_avg_latency varchar(12) YES NULL table_scans decimal(65,0) YES NULL file_ios decimal(64,0) YES NULL -file_io_latency text YES NULL +file_io_latency varchar(12) YES NULL current_connections decimal(41,0) YES NULL total_connections decimal(41,0) YES NULL unique_users bigint(21) NO 0 diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_file_io.result b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io.result index 8e257163da7..979d4a719d1 100644 --- a/mysql-test/suite/sysschema/r/v_host_summary_by_file_io.result +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io.result @@ -2,7 +2,7 @@ DESC sys.host_summary_by_file_io; Field Type Null Key Default Extra host varchar(255) YES NULL ios decimal(42,0) YES NULL -io_latency text YES NULL +io_latency varchar(12) YES NULL SELECT * FROM sys.host_summary_by_file_io; DESC sys.x$host_summary_by_file_io; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_file_io_type.result b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io_type.result index c9a56aa9943..9844b8b7c03 100644 --- a/mysql-test/suite/sysschema/r/v_host_summary_by_file_io_type.result +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_file_io_type.result @@ -3,8 +3,8 @@ Field Type Null Key Default Extra host varchar(255) YES NULL event_name varchar(128) NO NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL SELECT * FROM sys.host_summary_by_file_io_type; DESC sys.x$host_summary_by_file_io_type; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_stages.result b/mysql-test/suite/sysschema/r/v_host_summary_by_stages.result index 0ee6f25562c..3910ed6e1a6 100644 --- a/mysql-test/suite/sysschema/r/v_host_summary_by_stages.result +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_stages.result @@ -3,8 +3,8 @@ Field Type Null Key Default Extra host varchar(255) YES NULL event_name varchar(128) NO NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -avg_latency text YES NULL +total_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL SELECT * FROM sys.host_summary_by_stages; DESC sys.x$host_summary_by_stages; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_statement_latency.result b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_latency.result index 882a30b71a1..e7f906e615c 100644 --- a/mysql-test/suite/sysschema/r/v_host_summary_by_statement_latency.result +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_latency.result @@ -2,9 +2,9 @@ DESC sys.host_summary_by_statement_latency; Field Type Null Key Default Extra host varchar(255) YES NULL total decimal(42,0) YES NULL -total_latency text YES NULL -max_latency text YES NULL -lock_latency text YES NULL +total_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL +lock_latency varchar(12) YES NULL rows_sent decimal(42,0) YES NULL rows_examined decimal(42,0) YES NULL rows_affected decimal(42,0) YES NULL diff --git a/mysql-test/suite/sysschema/r/v_host_summary_by_statement_type.result b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_type.result index eec8f8695c6..14e58d7d135 100644 --- a/mysql-test/suite/sysschema/r/v_host_summary_by_statement_type.result +++ b/mysql-test/suite/sysschema/r/v_host_summary_by_statement_type.result @@ -3,9 +3,9 @@ Field Type Null Key Default Extra host varchar(255) YES NULL statement varchar(128) YES NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -max_latency text YES NULL -lock_latency text YES NULL +total_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL +lock_latency varchar(12) YES NULL rows_sent bigint(20) unsigned NO NULL rows_examined bigint(20) unsigned NO NULL rows_affected bigint(20) unsigned NO NULL diff --git a/mysql-test/suite/sysschema/r/v_io_by_thread_by_latency.result b/mysql-test/suite/sysschema/r/v_io_by_thread_by_latency.result index fddd2f266df..bed684ae7c8 100644 --- a/mysql-test/suite/sysschema/r/v_io_by_thread_by_latency.result +++ b/mysql-test/suite/sysschema/r/v_io_by_thread_by_latency.result @@ -2,10 +2,10 @@ DESC sys.io_by_thread_by_latency; Field Type Null Key Default Extra user varchar(384) YES NULL total decimal(42,0) YES NULL -total_latency text YES NULL -min_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +min_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL thread_id bigint(20) unsigned NO NULL processlist_id bigint(20) unsigned YES NULL SELECT * FROM sys.io_by_thread_by_latency; diff --git a/mysql-test/suite/sysschema/r/v_io_global_by_file_by_latency.result b/mysql-test/suite/sysschema/r/v_io_global_by_file_by_latency.result index 32d992c2751..c56d02f641f 100644 --- a/mysql-test/suite/sysschema/r/v_io_global_by_file_by_latency.result +++ b/mysql-test/suite/sysschema/r/v_io_global_by_file_by_latency.result @@ -2,13 +2,13 @@ DESC sys.io_global_by_file_by_latency; Field Type Null Key Default Extra file varchar(512) YES NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL +total_latency varchar(12) YES NULL count_read bigint(20) unsigned NO NULL -read_latency text YES NULL +read_latency varchar(12) YES NULL count_write bigint(20) unsigned NO NULL -write_latency text YES NULL +write_latency varchar(12) YES NULL count_misc bigint(20) unsigned NO NULL -misc_latency text YES NULL +misc_latency varchar(12) YES NULL SELECT * FROM sys.io_global_by_file_by_latency; DESC sys.x$io_global_by_file_by_latency; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_bytes.result b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_bytes.result index 3d5dcbffbf6..d47dc9df085 100644 --- a/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_bytes.result +++ b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_bytes.result @@ -2,10 +2,10 @@ DESC sys.io_global_by_wait_by_bytes; Field Type Null Key Default Extra event_name varchar(128) YES NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -min_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +min_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL count_read bigint(20) unsigned NO NULL total_read text YES NULL avg_read text YES NULL diff --git a/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_latency.result b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_latency.result index 1c5db297964..62399c7953d 100644 --- a/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_latency.result +++ b/mysql-test/suite/sysschema/r/v_io_global_by_wait_by_latency.result @@ -2,12 +2,12 @@ DESC sys.io_global_by_wait_by_latency; Field Type Null Key Default Extra event_name varchar(128) YES NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL -read_latency text YES NULL -write_latency text YES NULL -misc_latency text YES NULL +total_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL +read_latency varchar(12) YES NULL +write_latency varchar(12) YES NULL +misc_latency varchar(12) YES NULL count_read bigint(20) unsigned NO NULL total_read text YES NULL avg_read text YES NULL diff --git a/mysql-test/suite/sysschema/r/v_latest_file_io.result b/mysql-test/suite/sysschema/r/v_latest_file_io.result index a65cdb2dd10..8bdc02145f6 100644 --- a/mysql-test/suite/sysschema/r/v_latest_file_io.result +++ b/mysql-test/suite/sysschema/r/v_latest_file_io.result @@ -2,7 +2,7 @@ DESC sys.latest_file_io; Field Type Null Key Default Extra thread varchar(214) YES NULL file varchar(512) YES NULL -latency text YES NULL +latency varchar(12) YES NULL operation varchar(32) NO NULL requested text YES NULL SELECT * FROM sys.latest_file_io; diff --git a/mysql-test/suite/sysschema/r/v_processlist.result b/mysql-test/suite/sysschema/r/v_processlist.result index dfc048143d6..f242497907f 100644 --- a/mysql-test/suite/sysschema/r/v_processlist.result +++ b/mysql-test/suite/sysschema/r/v_processlist.result @@ -8,9 +8,9 @@ command varchar(16) YES NULL state varchar(64) YES NULL time bigint(20) YES NULL current_statement longtext YES NULL -statement_latency mediumtext YES NULL +statement_latency varchar(12) YES NULL progress decimal(26,2) YES NULL -lock_latency text YES NULL +lock_latency varchar(12) YES NULL rows_examined bigint(20) unsigned YES NULL rows_sent bigint(20) unsigned YES NULL rows_affected bigint(20) unsigned YES NULL @@ -18,12 +18,12 @@ tmp_tables bigint(20) unsigned YES NULL tmp_disk_tables bigint(20) unsigned YES NULL full_scan varchar(3) YES NULL last_statement longtext YES NULL -last_statement_latency mediumtext YES NULL +last_statement_latency varchar(12) YES NULL current_memory text YES NULL last_wait varchar(128) YES NULL -last_wait_latency mediumtext YES NULL +last_wait_latency varchar(13) YES NULL source varchar(64) YES NULL -trx_latency text YES NULL +trx_latency varchar(12) YES NULL trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL trx_autocommit enum('YES','NO') YES NULL pid varchar(1024) YES NULL diff --git a/mysql-test/suite/sysschema/r/v_schema_index_statistics.result b/mysql-test/suite/sysschema/r/v_schema_index_statistics.result index 63cf1931e79..959f8628145 100644 --- a/mysql-test/suite/sysschema/r/v_schema_index_statistics.result +++ b/mysql-test/suite/sysschema/r/v_schema_index_statistics.result @@ -4,13 +4,13 @@ table_schema varchar(64) YES NULL table_name varchar(64) YES NULL index_name varchar(64) YES NULL rows_selected bigint(20) unsigned NO NULL -select_latency text YES NULL +select_latency varchar(12) YES NULL rows_inserted bigint(20) unsigned NO NULL -insert_latency text YES NULL +insert_latency varchar(12) YES NULL rows_updated bigint(20) unsigned NO NULL -update_latency text YES NULL +update_latency varchar(12) YES NULL rows_deleted bigint(20) unsigned NO NULL -delete_latency text YES NULL +delete_latency varchar(12) YES NULL SELECT * FROM sys.schema_index_statistics; DESC sys.x$schema_index_statistics; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_schema_table_statistics.result b/mysql-test/suite/sysschema/r/v_schema_table_statistics.result index fda0d7da310..0ca9096d937 100644 --- a/mysql-test/suite/sysschema/r/v_schema_table_statistics.result +++ b/mysql-test/suite/sysschema/r/v_schema_table_statistics.result @@ -2,23 +2,23 @@ DESC sys.schema_table_statistics; Field Type Null Key Default Extra table_schema varchar(64) YES NULL table_name varchar(64) YES NULL -total_latency text YES NULL +total_latency varchar(12) YES NULL rows_fetched bigint(20) unsigned NO NULL -fetch_latency text YES NULL +fetch_latency varchar(12) YES NULL rows_inserted bigint(20) unsigned NO NULL -insert_latency text YES NULL +insert_latency varchar(12) YES NULL rows_updated bigint(20) unsigned NO NULL -update_latency text YES NULL +update_latency varchar(12) YES NULL rows_deleted bigint(20) unsigned NO NULL -delete_latency text YES NULL +delete_latency varchar(12) YES NULL io_read_requests decimal(42,0) YES NULL io_read text YES NULL -io_read_latency text YES NULL +io_read_latency varchar(12) YES NULL io_write_requests decimal(42,0) YES NULL io_write text YES NULL -io_write_latency text YES NULL +io_write_latency varchar(12) YES NULL io_misc_requests decimal(42,0) YES NULL -io_misc_latency text YES NULL +io_misc_latency varchar(12) YES NULL SELECT * FROM sys.schema_table_statistics; DESC sys.x$schema_table_statistics; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_schema_table_statistics_with_buffer.result b/mysql-test/suite/sysschema/r/v_schema_table_statistics_with_buffer.result index 809e8a4e823..28f5ee84f98 100644 --- a/mysql-test/suite/sysschema/r/v_schema_table_statistics_with_buffer.result +++ b/mysql-test/suite/sysschema/r/v_schema_table_statistics_with_buffer.result @@ -3,21 +3,21 @@ Field Type Null Key Default Extra table_schema varchar(64) YES NULL table_name varchar(64) YES NULL rows_fetched bigint(20) unsigned NO NULL -fetch_latency text YES NULL +fetch_latency varchar(12) YES NULL rows_inserted bigint(20) unsigned NO NULL -insert_latency text YES NULL +insert_latency varchar(12) YES NULL rows_updated bigint(20) unsigned NO NULL -update_latency text YES NULL +update_latency varchar(12) YES NULL rows_deleted bigint(20) unsigned NO NULL -delete_latency text YES NULL +delete_latency varchar(12) YES NULL io_read_requests decimal(42,0) YES NULL io_read text YES NULL -io_read_latency text YES NULL +io_read_latency varchar(12) YES NULL io_write_requests decimal(42,0) YES NULL io_write text YES NULL -io_write_latency text YES NULL +io_write_latency varchar(12) YES NULL io_misc_requests decimal(42,0) YES NULL -io_misc_latency text YES NULL +io_misc_latency varchar(12) YES NULL innodb_buffer_allocated text YES NULL innodb_buffer_data text YES NULL innodb_buffer_free text YES NULL diff --git a/mysql-test/suite/sysschema/r/v_schema_tables_with_full_table_scans.result b/mysql-test/suite/sysschema/r/v_schema_tables_with_full_table_scans.result index a6aca341f2e..9516071ca9b 100644 --- a/mysql-test/suite/sysschema/r/v_schema_tables_with_full_table_scans.result +++ b/mysql-test/suite/sysschema/r/v_schema_tables_with_full_table_scans.result @@ -3,7 +3,7 @@ Field Type Null Key Default Extra object_schema varchar(64) YES NULL object_name varchar(64) YES NULL rows_full_scanned bigint(20) unsigned NO NULL -latency text YES NULL +latency varchar(12) YES NULL SELECT * FROM sys.schema_tables_with_full_table_scans; DESC sys.x$schema_tables_with_full_table_scans; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_session.result b/mysql-test/suite/sysschema/r/v_session.result index fd88b8f1d6a..21e237ed3f6 100644 --- a/mysql-test/suite/sysschema/r/v_session.result +++ b/mysql-test/suite/sysschema/r/v_session.result @@ -8,9 +8,9 @@ command varchar(16) YES NULL state varchar(64) YES NULL time bigint(20) YES NULL current_statement longtext YES NULL -statement_latency mediumtext YES NULL +statement_latency varchar(12) YES NULL progress decimal(26,2) YES NULL -lock_latency text YES NULL +lock_latency varchar(12) YES NULL rows_examined bigint(20) unsigned YES NULL rows_sent bigint(20) unsigned YES NULL rows_affected bigint(20) unsigned YES NULL @@ -18,12 +18,12 @@ tmp_tables bigint(20) unsigned YES NULL tmp_disk_tables bigint(20) unsigned YES NULL full_scan varchar(3) YES NULL last_statement longtext YES NULL -last_statement_latency mediumtext YES NULL +last_statement_latency varchar(12) YES NULL current_memory text YES NULL last_wait varchar(128) YES NULL -last_wait_latency mediumtext YES NULL +last_wait_latency varchar(13) YES NULL source varchar(64) YES NULL -trx_latency text YES NULL +trx_latency varchar(12) YES NULL trx_state enum('ACTIVE','COMMITTED','ROLLED BACK') YES NULL trx_autocommit enum('YES','NO') YES NULL pid varchar(1024) YES NULL diff --git a/mysql-test/suite/sysschema/r/v_statement_analysis.result b/mysql-test/suite/sysschema/r/v_statement_analysis.result index c3dd167c9fa..510e17d6d7a 100644 --- a/mysql-test/suite/sysschema/r/v_statement_analysis.result +++ b/mysql-test/suite/sysschema/r/v_statement_analysis.result @@ -6,10 +6,10 @@ full_scan varchar(1) NO exec_count bigint(20) unsigned NO NULL err_count bigint(20) unsigned NO NULL warn_count bigint(20) unsigned NO NULL -total_latency text YES NULL -max_latency text YES NULL -avg_latency text YES NULL -lock_latency text YES NULL +total_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +lock_latency varchar(12) YES NULL rows_sent bigint(20) unsigned NO NULL rows_sent_avg decimal(21,0) NO 0 rows_examined bigint(20) unsigned NO NULL diff --git a/mysql-test/suite/sysschema/r/v_statements_with_full_table_scans.result b/mysql-test/suite/sysschema/r/v_statements_with_full_table_scans.result index a762cfd7d3e..f543c8adfcc 100644 --- a/mysql-test/suite/sysschema/r/v_statements_with_full_table_scans.result +++ b/mysql-test/suite/sysschema/r/v_statements_with_full_table_scans.result @@ -3,7 +3,7 @@ Field Type Null Key Default Extra query longtext YES NULL db varchar(64) YES NULL exec_count bigint(20) unsigned NO NULL -total_latency text YES NULL +total_latency varchar(12) YES NULL no_index_used_count bigint(20) unsigned NO NULL no_good_index_used_count bigint(20) unsigned NO NULL no_index_used_pct decimal(24,0) NO 0 diff --git a/mysql-test/suite/sysschema/r/v_statements_with_runtimes_in_95th_percentile.result b/mysql-test/suite/sysschema/r/v_statements_with_runtimes_in_95th_percentile.result index 5cc05f276f8..90ea51a424b 100644 --- a/mysql-test/suite/sysschema/r/v_statements_with_runtimes_in_95th_percentile.result +++ b/mysql-test/suite/sysschema/r/v_statements_with_runtimes_in_95th_percentile.result @@ -6,9 +6,9 @@ full_scan varchar(1) NO exec_count bigint(20) unsigned NO NULL err_count bigint(20) unsigned NO NULL warn_count bigint(20) unsigned NO NULL -total_latency text YES NULL -max_latency text YES NULL -avg_latency text YES NULL +total_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL rows_sent bigint(20) unsigned NO NULL rows_sent_avg decimal(21,0) NO 0 rows_examined bigint(20) unsigned NO NULL diff --git a/mysql-test/suite/sysschema/r/v_statements_with_sorting.result b/mysql-test/suite/sysschema/r/v_statements_with_sorting.result index 034987b8e72..b3a715731a4 100644 --- a/mysql-test/suite/sysschema/r/v_statements_with_sorting.result +++ b/mysql-test/suite/sysschema/r/v_statements_with_sorting.result @@ -3,7 +3,7 @@ Field Type Null Key Default Extra query longtext YES NULL db varchar(64) YES NULL exec_count bigint(20) unsigned NO NULL -total_latency text YES NULL +total_latency varchar(12) YES NULL sort_merge_passes bigint(20) unsigned NO NULL avg_sort_merges decimal(21,0) NO 0 sorts_using_scans bigint(20) unsigned NO NULL diff --git a/mysql-test/suite/sysschema/r/v_statements_with_temp_tables.result b/mysql-test/suite/sysschema/r/v_statements_with_temp_tables.result index 52683a561b2..73ea1ae00c2 100644 --- a/mysql-test/suite/sysschema/r/v_statements_with_temp_tables.result +++ b/mysql-test/suite/sysschema/r/v_statements_with_temp_tables.result @@ -3,7 +3,7 @@ Field Type Null Key Default Extra query longtext YES NULL db varchar(64) YES NULL exec_count bigint(20) unsigned NO NULL -total_latency text YES NULL +total_latency varchar(12) YES NULL memory_tmp_tables bigint(20) unsigned NO NULL disk_tmp_tables bigint(20) unsigned NO NULL avg_tmp_tables_per_query decimal(21,0) NO 0 diff --git a/mysql-test/suite/sysschema/r/v_user_summary.result b/mysql-test/suite/sysschema/r/v_user_summary.result index 233fcccc5c8..9caa02008f8 100644 --- a/mysql-test/suite/sysschema/r/v_user_summary.result +++ b/mysql-test/suite/sysschema/r/v_user_summary.result @@ -2,11 +2,11 @@ DESC sys.user_summary; Field Type Null Key Default Extra user varchar(128) YES NULL statements decimal(64,0) YES NULL -statement_latency text YES NULL -statement_avg_latency text YES NULL +statement_latency varchar(12) YES NULL +statement_avg_latency varchar(12) YES NULL table_scans decimal(65,0) YES NULL file_ios decimal(64,0) YES NULL -file_io_latency text YES NULL +file_io_latency varchar(12) YES NULL current_connections decimal(41,0) YES NULL total_connections decimal(41,0) YES NULL unique_hosts bigint(21) NO 0 diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_file_io.result b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io.result index f6f106a5015..d4429b8e66c 100644 --- a/mysql-test/suite/sysschema/r/v_user_summary_by_file_io.result +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io.result @@ -2,7 +2,7 @@ DESC sys.user_summary_by_file_io; Field Type Null Key Default Extra user varchar(128) YES NULL ios decimal(42,0) YES NULL -io_latency text YES NULL +io_latency varchar(12) YES NULL SELECT * FROM sys.user_summary_by_file_io; DESC sys.x$user_summary_by_file_io; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_file_io_type.result b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io_type.result index c143697c068..cff57e77adb 100644 --- a/mysql-test/suite/sysschema/r/v_user_summary_by_file_io_type.result +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_file_io_type.result @@ -3,8 +3,8 @@ Field Type Null Key Default Extra user varchar(128) YES NULL event_name varchar(128) NO NULL total bigint(20) unsigned NO NULL -latency text YES NULL -max_latency text YES NULL +latency varchar(12) YES NULL +max_latency varchar(12) YES NULL SELECT * FROM sys.user_summary_by_file_io_type; DESC sys.x$user_summary_by_file_io_type; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_stages.result b/mysql-test/suite/sysschema/r/v_user_summary_by_stages.result index 9b90fe9cf47..655660a25aa 100644 --- a/mysql-test/suite/sysschema/r/v_user_summary_by_stages.result +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_stages.result @@ -3,8 +3,8 @@ Field Type Null Key Default Extra user varchar(128) YES NULL event_name varchar(128) NO NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -avg_latency text YES NULL +total_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL SELECT * FROM sys.user_summary_by_stages; DESC sys.x$user_summary_by_stages; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_statement_latency.result b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_latency.result index 36dadc2925b..b5a7fcc2737 100644 --- a/mysql-test/suite/sysschema/r/v_user_summary_by_statement_latency.result +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_latency.result @@ -2,9 +2,9 @@ DESC sys.user_summary_by_statement_latency; Field Type Null Key Default Extra user varchar(128) YES NULL total decimal(42,0) YES NULL -total_latency text YES NULL -max_latency text YES NULL -lock_latency text YES NULL +total_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL +lock_latency varchar(12) YES NULL rows_sent decimal(42,0) YES NULL rows_examined decimal(42,0) YES NULL rows_affected decimal(42,0) YES NULL diff --git a/mysql-test/suite/sysschema/r/v_user_summary_by_statement_type.result b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_type.result index bd006c871b9..70a7ea3f9f5 100644 --- a/mysql-test/suite/sysschema/r/v_user_summary_by_statement_type.result +++ b/mysql-test/suite/sysschema/r/v_user_summary_by_statement_type.result @@ -3,9 +3,9 @@ Field Type Null Key Default Extra user varchar(128) YES NULL statement varchar(128) YES NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -max_latency text YES NULL -lock_latency text YES NULL +total_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL +lock_latency varchar(12) YES NULL rows_sent bigint(20) unsigned NO NULL rows_examined bigint(20) unsigned NO NULL rows_affected bigint(20) unsigned NO NULL diff --git a/mysql-test/suite/sysschema/r/v_wait_classes_global_by_avg_latency.result b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_avg_latency.result index f6559cb7dd7..52d506ea575 100644 --- a/mysql-test/suite/sysschema/r/v_wait_classes_global_by_avg_latency.result +++ b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_avg_latency.result @@ -2,10 +2,10 @@ DESC sys.wait_classes_global_by_avg_latency; Field Type Null Key Default Extra event_class varchar(128) YES NULL total decimal(42,0) YES NULL -total_latency text YES NULL -min_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +min_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL SELECT * FROM sys.wait_classes_global_by_avg_latency; DESC sys.x$wait_classes_global_by_avg_latency; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_wait_classes_global_by_latency.result b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_latency.result index 10db5ead78b..95f619619eb 100644 --- a/mysql-test/suite/sysschema/r/v_wait_classes_global_by_latency.result +++ b/mysql-test/suite/sysschema/r/v_wait_classes_global_by_latency.result @@ -2,10 +2,10 @@ DESC sys.wait_classes_global_by_latency; Field Type Null Key Default Extra event_class varchar(128) YES NULL total decimal(42,0) YES NULL -total_latency text YES NULL -min_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +min_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL SELECT * FROM sys.wait_classes_global_by_latency; DESC sys.x$wait_classes_global_by_latency; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_waits_by_host_by_latency.result b/mysql-test/suite/sysschema/r/v_waits_by_host_by_latency.result index 5e595d9cf85..cbbed779a59 100644 --- a/mysql-test/suite/sysschema/r/v_waits_by_host_by_latency.result +++ b/mysql-test/suite/sysschema/r/v_waits_by_host_by_latency.result @@ -3,9 +3,9 @@ Field Type Null Key Default Extra host varchar(255) YES NULL event varchar(128) NO NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL SELECT * FROM sys.waits_by_host_by_latency; DESC sys.x$waits_by_host_by_latency; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_waits_by_user_by_latency.result b/mysql-test/suite/sysschema/r/v_waits_by_user_by_latency.result index 860db68cc50..369b3a18423 100644 --- a/mysql-test/suite/sysschema/r/v_waits_by_user_by_latency.result +++ b/mysql-test/suite/sysschema/r/v_waits_by_user_by_latency.result @@ -3,9 +3,9 @@ Field Type Null Key Default Extra user varchar(128) YES NULL event varchar(128) NO NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL SELECT * FROM sys.waits_by_user_by_latency; DESC sys.x$waits_by_user_by_latency; Field Type Null Key Default Extra diff --git a/mysql-test/suite/sysschema/r/v_waits_global_by_latency.result b/mysql-test/suite/sysschema/r/v_waits_global_by_latency.result index 1e32a9b8ff0..0fafb72389e 100644 --- a/mysql-test/suite/sysschema/r/v_waits_global_by_latency.result +++ b/mysql-test/suite/sysschema/r/v_waits_global_by_latency.result @@ -2,9 +2,9 @@ DESC sys.waits_global_by_latency; Field Type Null Key Default Extra events varchar(128) NO NULL total bigint(20) unsigned NO NULL -total_latency text YES NULL -avg_latency text YES NULL -max_latency text YES NULL +total_latency varchar(12) YES NULL +avg_latency varchar(12) YES NULL +max_latency varchar(12) YES NULL SELECT * FROM sys.waits_global_by_latency; DESC sys.x$waits_global_by_latency; Field Type Null Key Default Extra diff --git a/scripts/sys_schema/README.md b/scripts/sys_schema/README.md index 3c90f41f8e0..2f1dc74e055 100644 --- a/scripts/sys_schema/README.md +++ b/scripts/sys_schema/README.md @@ -5323,8 +5323,8 @@ mysql> CREATE OR REPLACE VIEW mydb.my_statements AS -> SELECT sys.format_statement(DIGEST_TEXT) AS query, -> SCHEMA_NAME AS db, -> COUNT_STAR AS exec_count, - -> sys.format_time(SUM_TIMER_WAIT) AS total_latency, - -> sys.format_time(AVG_TIMER_WAIT) AS avg_latency, + -> format_pico_time(SUM_TIMER_WAIT) AS total_latency, + -> format_pico_time(AVG_TIMER_WAIT) AS avg_latency, -> ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg, -> ROUND(IFNULL(SUM_ROWS_EXAMINED / NULLIF(COUNT_STAR, 0), 0)) AS rows_examined_avg, -> ROUND(IFNULL(SUM_ROWS_AFFECTED / NULLIF(COUNT_STAR, 0), 0)) AS rows_affected_avg, diff --git a/scripts/sys_schema/functions/format_time.sql b/scripts/sys_schema/functions/format_time.sql index f828f791e96..47ee0b85cb0 100644 --- a/scripts/sys_schema/functions/format_time.sql +++ b/scripts/sys_schema/functions/format_time.sql @@ -26,7 +26,9 @@ CREATE DEFINER='mariadb.sys'@'localhost' FUNCTION format_time ( COMMENT ' Description ----------- - + + OBSOLETE. USE BUILT-IN format_pico_time() INSTEAD + Takes a raw picoseconds value, and converts it to a human readable form. Picoseconds are the precision that all latency values are printed in diff --git a/scripts/sys_schema/functions/ps_thread_trx_info.sql b/scripts/sys_schema/functions/ps_thread_trx_info.sql index 12ab6aefc56..e0f7d17970d 100644 --- a/scripts/sys_schema/functions/ps_thread_trx_info.sql +++ b/scripts/sys_schema/functions/ps_thread_trx_info.sql @@ -172,7 +172,7 @@ BEGIN GROUP_CONCAT( IFNULL( CONCAT('\n {\n', - ' "time": "', IFNULL(sys.format_time(trxi.timer_wait), ''), '",\n', + ' "time": "', IFNULL(format_pico_time(trxi.timer_wait), ''), '",\n', ' "state": "', IFNULL(trxi.state, ''), '",\n', ' "mode": "', IFNULL(trxi.access_mode, ''), '",\n', ' "autocommitted": "', IFNULL(trxi.autocommit, ''), '",\n', @@ -200,7 +200,7 @@ BEGIN IFNULL( CONCAT('\n {\n', ' "sql_text": "', IFNULL(sys.format_statement(REPLACE(sql_text, '\\', '\\\\')), ''), '",\n', - ' "time": "', IFNULL(sys.format_time(timer_wait), ''), '",\n', + ' "time": "', IFNULL(format_pico_time(timer_wait), ''), '",\n', ' "schema": "', IFNULL(current_schema, ''), '",\n', ' "rows_examined": ', IFNULL(rows_examined, ''), ',\n', ' "rows_affected": ', IFNULL(rows_affected, ''), ',\n', diff --git a/scripts/sys_schema/procedures/diagnostics.sql b/scripts/sys_schema/procedures/diagnostics.sql index 2e79c5c1c2a..2d2f4664a2d 100644 --- a/scripts/sys_schema/procedures/diagnostics.sql +++ b/scripts/sys_schema/procedures/diagnostics.sql @@ -355,7 +355,7 @@ BEGIN ) THEN CONCAT(''sys.format_bytes('', COLUMN_NAME, '') AS '', COLUMN_NAME) WHEN SUBSTRING(COLUMN_NAME, -8) = ''_latency'' - THEN CONCAT(''sys.format_time('', COLUMN_NAME, '') AS '', COLUMN_NAME) + THEN CONCAT(''format_pico_time('', COLUMN_NAME, '') AS '', COLUMN_NAME) WHEN SUBSTRING(COLUMN_NAME, -7) = ''_memory'' OR SUBSTRING(COLUMN_NAME, -17) = ''_memory_allocated'' OR ((SUBSTRING(COLUMN_NAME, -5) = ''_read'' OR SUBSTRING(COLUMN_NAME, -8) = ''_written'' OR SUBSTRING(COLUMN_NAME, -6) = ''_write'') AND SUBSTRING(COLUMN_NAME, 1, 6) <> ''COUNT_'') THEN CONCAT(''sys.format_bytes('', COLUMN_NAME, '') AS '', COLUMN_NAME) @@ -385,15 +385,15 @@ BEGIN ) THEN CONCAT(''sys.format_bytes(e.'', COLUMN_NAME, ''-IFNULL(s.'', COLUMN_NAME, '', 0)) AS '', COLUMN_NAME) WHEN SUBSTRING(COLUMN_NAME, 1, 4) IN (''max_'', ''min_'') AND SUBSTRING(COLUMN_NAME, -8) = ''_latency'' - THEN CONCAT(''sys.format_time(e.'', COLUMN_NAME, '') AS '', COLUMN_NAME) + THEN CONCAT(''format_pico_time(e.'', COLUMN_NAME, '') AS '', COLUMN_NAME) WHEN COLUMN_NAME = ''avg_latency'' - THEN CONCAT(''sys.format_time((e.total_latency - IFNULL(s.total_latency, 0))'', + THEN CONCAT(''format_pico_time((e.total_latency - IFNULL(s.total_latency, 0))'', ''/NULLIF(e.total - IFNULL(s.total, 0), 0)) AS '', COLUMN_NAME) WHEN SUBSTRING(COLUMN_NAME, -12) = ''_avg_latency'' - THEN CONCAT(''sys.format_time((e.'', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), ''_latency - IFNULL(s.'', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), ''_latency, 0))'', + THEN CONCAT(''format_pico_time((e.'', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), ''_latency - IFNULL(s.'', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), ''_latency, 0))'', ''/NULLIF(e.'', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), ''s - IFNULL(s.'', SUBSTRING(COLUMN_NAME FROM 1 FOR CHAR_LENGTH(COLUMN_NAME)-12), ''s, 0), 0)) AS '', COLUMN_NAME) WHEN SUBSTRING(COLUMN_NAME, -8) = ''_latency'' - THEN CONCAT(''sys.format_time(e.'', COLUMN_NAME, '' - IFNULL(s.'', COLUMN_NAME, '', 0)) AS '', COLUMN_NAME) + THEN CONCAT(''format_pico_time(e.'', COLUMN_NAME, '' - IFNULL(s.'', COLUMN_NAME, '', 0)) AS '', COLUMN_NAME) WHEN COLUMN_NAME IN (''avg_read'', ''avg_write'', ''avg_written'') THEN CONCAT(''sys.format_bytes(IFNULL((e.total_'', IF(COLUMN_NAME = ''avg_read'', ''read'', ''written''), ''-IFNULL(s.total_'', IF(COLUMN_NAME = ''avg_read'', ''read'', ''written''), '', 0))'', ''/NULLIF(e.count_'', IF(COLUMN_NAME = ''avg_read'', ''read'', ''write''), ''-IFNULL(s.count_'', IF(COLUMN_NAME = ''avg_read'', ''read'', ''write''), '', 0), 0), 0)) AS '', @@ -1061,4 +1061,4 @@ SELECT ''UNIX_TIMESTAMP()'' AS Variable_name, ROUND(UNIX_TIMESTAMP(NOW(3)), 3) A END IF; END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/scripts/sys_schema/procedures/ps_trace_statement_digest.sql b/scripts/sys_schema/procedures/ps_trace_statement_digest.sql index f9bb4d3b09e..6ad01e4d8d8 100644 --- a/scripts/sys_schema/procedures/ps_trace_statement_digest.sql +++ b/scripts/sys_schema/procedures/ps_trace_statement_digest.sql @@ -240,8 +240,8 @@ BEGIN SELECT "SUMMARY STATISTICS"; SELECT COUNT(*) executions, - sys.format_time(SUM(timer_wait)) AS exec_time, - sys.format_time(SUM(lock_time)) AS lock_time, + format_pico_time(SUM(timer_wait)) AS exec_time, + format_pico_time(SUM(lock_time)) AS lock_time, SUM(rows_sent) AS rows_sent, SUM(rows_affected) AS rows_affected, SUM(rows_examined) AS rows_examined, @@ -251,7 +251,7 @@ BEGIN SELECT event_name, COUNT(*) as count, - sys.format_time(SUM(timer_wait)) as latency + format_pico_time(SUM(timer_wait)) as latency FROM stmt_stages GROUP BY event_name ORDER BY SUM(timer_wait) DESC; @@ -259,8 +259,8 @@ BEGIN SELECT "LONGEST RUNNING STATEMENT"; SELECT thread_id, - sys.format_time(timer_wait) AS exec_time, - sys.format_time(lock_time) AS lock_time, + format_pico_time(timer_wait) AS exec_time, + format_pico_time(lock_time) AS lock_time, rows_sent, rows_affected, rows_examined, @@ -279,7 +279,7 @@ BEGIN IF (@sql_id IS NOT NULL) THEN SELECT event_name, - sys.format_time(timer_wait) as latency + format_pico_time(timer_wait) as latency FROM stmt_stages WHERE stmt_id = @sql_id ORDER BY event_id; diff --git a/scripts/sys_schema/procedures/ps_trace_thread.sql b/scripts/sys_schema/procedures/ps_trace_thread.sql index 1a2ede79a77..4d5ba14a84d 100644 --- a/scripts/sys_schema/procedures/ps_trace_thread.sql +++ b/scripts/sys_schema/procedures/ps_trace_thread.sql @@ -116,7 +116,7 @@ BEGIN SELECT CONCAT(IF(nesting_event_id IS NOT NULL, CONCAT(nesting_event_id, ' -> '), ''), event_id, '; ', event_id, ' [label="', -- Convert from picoseconds to microseconds - '(', sys.format_time(timer_wait), ') ', + '(', format_pico_time(timer_wait), ') ', IF (event_name NOT LIKE 'wait/io%', SUBSTRING_INDEX(event_name, '/', -2), IF (event_name NOT LIKE 'wait/io/file%' OR event_name NOT LIKE 'wait/io/socket%', @@ -170,7 +170,7 @@ BEGIN CONCAT(sql_text, '\\n', 'errors: ', errors, '\\n', 'warnings: ', warnings, '\\n', - 'lock time: ', sys.format_time(lock_time),'\\n', + 'lock time: ', format_pico_time(lock_time),'\\n', 'rows affected: ', rows_affected, '\\n', 'rows sent: ', rows_sent, '\\n', 'rows examined: ', rows_examined, '\\n', diff --git a/scripts/sys_schema/procedures/ps_trace_thread_57.sql b/scripts/sys_schema/procedures/ps_trace_thread_57.sql index 33dc7961089..d88f824cebf 100644 --- a/scripts/sys_schema/procedures/ps_trace_thread_57.sql +++ b/scripts/sys_schema/procedures/ps_trace_thread_57.sql @@ -116,7 +116,7 @@ BEGIN SELECT CONCAT(IF(nesting_event_id IS NOT NULL, CONCAT(nesting_event_id, ' -> '), ''), event_id, '; ', event_id, ' [label="', -- Convert from picoseconds to microseconds - '(', sys.format_time(timer_wait), ') ', + '(', format_pico_time(timer_wait), ') ', IF (event_name NOT LIKE 'wait/io%', SUBSTRING_INDEX(event_name, '/', -2), IF (event_name NOT LIKE 'wait/io/file%' OR event_name NOT LIKE 'wait/io/socket%', @@ -188,7 +188,7 @@ BEGIN CONCAT('statement: ', sql_text, '\\n', 'errors: ', errors, '\\n', 'warnings: ', warnings, '\\n', - 'lock time: ', sys.format_time(lock_time),'\\n', + 'lock time: ', format_pico_time(lock_time),'\\n', 'rows affected: ', rows_affected, '\\n', 'rows sent: ', rows_sent, '\\n', 'rows examined: ', rows_examined, '\\n', diff --git a/scripts/sys_schema/procedures/statement_performance_analyzer.sql b/scripts/sys_schema/procedures/statement_performance_analyzer.sql index f98596ef913..3c26fd0b812 100644 --- a/scripts/sys_schema/procedures/statement_performance_analyzer.sql +++ b/scripts/sys_schema/procedures/statement_performance_analyzer.sql @@ -196,8 +196,8 @@ CREATE DEFINER='mariadb.sys'@'localhost' PROCEDURE statement_performance_analyze -> SELECT sys.format_statement(DIGEST_TEXT) AS query, -> SCHEMA_NAME AS db, -> COUNT_STAR AS exec_count, - -> sys.format_time(SUM_TIMER_WAIT) AS total_latency, - -> sys.format_time(AVG_TIMER_WAIT) AS avg_latency, + -> format_pico_time(SUM_TIMER_WAIT) AS total_latency, + -> format_pico_time(AVG_TIMER_WAIT) AS avg_latency, -> ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg, -> ROUND(IFNULL(SUM_ROWS_EXAMINED / NULLIF(COUNT_STAR, 0), 0)) AS rows_examined_avg, -> ROUND(IFNULL(SUM_ROWS_AFFECTED / NULLIF(COUNT_STAR, 0), 0)) AS rows_affected_avg, @@ -720,4 +720,4 @@ HAVING percentile > 0.95 END IF; END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/scripts/sys_schema/views/p_s/host_summary.sql b/scripts/sys_schema/views/p_s/host_summary.sql index 080100a4241..99ed0942a9c 100644 --- a/scripts/sys_schema/views/p_s/host_summary.sql +++ b/scripts/sys_schema/views/p_s/host_summary.sql @@ -46,11 +46,11 @@ VIEW host_summary ( ) AS SELECT IF(accounts.host IS NULL, 'background', accounts.host) AS host, SUM(stmt.total) AS statements, - sys.format_time(SUM(stmt.total_latency)) AS statement_latency, - sys.format_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, + format_pico_time(SUM(stmt.total_latency)) AS statement_latency, + format_pico_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, - sys.format_time(SUM(io.io_latency)) AS file_io_latency, + format_pico_time(SUM(io.io_latency)) AS file_io_latency, SUM(accounts.current_connections) AS current_connections, SUM(accounts.total_connections) AS total_connections, COUNT(DISTINCT accounts.user) AS unique_users diff --git a/scripts/sys_schema/views/p_s/host_summary_57.sql b/scripts/sys_schema/views/p_s/host_summary_57.sql index cd0739f495f..dc5fb1e9006 100644 --- a/scripts/sys_schema/views/p_s/host_summary_57.sql +++ b/scripts/sys_schema/views/p_s/host_summary_57.sql @@ -49,11 +49,11 @@ VIEW host_summary ( ) AS SELECT IF(accounts.host IS NULL, 'background', accounts.host) AS host, SUM(stmt.total) AS statements, - sys.format_time(SUM(stmt.total_latency)) AS statement_latency, - sys.format_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, + format_pico_time(SUM(stmt.total_latency)) AS statement_latency, + format_pico_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, - sys.format_time(SUM(io.io_latency)) AS file_io_latency, + format_pico_time(SUM(io.io_latency)) AS file_io_latency, SUM(accounts.current_connections) AS current_connections, SUM(accounts.total_connections) AS total_connections, COUNT(DISTINCT user) AS unique_users, diff --git a/scripts/sys_schema/views/p_s/host_summary_by_file_io.sql b/scripts/sys_schema/views/p_s/host_summary_by_file_io.sql index e1fbf2ea29d..c8aa6f8bf87 100644 --- a/scripts/sys_schema/views/p_s/host_summary_by_file_io.sql +++ b/scripts/sys_schema/views/p_s/host_summary_by_file_io.sql @@ -40,7 +40,7 @@ VIEW host_summary_by_file_io ( ) AS SELECT IF(host IS NULL, 'background', host) AS host, SUM(count_star) AS ios, - sys.format_time(SUM(sum_timer_wait)) AS io_latency + format_pico_time(SUM(sum_timer_wait)) AS io_latency FROM performance_schema.events_waits_summary_by_host_by_event_name WHERE event_name LIKE 'wait/io/file/%' GROUP BY IF(host IS NULL, 'background', host) diff --git a/scripts/sys_schema/views/p_s/host_summary_by_file_io_type.sql b/scripts/sys_schema/views/p_s/host_summary_by_file_io_type.sql index 58567e3f7f2..f85c18a0724 100644 --- a/scripts/sys_schema/views/p_s/host_summary_by_file_io_type.sql +++ b/scripts/sys_schema/views/p_s/host_summary_by_file_io_type.sql @@ -58,8 +58,8 @@ VIEW host_summary_by_file_io_type ( SELECT IF(host IS NULL, 'background', host) AS host, event_name, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(max_timer_wait) AS max_latency + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_by_host_by_event_name WHERE event_name LIKE 'wait/io/file%' AND count_star > 0 diff --git a/scripts/sys_schema/views/p_s/host_summary_by_stages.sql b/scripts/sys_schema/views/p_s/host_summary_by_stages.sql index 97e5a7eef98..063c8a89d4b 100644 --- a/scripts/sys_schema/views/p_s/host_summary_by_stages.sql +++ b/scripts/sys_schema/views/p_s/host_summary_by_stages.sql @@ -57,8 +57,8 @@ VIEW host_summary_by_stages ( SELECT IF(host IS NULL, 'background', host) AS host, event_name, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(avg_timer_wait) AS avg_latency + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(avg_timer_wait) AS avg_latency FROM performance_schema.events_stages_summary_by_host_by_event_name WHERE sum_timer_wait != 0 ORDER BY IF(host IS NULL, 'background', host), sum_timer_wait DESC; diff --git a/scripts/sys_schema/views/p_s/host_summary_by_statement_latency.sql b/scripts/sys_schema/views/p_s/host_summary_by_statement_latency.sql index 9eeb4c30d80..b0a902c79a2 100644 --- a/scripts/sys_schema/views/p_s/host_summary_by_statement_latency.sql +++ b/scripts/sys_schema/views/p_s/host_summary_by_statement_latency.sql @@ -45,9 +45,9 @@ VIEW host_summary_by_statement_latency ( ) AS SELECT IF(host IS NULL, 'background', host) AS host, SUM(count_star) AS total, - sys.format_time(SUM(sum_timer_wait)) AS total_latency, - sys.format_time(MAX(max_timer_wait)) AS max_latency, - sys.format_time(SUM(sum_lock_time)) AS lock_latency, + format_pico_time(SUM(sum_timer_wait)) AS total_latency, + format_pico_time(MAX(max_timer_wait)) AS max_latency, + format_pico_time(SUM(sum_lock_time)) AS lock_latency, SUM(sum_rows_sent) AS rows_sent, SUM(sum_rows_examined) AS rows_examined, SUM(sum_rows_affected) AS rows_affected, diff --git a/scripts/sys_schema/views/p_s/host_summary_by_statement_type.sql b/scripts/sys_schema/views/p_s/host_summary_by_statement_type.sql index b529cd8c68d..3a85478ecdb 100644 --- a/scripts/sys_schema/views/p_s/host_summary_by_statement_type.sql +++ b/scripts/sys_schema/views/p_s/host_summary_by_statement_type.sql @@ -52,9 +52,9 @@ VIEW host_summary_by_statement_type ( SELECT IF(host IS NULL, 'background', host) AS host, SUBSTRING_INDEX(event_name, '/', -1) AS statement, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(max_timer_wait) AS max_latency, - sys.format_time(sum_lock_time) AS lock_latency, + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(max_timer_wait) AS max_latency, + format_pico_time(sum_lock_time) AS lock_latency, sum_rows_sent AS rows_sent, sum_rows_examined AS rows_examined, sum_rows_affected AS rows_affected, diff --git a/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql b/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql index c5bf1c693c2..a4e87dd7ace 100644 --- a/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql +++ b/scripts/sys_schema/views/p_s/io_by_thread_by_latency.sql @@ -56,10 +56,10 @@ SELECT IF(processlist_id IS NULL, CONCAT(processlist_user, '@', processlist_host) ) user, SUM(count_star) total, - sys.format_time(SUM(sum_timer_wait)) total_latency, - sys.format_time(MIN(min_timer_wait)) min_latency, - sys.format_time(AVG(avg_timer_wait)) avg_latency, - sys.format_time(MAX(max_timer_wait)) max_latency, + format_pico_time(SUM(sum_timer_wait)) total_latency, + format_pico_time(MIN(min_timer_wait)) min_latency, + format_pico_time(AVG(avg_timer_wait)) avg_latency, + format_pico_time(MAX(max_timer_wait)) max_latency, thread_id, processlist_id FROM performance_schema.events_waits_summary_by_thread_by_event_name diff --git a/scripts/sys_schema/views/p_s/io_global_by_file_by_latency.sql b/scripts/sys_schema/views/p_s/io_global_by_file_by_latency.sql index 97b0aae97c1..793d4bd7a2d 100644 --- a/scripts/sys_schema/views/p_s/io_global_by_file_by_latency.sql +++ b/scripts/sys_schema/views/p_s/io_global_by_file_by_latency.sql @@ -47,12 +47,12 @@ VIEW io_global_by_file_by_latency ( ) AS SELECT sys.format_path(file_name) AS file, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, + format_pico_time(sum_timer_wait) AS total_latency, count_read, - sys.format_time(sum_timer_read) AS read_latency, + format_pico_time(sum_timer_read) AS read_latency, count_write, - sys.format_time(sum_timer_write) AS write_latency, + format_pico_time(sum_timer_write) AS write_latency, count_misc, - sys.format_time(sum_timer_misc) AS misc_latency + format_pico_time(sum_timer_misc) AS misc_latency FROM performance_schema.file_summary_by_instance ORDER BY sum_timer_wait DESC; diff --git a/scripts/sys_schema/views/p_s/io_global_by_wait_by_bytes.sql b/scripts/sys_schema/views/p_s/io_global_by_wait_by_bytes.sql index edf6b994303..0ec1a26c6b6 100644 --- a/scripts/sys_schema/views/p_s/io_global_by_wait_by_bytes.sql +++ b/scripts/sys_schema/views/p_s/io_global_by_wait_by_bytes.sql @@ -62,10 +62,10 @@ VIEW io_global_by_wait_by_bytes ( ) AS SELECT SUBSTRING_INDEX(event_name, '/', -2) event_name, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(min_timer_wait) AS min_latency, - sys.format_time(avg_timer_wait) AS avg_latency, - sys.format_time(max_timer_wait) AS max_latency, + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(min_timer_wait) AS min_latency, + format_pico_time(avg_timer_wait) AS avg_latency, + format_pico_time(max_timer_wait) AS max_latency, count_read, sys.format_bytes(sum_number_of_bytes_read) AS total_read, sys.format_bytes(IFNULL(sum_number_of_bytes_read / NULLIF(count_read, 0), 0)) AS avg_read, diff --git a/scripts/sys_schema/views/p_s/io_global_by_wait_by_latency.sql b/scripts/sys_schema/views/p_s/io_global_by_wait_by_latency.sql index 5783e98ca4e..8391aae887f 100644 --- a/scripts/sys_schema/views/p_s/io_global_by_wait_by_latency.sql +++ b/scripts/sys_schema/views/p_s/io_global_by_wait_by_latency.sql @@ -63,12 +63,12 @@ VIEW io_global_by_wait_by_latency ( ) AS SELECT SUBSTRING_INDEX(event_name, '/', -2) AS event_name, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(avg_timer_wait) AS avg_latency, - sys.format_time(max_timer_wait) AS max_latency, - sys.format_time(sum_timer_read) AS read_latency, - sys.format_time(sum_timer_write) AS write_latency, - sys.format_time(sum_timer_misc) AS misc_latency, + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(avg_timer_wait) AS avg_latency, + format_pico_time(max_timer_wait) AS max_latency, + format_pico_time(sum_timer_read) AS read_latency, + format_pico_time(sum_timer_write) AS write_latency, + format_pico_time(sum_timer_misc) AS misc_latency, count_read, sys.format_bytes(sum_number_of_bytes_read) AS total_read, sys.format_bytes(IFNULL(sum_number_of_bytes_read / NULLIF(count_read, 0), 0)) AS avg_read, diff --git a/scripts/sys_schema/views/p_s/latest_file_io.sql b/scripts/sys_schema/views/p_s/latest_file_io.sql index 9803cc6cd8b..5289a831a2d 100644 --- a/scripts/sys_schema/views/p_s/latest_file_io.sql +++ b/scripts/sys_schema/views/p_s/latest_file_io.sql @@ -46,7 +46,7 @@ SELECT IF(id IS NULL, CONCAT(user, '@', host, ':', id) ) thread, sys.format_path(object_name) file, - sys.format_time(timer_wait) AS latency, + format_pico_time(timer_wait) AS latency, operation, sys.format_bytes(number_of_bytes) AS requested FROM performance_schema.events_waits_history_long diff --git a/scripts/sys_schema/views/p_s/processlist.sql b/scripts/sys_schema/views/p_s/processlist.sql index 33e8969f73f..e289a07bd34 100644 --- a/scripts/sys_schema/views/p_s/processlist.sql +++ b/scripts/sys_schema/views/p_s/processlist.sql @@ -82,9 +82,9 @@ SELECT pps.thread_id AS thd_id, pps.processlist_time AS time, sys.format_statement(pps.processlist_info) AS current_statement, IF(esc.end_event_id IS NULL, - sys.format_time(esc.timer_wait), + format_pico_time(esc.timer_wait), NULL) AS statement_latency, - sys.format_time(esc.lock_time) AS lock_latency, + format_pico_time(esc.lock_time) AS lock_latency, esc.rows_examined AS rows_examined, esc.rows_sent AS rows_sent, esc.rows_affected AS rows_affected, @@ -95,12 +95,12 @@ SELECT pps.thread_id AS thd_id, sys.format_statement(esc.sql_text), NULL) AS last_statement, IF(esc.end_event_id IS NOT NULL, - sys.format_time(esc.timer_wait), + format_pico_time(esc.timer_wait), NULL) AS last_statement_latency, ewc.event_name AS last_wait, IF(ewc.end_event_id IS NULL AND ewc.event_name IS NOT NULL, 'Still Waiting', - sys.format_time(ewc.timer_wait)) last_wait_latency, + format_pico_time(ewc.timer_wait)) last_wait_latency, ewc.source FROM performance_schema.threads AS pps LEFT JOIN performance_schema.events_waits_current AS ewc USING (thread_id) diff --git a/scripts/sys_schema/views/p_s/processlist_57.sql b/scripts/sys_schema/views/p_s/processlist_57.sql index 4e4f21ead3f..2cb30bd09f4 100644 --- a/scripts/sys_schema/views/p_s/processlist_57.sql +++ b/scripts/sys_schema/views/p_s/processlist_57.sql @@ -98,12 +98,12 @@ SELECT pps.thread_id AS thd_id, pps.processlist_time AS time, sys.format_statement(pps.processlist_info) AS current_statement, IF(esc.end_event_id IS NULL, - sys.format_time(esc.timer_wait), + format_pico_time(esc.timer_wait), NULL) AS statement_latency, IF(esc.end_event_id IS NULL, ROUND(100 * (estc.work_completed / estc.work_estimated), 2), NULL) AS progress, - sys.format_time(esc.lock_time) AS lock_latency, + format_pico_time(esc.lock_time) AS lock_latency, esc.rows_examined AS rows_examined, esc.rows_sent AS rows_sent, esc.rows_affected AS rows_affected, @@ -114,15 +114,15 @@ SELECT pps.thread_id AS thd_id, sys.format_statement(esc.sql_text), NULL) AS last_statement, IF(esc.end_event_id IS NOT NULL, - sys.format_time(esc.timer_wait), + format_pico_time(esc.timer_wait), NULL) AS last_statement_latency, sys.format_bytes(mem.current_allocated) AS current_memory, ewc.event_name AS last_wait, IF(ewc.end_event_id IS NULL AND ewc.event_name IS NOT NULL, 'Still Waiting', - sys.format_time(ewc.timer_wait)) last_wait_latency, + format_pico_time(ewc.timer_wait)) last_wait_latency, ewc.source, - sys.format_time(etc.timer_wait) AS trx_latency, + format_pico_time(etc.timer_wait) AS trx_latency, etc.state AS trx_state, etc.autocommit AS trx_autocommit, conattr_pid.attr_value as pid, diff --git a/scripts/sys_schema/views/p_s/schema_index_statistics.sql b/scripts/sys_schema/views/p_s/schema_index_statistics.sql index 84ce7ead5cf..794af16d199 100644 --- a/scripts/sys_schema/views/p_s/schema_index_statistics.sql +++ b/scripts/sys_schema/views/p_s/schema_index_statistics.sql @@ -53,13 +53,13 @@ SELECT OBJECT_SCHEMA AS table_schema, OBJECT_NAME AS table_name, INDEX_NAME as index_name, COUNT_FETCH AS rows_selected, - sys.format_time(SUM_TIMER_FETCH) AS select_latency, + format_pico_time(SUM_TIMER_FETCH) AS select_latency, COUNT_INSERT AS rows_inserted, - sys.format_time(SUM_TIMER_INSERT) AS insert_latency, + format_pico_time(SUM_TIMER_INSERT) AS insert_latency, COUNT_UPDATE AS rows_updated, - sys.format_time(SUM_TIMER_UPDATE) AS update_latency, + format_pico_time(SUM_TIMER_UPDATE) AS update_latency, COUNT_DELETE AS rows_deleted, - sys.format_time(SUM_TIMER_INSERT) AS delete_latency + format_pico_time(SUM_TIMER_INSERT) AS delete_latency FROM performance_schema.table_io_waits_summary_by_index_usage WHERE index_name IS NOT NULL ORDER BY sum_timer_wait DESC; diff --git a/scripts/sys_schema/views/p_s/schema_table_statistics.sql b/scripts/sys_schema/views/p_s/schema_table_statistics.sql index 198d2e0ee7c..45d714a1e36 100644 --- a/scripts/sys_schema/views/p_s/schema_table_statistics.sql +++ b/scripts/sys_schema/views/p_s/schema_table_statistics.sql @@ -70,23 +70,23 @@ VIEW schema_table_statistics ( ) AS SELECT pst.object_schema AS table_schema, pst.object_name AS table_name, - sys.format_time(pst.sum_timer_wait) AS total_latency, + format_pico_time(pst.sum_timer_wait) AS total_latency, pst.count_fetch AS rows_fetched, - sys.format_time(pst.sum_timer_fetch) AS fetch_latency, + format_pico_time(pst.sum_timer_fetch) AS fetch_latency, pst.count_insert AS rows_inserted, - sys.format_time(pst.sum_timer_insert) AS insert_latency, + format_pico_time(pst.sum_timer_insert) AS insert_latency, pst.count_update AS rows_updated, - sys.format_time(pst.sum_timer_update) AS update_latency, + format_pico_time(pst.sum_timer_update) AS update_latency, pst.count_delete AS rows_deleted, - sys.format_time(pst.sum_timer_delete) AS delete_latency, + format_pico_time(pst.sum_timer_delete) AS delete_latency, fsbi.count_read AS io_read_requests, sys.format_bytes(fsbi.sum_number_of_bytes_read) AS io_read, - sys.format_time(fsbi.sum_timer_read) AS io_read_latency, + format_pico_time(fsbi.sum_timer_read) AS io_read_latency, fsbi.count_write AS io_write_requests, sys.format_bytes(fsbi.sum_number_of_bytes_write) AS io_write, - sys.format_time(fsbi.sum_timer_write) AS io_write_latency, + format_pico_time(fsbi.sum_timer_write) AS io_write_latency, fsbi.count_misc AS io_misc_requests, - sys.format_time(fsbi.sum_timer_misc) AS io_misc_latency + format_pico_time(fsbi.sum_timer_misc) AS io_misc_latency FROM performance_schema.table_io_waits_summary_by_table AS pst LEFT JOIN x$ps_schema_table_statistics_io AS fsbi ON pst.object_schema = fsbi.table_schema diff --git a/scripts/sys_schema/views/p_s/schema_table_statistics_with_buffer.sql b/scripts/sys_schema/views/p_s/schema_table_statistics_with_buffer.sql index acdaefb355f..73342194e9e 100644 --- a/scripts/sys_schema/views/p_s/schema_table_statistics_with_buffer.sql +++ b/scripts/sys_schema/views/p_s/schema_table_statistics_with_buffer.sql @@ -87,21 +87,21 @@ VIEW schema_table_statistics_with_buffer ( SELECT pst.object_schema AS table_schema, pst.object_name AS table_name, pst.count_fetch AS rows_fetched, - sys.format_time(pst.sum_timer_fetch) AS fetch_latency, + format_pico_time(pst.sum_timer_fetch) AS fetch_latency, pst.count_insert AS rows_inserted, - sys.format_time(pst.sum_timer_insert) AS insert_latency, + format_pico_time(pst.sum_timer_insert) AS insert_latency, pst.count_update AS rows_updated, - sys.format_time(pst.sum_timer_update) AS update_latency, + format_pico_time(pst.sum_timer_update) AS update_latency, pst.count_delete AS rows_deleted, - sys.format_time(pst.sum_timer_delete) AS delete_latency, + format_pico_time(pst.sum_timer_delete) AS delete_latency, fsbi.count_read AS io_read_requests, sys.format_bytes(fsbi.sum_number_of_bytes_read) AS io_read, - sys.format_time(fsbi.sum_timer_read) AS io_read_latency, + format_pico_time(fsbi.sum_timer_read) AS io_read_latency, fsbi.count_write AS io_write_requests, sys.format_bytes(fsbi.sum_number_of_bytes_write) AS io_write, - sys.format_time(fsbi.sum_timer_write) AS io_write_latency, + format_pico_time(fsbi.sum_timer_write) AS io_write_latency, fsbi.count_misc AS io_misc_requests, - sys.format_time(fsbi.sum_timer_misc) AS io_misc_latency, + format_pico_time(fsbi.sum_timer_misc) AS io_misc_latency, sys.format_bytes(ibp.allocated) AS innodb_buffer_allocated, sys.format_bytes(ibp.data) AS innodb_buffer_data, sys.format_bytes(ibp.allocated - ibp.data) AS innodb_buffer_free, diff --git a/scripts/sys_schema/views/p_s/schema_tables_with_full_table_scans.sql b/scripts/sys_schema/views/p_s/schema_tables_with_full_table_scans.sql index 6199d244dd2..5d7c898f5ec 100644 --- a/scripts/sys_schema/views/p_s/schema_tables_with_full_table_scans.sql +++ b/scripts/sys_schema/views/p_s/schema_tables_with_full_table_scans.sql @@ -44,7 +44,7 @@ VIEW schema_tables_with_full_table_scans ( SELECT object_schema, object_name, count_read AS rows_full_scanned, - sys.format_time(sum_timer_wait) AS latency + format_pico_time(sum_timer_wait) AS latency FROM performance_schema.table_io_waits_summary_by_index_usage WHERE index_name IS NULL AND count_read > 0 diff --git a/scripts/sys_schema/views/p_s/statement_analysis.sql b/scripts/sys_schema/views/p_s/statement_analysis.sql index 0d9c9cef32c..c1853311adf 100644 --- a/scripts/sys_schema/views/p_s/statement_analysis.sql +++ b/scripts/sys_schema/views/p_s/statement_analysis.sql @@ -82,10 +82,10 @@ SELECT sys.format_statement(DIGEST_TEXT) AS query, COUNT_STAR AS exec_count, SUM_ERRORS AS err_count, SUM_WARNINGS AS warn_count, - sys.format_time(SUM_TIMER_WAIT) AS total_latency, - sys.format_time(MAX_TIMER_WAIT) AS max_latency, - sys.format_time(AVG_TIMER_WAIT) AS avg_latency, - sys.format_time(SUM_LOCK_TIME) AS lock_latency, + format_pico_time(SUM_TIMER_WAIT) AS total_latency, + format_pico_time(MAX_TIMER_WAIT) AS max_latency, + format_pico_time(AVG_TIMER_WAIT) AS avg_latency, + format_pico_time(SUM_LOCK_TIME) AS lock_latency, SUM_ROWS_SENT AS rows_sent, ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg, SUM_ROWS_EXAMINED AS rows_examined, diff --git a/scripts/sys_schema/views/p_s/statements_with_full_table_scans.sql b/scripts/sys_schema/views/p_s/statements_with_full_table_scans.sql index 842173645f5..820a5a9c11c 100644 --- a/scripts/sys_schema/views/p_s/statements_with_full_table_scans.sql +++ b/scripts/sys_schema/views/p_s/statements_with_full_table_scans.sql @@ -64,7 +64,7 @@ VIEW statements_with_full_table_scans ( SELECT sys.format_statement(DIGEST_TEXT) AS query, SCHEMA_NAME as db, COUNT_STAR AS exec_count, - sys.format_time(SUM_TIMER_WAIT) AS total_latency, + format_pico_time(SUM_TIMER_WAIT) AS total_latency, SUM_NO_INDEX_USED AS no_index_used_count, SUM_NO_GOOD_INDEX_USED AS no_good_index_used_count, ROUND(IFNULL(SUM_NO_INDEX_USED / NULLIF(COUNT_STAR, 0), 0) * 100) AS no_index_used_pct, diff --git a/scripts/sys_schema/views/p_s/statements_with_runtimes_in_95th_percentile.sql b/scripts/sys_schema/views/p_s/statements_with_runtimes_in_95th_percentile.sql index 6e2489ed84c..51c5e0b1028 100644 --- a/scripts/sys_schema/views/p_s/statements_with_runtimes_in_95th_percentile.sql +++ b/scripts/sys_schema/views/p_s/statements_with_runtimes_in_95th_percentile.sql @@ -58,9 +58,9 @@ SELECT sys.format_statement(DIGEST_TEXT) AS query, COUNT_STAR AS exec_count, SUM_ERRORS AS err_count, SUM_WARNINGS AS warn_count, - sys.format_time(SUM_TIMER_WAIT) AS total_latency, - sys.format_time(MAX_TIMER_WAIT) AS max_latency, - sys.format_time(AVG_TIMER_WAIT) AS avg_latency, + format_pico_time(SUM_TIMER_WAIT) AS total_latency, + format_pico_time(MAX_TIMER_WAIT) AS max_latency, + format_pico_time(AVG_TIMER_WAIT) AS avg_latency, SUM_ROWS_SENT AS rows_sent, ROUND(IFNULL(SUM_ROWS_SENT / NULLIF(COUNT_STAR, 0), 0)) AS rows_sent_avg, SUM_ROWS_EXAMINED AS rows_examined, diff --git a/scripts/sys_schema/views/p_s/statements_with_sorting.sql b/scripts/sys_schema/views/p_s/statements_with_sorting.sql index 0216a12ed4d..a26910a0749 100644 --- a/scripts/sys_schema/views/p_s/statements_with_sorting.sql +++ b/scripts/sys_schema/views/p_s/statements_with_sorting.sql @@ -58,7 +58,7 @@ VIEW statements_with_sorting ( SELECT sys.format_statement(DIGEST_TEXT) AS query, SCHEMA_NAME db, COUNT_STAR AS exec_count, - sys.format_time(SUM_TIMER_WAIT) AS total_latency, + format_pico_time(SUM_TIMER_WAIT) AS total_latency, SUM_SORT_MERGE_PASSES AS sort_merge_passes, ROUND(IFNULL(SUM_SORT_MERGE_PASSES / NULLIF(COUNT_STAR, 0), 0)) AS avg_sort_merges, SUM_SORT_SCAN AS sorts_using_scans, diff --git a/scripts/sys_schema/views/p_s/statements_with_temp_tables.sql b/scripts/sys_schema/views/p_s/statements_with_temp_tables.sql index 3f9dfbc6299..687b303f40e 100644 --- a/scripts/sys_schema/views/p_s/statements_with_temp_tables.sql +++ b/scripts/sys_schema/views/p_s/statements_with_temp_tables.sql @@ -55,7 +55,7 @@ VIEW statements_with_temp_tables ( SELECT sys.format_statement(DIGEST_TEXT) AS query, SCHEMA_NAME as db, COUNT_STAR AS exec_count, - sys.format_time(SUM_TIMER_WAIT) as total_latency, + format_pico_time(SUM_TIMER_WAIT) as total_latency, SUM_CREATED_TMP_TABLES AS memory_tmp_tables, SUM_CREATED_TMP_DISK_TABLES AS disk_tmp_tables, ROUND(IFNULL(SUM_CREATED_TMP_TABLES / NULLIF(COUNT_STAR, 0), 0)) AS avg_tmp_tables_per_query, diff --git a/scripts/sys_schema/views/p_s/user_summary.sql b/scripts/sys_schema/views/p_s/user_summary.sql index 85f08878972..a0d1e308656 100644 --- a/scripts/sys_schema/views/p_s/user_summary.sql +++ b/scripts/sys_schema/views/p_s/user_summary.sql @@ -46,11 +46,11 @@ VIEW user_summary ( ) AS SELECT IF(accounts.user IS NULL, 'background', accounts.user) AS user, SUM(stmt.total) AS statements, - sys.format_time(SUM(stmt.total_latency)) AS statement_latency, - sys.format_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, + format_pico_time(SUM(stmt.total_latency)) AS statement_latency, + format_pico_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, - sys.format_time(SUM(io.io_latency)) AS file_io_latency, + format_pico_time(SUM(io.io_latency)) AS file_io_latency, SUM(accounts.current_connections) AS current_connections, SUM(accounts.total_connections) AS total_connections, COUNT(DISTINCT host) AS unique_hosts diff --git a/scripts/sys_schema/views/p_s/user_summary_57.sql b/scripts/sys_schema/views/p_s/user_summary_57.sql index a3147a17714..07695689f84 100644 --- a/scripts/sys_schema/views/p_s/user_summary_57.sql +++ b/scripts/sys_schema/views/p_s/user_summary_57.sql @@ -49,11 +49,11 @@ VIEW user_summary ( ) AS SELECT IF(accounts.user IS NULL, 'background', accounts.user) AS user, SUM(stmt.total) AS statements, - sys.format_time(SUM(stmt.total_latency)) AS statement_latency, - sys.format_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, + format_pico_time(SUM(stmt.total_latency)) AS statement_latency, + format_pico_time(IFNULL(SUM(stmt.total_latency) / NULLIF(SUM(stmt.total), 0), 0)) AS statement_avg_latency, SUM(stmt.full_scans) AS table_scans, SUM(io.ios) AS file_ios, - sys.format_time(SUM(io.io_latency)) AS file_io_latency, + format_pico_time(SUM(io.io_latency)) AS file_io_latency, SUM(accounts.current_connections) AS current_connections, SUM(accounts.total_connections) AS total_connections, COUNT(DISTINCT host) AS unique_hosts, diff --git a/scripts/sys_schema/views/p_s/user_summary_by_file_io.sql b/scripts/sys_schema/views/p_s/user_summary_by_file_io.sql index 85862d50ecd..9afc2028c27 100644 --- a/scripts/sys_schema/views/p_s/user_summary_by_file_io.sql +++ b/scripts/sys_schema/views/p_s/user_summary_by_file_io.sql @@ -40,7 +40,7 @@ VIEW user_summary_by_file_io ( ) AS SELECT IF(user IS NULL, 'background', user) AS user, SUM(count_star) AS ios, - sys.format_time(SUM(sum_timer_wait)) AS io_latency + format_pico_time(SUM(sum_timer_wait)) AS io_latency FROM performance_schema.events_waits_summary_by_user_by_event_name WHERE event_name LIKE 'wait/io/file/%' GROUP BY IF(user IS NULL, 'background', user) diff --git a/scripts/sys_schema/views/p_s/user_summary_by_file_io_type.sql b/scripts/sys_schema/views/p_s/user_summary_by_file_io_type.sql index 37b4b14bc8f..665f65c339b 100644 --- a/scripts/sys_schema/views/p_s/user_summary_by_file_io_type.sql +++ b/scripts/sys_schema/views/p_s/user_summary_by_file_io_type.sql @@ -58,8 +58,8 @@ VIEW user_summary_by_file_io_type ( SELECT IF(user IS NULL, 'background', user) AS user, event_name, count_star AS total, - sys.format_time(sum_timer_wait) AS latency, - sys.format_time(max_timer_wait) AS max_latency + format_pico_time(sum_timer_wait) AS latency, + format_pico_time(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_by_user_by_event_name WHERE event_name LIKE 'wait/io/file%' AND count_star > 0 diff --git a/scripts/sys_schema/views/p_s/user_summary_by_stages.sql b/scripts/sys_schema/views/p_s/user_summary_by_stages.sql index ab34a3ee107..8706fe06c95 100644 --- a/scripts/sys_schema/views/p_s/user_summary_by_stages.sql +++ b/scripts/sys_schema/views/p_s/user_summary_by_stages.sql @@ -57,8 +57,8 @@ VIEW user_summary_by_stages ( SELECT IF(user IS NULL, 'background', user) AS user, event_name, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(avg_timer_wait) AS avg_latency + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(avg_timer_wait) AS avg_latency FROM performance_schema.events_stages_summary_by_user_by_event_name WHERE sum_timer_wait != 0 ORDER BY user, sum_timer_wait DESC; diff --git a/scripts/sys_schema/views/p_s/user_summary_by_statement_latency.sql b/scripts/sys_schema/views/p_s/user_summary_by_statement_latency.sql index 2c6e0b50ccf..a07989a4ad6 100644 --- a/scripts/sys_schema/views/p_s/user_summary_by_statement_latency.sql +++ b/scripts/sys_schema/views/p_s/user_summary_by_statement_latency.sql @@ -45,9 +45,9 @@ VIEW user_summary_by_statement_latency ( ) AS SELECT IF(user IS NULL, 'background', user) AS user, SUM(count_star) AS total, - sys.format_time(SUM(sum_timer_wait)) AS total_latency, - sys.format_time(SUM(max_timer_wait)) AS max_latency, - sys.format_time(SUM(sum_lock_time)) AS lock_latency, + format_pico_time(SUM(sum_timer_wait)) AS total_latency, + format_pico_time(SUM(max_timer_wait)) AS max_latency, + format_pico_time(SUM(sum_lock_time)) AS lock_latency, SUM(sum_rows_sent) AS rows_sent, SUM(sum_rows_examined) AS rows_examined, SUM(sum_rows_affected) AS rows_affected, diff --git a/scripts/sys_schema/views/p_s/user_summary_by_statement_type.sql b/scripts/sys_schema/views/p_s/user_summary_by_statement_type.sql index f9ddc2bb4ff..f5a3cfc94cd 100644 --- a/scripts/sys_schema/views/p_s/user_summary_by_statement_type.sql +++ b/scripts/sys_schema/views/p_s/user_summary_by_statement_type.sql @@ -52,9 +52,9 @@ VIEW user_summary_by_statement_type ( SELECT IF(user IS NULL, 'background', user) AS user, SUBSTRING_INDEX(event_name, '/', -1) AS statement, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(max_timer_wait) AS max_latency, - sys.format_time(sum_lock_time) AS lock_latency, + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(max_timer_wait) AS max_latency, + format_pico_time(sum_lock_time) AS lock_latency, sum_rows_sent AS rows_sent, sum_rows_examined AS rows_examined, sum_rows_affected AS rows_affected, diff --git a/scripts/sys_schema/views/p_s/wait_classes_global_by_avg_latency.sql b/scripts/sys_schema/views/p_s/wait_classes_global_by_avg_latency.sql index faee58230a9..b707eb27b6c 100644 --- a/scripts/sys_schema/views/p_s/wait_classes_global_by_avg_latency.sql +++ b/scripts/sys_schema/views/p_s/wait_classes_global_by_avg_latency.sql @@ -45,10 +45,10 @@ VIEW wait_classes_global_by_avg_latency ( ) AS SELECT SUBSTRING_INDEX(event_name,'/', 3) AS event_class, SUM(COUNT_STAR) AS total, - sys.format_time(CAST(SUM(sum_timer_wait) AS UNSIGNED)) AS total_latency, - sys.format_time(MIN(min_timer_wait)) AS min_latency, - sys.format_time(IFNULL(SUM(sum_timer_wait) / NULLIF(SUM(COUNT_STAR), 0), 0)) AS avg_latency, - sys.format_time(CAST(MAX(max_timer_wait) AS UNSIGNED)) AS max_latency + format_pico_time(CAST(SUM(sum_timer_wait) AS UNSIGNED)) AS total_latency, + format_pico_time(MIN(min_timer_wait)) AS min_latency, + format_pico_time(IFNULL(SUM(sum_timer_wait) / NULLIF(SUM(COUNT_STAR), 0), 0)) AS avg_latency, + format_pico_time(CAST(MAX(max_timer_wait) AS UNSIGNED)) AS max_latency FROM performance_schema.events_waits_summary_global_by_event_name WHERE sum_timer_wait > 0 AND event_name != 'idle' diff --git a/scripts/sys_schema/views/p_s/wait_classes_global_by_latency.sql b/scripts/sys_schema/views/p_s/wait_classes_global_by_latency.sql index 5675c3f589a..c89bf46e6de 100644 --- a/scripts/sys_schema/views/p_s/wait_classes_global_by_latency.sql +++ b/scripts/sys_schema/views/p_s/wait_classes_global_by_latency.sql @@ -45,10 +45,10 @@ VIEW wait_classes_global_by_latency ( ) AS SELECT SUBSTRING_INDEX(event_name,'/', 3) AS event_class, SUM(COUNT_STAR) AS total, - sys.format_time(SUM(sum_timer_wait)) AS total_latency, - sys.format_time(MIN(min_timer_wait)) min_latency, - sys.format_time(IFNULL(SUM(sum_timer_wait) / NULLIF(SUM(COUNT_STAR), 0), 0)) AS avg_latency, - sys.format_time(MAX(max_timer_wait)) AS max_latency + format_pico_time(SUM(sum_timer_wait)) AS total_latency, + format_pico_time(MIN(min_timer_wait)) min_latency, + format_pico_time(IFNULL(SUM(sum_timer_wait) / NULLIF(SUM(COUNT_STAR), 0), 0)) AS avg_latency, + format_pico_time(MAX(max_timer_wait)) AS max_latency FROM performance_schema.events_waits_summary_global_by_event_name WHERE sum_timer_wait > 0 AND event_name != 'idle' diff --git a/scripts/sys_schema/views/p_s/waits_by_host_by_latency.sql b/scripts/sys_schema/views/p_s/waits_by_host_by_latency.sql index 5587fee210f..2ddad55d4e1 100644 --- a/scripts/sys_schema/views/p_s/waits_by_host_by_latency.sql +++ b/scripts/sys_schema/views/p_s/waits_by_host_by_latency.sql @@ -45,9 +45,9 @@ VIEW waits_by_host_by_latency ( SELECT IF(host IS NULL, 'background', host) AS host, event_name AS event, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(avg_timer_wait) AS avg_latency, - sys.format_time(max_timer_wait) AS max_latency + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(avg_timer_wait) AS avg_latency, + format_pico_time(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_by_host_by_event_name WHERE event_name != 'idle' AND sum_timer_wait > 0 diff --git a/scripts/sys_schema/views/p_s/waits_by_user_by_latency.sql b/scripts/sys_schema/views/p_s/waits_by_user_by_latency.sql index 5a6a618ecc6..63c71b3e1ae 100644 --- a/scripts/sys_schema/views/p_s/waits_by_user_by_latency.sql +++ b/scripts/sys_schema/views/p_s/waits_by_user_by_latency.sql @@ -55,9 +55,9 @@ VIEW waits_by_user_by_latency ( SELECT IF(user IS NULL, 'background', user) AS user, event_name AS event, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(avg_timer_wait) AS avg_latency, - sys.format_time(max_timer_wait) AS max_latency + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(avg_timer_wait) AS avg_latency, + format_pico_time(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_by_user_by_event_name WHERE event_name != 'idle' AND user IS NOT NULL diff --git a/scripts/sys_schema/views/p_s/waits_global_by_latency.sql b/scripts/sys_schema/views/p_s/waits_global_by_latency.sql index a41be3b1448..67b1a533131 100644 --- a/scripts/sys_schema/views/p_s/waits_global_by_latency.sql +++ b/scripts/sys_schema/views/p_s/waits_global_by_latency.sql @@ -43,9 +43,9 @@ VIEW waits_global_by_latency ( ) AS SELECT event_name AS event, count_star AS total, - sys.format_time(sum_timer_wait) AS total_latency, - sys.format_time(avg_timer_wait) AS avg_latency, - sys.format_time(max_timer_wait) AS max_latency + format_pico_time(sum_timer_wait) AS total_latency, + format_pico_time(avg_timer_wait) AS avg_latency, + format_pico_time(max_timer_wait) AS max_latency FROM performance_schema.events_waits_summary_global_by_event_name WHERE event_name != 'idle' AND sum_timer_wait > 0 diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index be0e2d214e0..4938f8da02b 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -104,7 +104,7 @@ SET (SQL_SOURCE handler.cc hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc item_create.cc item_func.cc item_geofunc.cc item_row.cc - item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc item_pfsfunc.cc + item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc key.cc log.cc lock.cc log_event.cc log_event_server.cc rpl_record.cc rpl_reporting.cc diff --git a/sql/item.h b/sql/item.h index 515a9abb310..5956b810d51 100644 --- a/sql/item.h +++ b/sql/item.h @@ -6371,7 +6371,6 @@ public: #include "item_jsonfunc.h" #include "item_create.h" #include "item_vers.h" -#include "item_pfsfunc.h" #endif /** diff --git a/sql/item_create.cc b/sql/item_create.cc index dc8359346a0..704d86d0ec3 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -3588,7 +3588,7 @@ Create_func_format_pico_time Create_func_format_pico_time::s_singleton; Item* Create_func_format_pico_time::create_1_arg(THD *thd, Item *arg1) { - return new (thd->mem_root) Item_func_pfs_format_pico_time(thd, arg1); + return new (thd->mem_root) Item_func_format_pico_time(thd, arg1); } diff --git a/sql/item_pfsfunc.cc b/sql/item_pfsfunc.cc deleted file mode 100644 index 8ac7df50866..00000000000 --- a/sql/item_pfsfunc.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright (c) 2000, 2023, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -/** - @file - - @brief - This file defines all performance schema native functions - FORMAT_PICO_TIME() -*/ - -#ifdef USE_PRAGMA_IMPLEMENTATION -#pragma implementation // gcc: Class implementation -#endif - -#include "mariadb.h" // HAVE_* - -/* - It is necessary to include set_var.h instead of item.h because there - are dependencies on include order for set_var.h and item.h. This - will be resolved later. -*/ -#include "set_var.h" - -/** format_pico_time() */ - -bool Item_func_pfs_format_pico_time::fix_length_and_dec(THD *) -{ - set_maybe_null(); - /* Format is 'AAAA.BB UUU' = 11 characters or 'AAA ps' = 6 characters. */ - m_value.set_charset(&my_charset_utf8mb3_general_ci); - return false; -} - - -String *Item_func_pfs_format_pico_time::val_str(String *str __attribute__ ((__unused__))) -{ - /* Evaluate the argument */ - double time_val= args[0]->val_real(); - - /* If argument is null, return null. */ - null_value= args[0]->null_value; - if (null_value) - return 0; - - constexpr uint64_t nano{1000}; - constexpr uint64_t micro{1000 * nano}; - constexpr uint64_t milli{1000 * micro}; - constexpr uint64_t sec{1000 * milli}; - constexpr uint64_t min{60 * sec}; - constexpr uint64_t hour{60 * min}; - constexpr uint64_t day{24 * hour}; - - /* Declaring 'volatile' as workaround for 32-bit optimization bug. */ - volatile double time_abs= abs(time_val); - - uint64_t divisor; - int len; - const char *unit; - - /* SI-approved time units. */ - if (time_abs >= day) - { - divisor= day; - unit= "d"; - } - else if (time_abs >= hour) - { - divisor= hour; - unit= "h"; - } - else if (time_abs >= min) - { - divisor= min; - unit= "min"; - } - else if (time_abs >= sec) - { - divisor= sec; - unit= "s"; - } - else if (time_abs >= milli) - { - divisor= milli; - unit= "ms"; - } - else if (time_abs >= micro) - { - divisor= micro; - unit= "us"; - } - else if (time_abs >= nano) - { - divisor= nano; - unit= "ns"; - } - else - { - divisor= 1; - unit= "ps"; - } - - if (divisor == 1) - len= snprintf(m_value_buffer, sizeof(m_value_buffer), "%3d %s", (int)time_val, unit); - else - { - double value= time_val / divisor; - if (abs(value) >= 100000.0) - len= snprintf(m_value_buffer, sizeof(m_value_buffer), "%4.2e %s", value, unit); - else - len= snprintf(m_value_buffer, sizeof(m_value_buffer), "%4.2f %s", value, unit); - } - - m_value.set(m_value_buffer, len, &my_charset_utf8mb3_general_ci); - return &m_value; -} diff --git a/sql/item_pfsfunc.h b/sql/item_pfsfunc.h deleted file mode 100644 index ee3c111e15c..00000000000 --- a/sql/item_pfsfunc.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef ITEM_PFS_FUNC_INCLUDED -#define ITEM_PFS_FUNC_INCLUDED - -/* Copyright (c) 2000, 2023, Oracle and/or its affiliates. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License, version 2.0, - as published by the Free Software Foundation. - - This program is also distributed with certain software (including - but not limited to OpenSSL) that is licensed under separate terms, - as designated in a particular file or component or in included license - documentation. The authors of MySQL hereby grant you an additional - permission to link the program and your derivative works with the - separately licensed software that they have included with MySQL. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License, version 2.0, for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#ifdef USE_PRAGMA_INTERFACE -#pragma interface /* gcc class implementation */ -#endif - -#include "item_func.h" // Item_str_func, Item_int_func - -/** format_pico_time() */ - -class Item_func_pfs_format_pico_time : public Item_str_func { - String m_value; - char m_value_buffer[12]; - -public: - Item_func_pfs_format_pico_time(THD *thd, Item *a) - : Item_str_func(thd, a){}; - String *val_str(String *str __attribute__ ((__unused__))) override; - LEX_CSTRING func_name_cstring() const override - { - static LEX_CSTRING name= {STRING_WITH_LEN("format_pico_time")}; - return name; - } - bool fix_length_and_dec(THD *thd) override; - Item *get_copy(THD *thd) override - { - return get_item_copy(thd, this); - } -}; - -#endif diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index b38d7086548..4b2f1aecf45 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -5824,6 +5824,84 @@ bool Item_func_natural_sort_key::check_vcol_func_processor(void *arg) VCOL_NON_DETERMINISTIC); } +String *Item_func_format_pico_time::val_str_ascii(String *) +{ + double time_val= args[0]->val_real(); + + null_value= args[0]->null_value; + if (null_value) + return 0; + + constexpr ulonglong nano{1000}; + constexpr ulonglong micro{1000 * nano}; + constexpr ulonglong milli{1000 * micro}; + constexpr ulonglong sec{1000 * milli}; + constexpr ulonglong min{60 * sec}; + constexpr ulonglong hour{60 * min}; + constexpr ulonglong day{24 * hour}; + + double time_abs= fabs(time_val); + + ulonglong divisor; + size_t len; + const char *unit; + + /* SI-approved time units. */ + if (time_abs >= day) + { + divisor= day; + unit= "d"; + } + else if (time_abs >= hour) + { + divisor= hour; + unit= "h"; + } + else if (time_abs >= min) + { + divisor= min; + unit= "min"; + } + else if (time_abs >= sec) + { + divisor= sec; + unit= "s"; + } + else if (time_abs >= milli) + { + divisor= milli; + unit= "ms"; + } + else if (time_abs >= micro) + { + divisor= micro; + unit= "us"; + } + else if (time_abs >= nano) + { + divisor= nano; + unit= "ns"; + } + else + { + divisor= 1; + unit= "ps"; + } + + if (divisor == 1) + len= my_snprintf(m_value_buffer, sizeof(m_value_buffer), "%3d %s", (int)time_val, unit); + else + { + double value= time_val / divisor; + if (fabs(value) >= 100000.0) + len= snprintf(m_value_buffer, sizeof(m_value_buffer), "%4.2e %s", value, unit); + else + len= my_snprintf(m_value_buffer, sizeof(m_value_buffer), "%4.2f %s", value, unit); + } + m_value.length(len); + return &m_value; +} + #ifdef WITH_WSREP #include "wsrep_mysqld.h" #include "wsrep_server_state.h" diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 3a3c53385b0..ad68ceea3f6 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -2220,6 +2220,33 @@ public: Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; + +class Item_func_format_pico_time : public Item_str_ascii_func +{ + /* Format is 'AAAA.BB UUU' = 11 characters or 'AAA ps' = 6 characters. */ + char m_value_buffer[12]; + String m_value; + +public: + Item_func_format_pico_time(THD *thd, Item *a): Item_str_ascii_func(thd, a) {} + String *val_str_ascii(String *) override; + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("format_pico_time")}; + return name; + } + bool fix_length_and_dec(THD *thd) override + { + m_value.set(m_value_buffer, sizeof(m_value_buffer), default_charset()); + fix_length_and_charset(sizeof(m_value_buffer), default_charset()); + return false; + } + Item *get_copy(THD *thd) override + { + return get_item_copy(thd, this); + } +}; + #ifdef WITH_WSREP #include "wsrep_api.h" From 6c3b1dced41c238f814aeabbc725e31c3106c0f4 Mon Sep 17 00:00:00 2001 From: Shivam Choudhary Date: Mon, 27 Mar 2023 20:32:58 +0530 Subject: [PATCH 12/14] Fixed some typos in optimizer_costs.txt --- Docs/optimizer_costs.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Docs/optimizer_costs.txt b/Docs/optimizer_costs.txt index dcb8bca7a23..8518728a43e 100644 --- a/Docs/optimizer_costs.txt +++ b/Docs/optimizer_costs.txt @@ -23,7 +23,7 @@ The MariaDB server is started with the options: - InnoDB is a clustered engine where secondary indexes has to use the clustered index to find a row (not a common case among storage engines). -The old assumption in the optimzer has 'always' been that +The old assumption in the optimizer has 'always' been that 1 cost = 1 seek = 1 index = 1 row lookup = 0.10ms. However 1 seek != 1 index or row look and this has not been reflected in most other cost. @@ -135,7 +135,7 @@ MariaDB [test]> select 885402302809000-884884140290000; As seen above, the above gives the total statement time not the time spent to access the tables. -In the end, I dediced to use analyze to find out the cost of the table +In the end, I decided to use analyze to find out the cost of the table actions: For example: Finding out table scan timing (and thus costs): @@ -147,7 +147,7 @@ r_table_time_ms": 1189.239022 Calculating 'optimizer_where_cost' ================================== -To make the WHERE cost reasonble (not too low) we are assuming there is +To make the WHERE cost reasonable (not too low) we are assuming there is 2 simple conditions in the default 'WHERE clause' MariaDB [test]> select benchmark(100000000,l_commitDate >= '2000-01-01' and l_tax >= 0.0) from test.check_costs limit 1; @@ -300,7 +300,7 @@ r_table_time_ms: 12.47830611 Note that for sequence index and table scan is the same thing. We need to have a row_copy/key_copy cost as this is used when doing an key lookup for sequence. Setting these to 50% of the full cost -should be sufficent for now. +should be sufficient for now. Calculation sequence_scan_cost: @@ -982,7 +982,7 @@ MyRocks Range scan select sum(l_orderkey) from test.check_costs_rocksdb force index(l_suppkey) where l_suppkey >= 0 and l_partkey >=0 and l_discount>=0.0 The MyRocks engine estimates the number of rows both for the table and -for the to be about 2M, double the real ammount. +for the to be about 2M, double the real amount. The timing and costs from check_costs.pl are: @@ -1014,7 +1014,7 @@ is heap with binary-tree indexes. Ideas of how to fix this: - Change KEY_LOOKUP_COST, INDEX_BLOCK_COPY_COST and ROW_LOOKUP_COST - (for clustered index) to take into account the hight of the B tree. + (for clustered index) to take into account the height of the B tree. Observations @@ -1022,7 +1022,7 @@ Observations Ratio between table scan and range scan -Quereyies used: +Queries used: select sum(l_quantity) from check_costs_aria; select sum(l_orderkey) from test.check_costs_aria force index(l_suppkey) where l_suppkey >= 0 and l_partkey >=0 and l_discount>=0.0; @@ -1086,7 +1086,7 @@ Call graph -> KEY_COPY_COST = 1.33/1.96 = 0.6785 parts of the index_read_next -Total cost increase from 2 -> 4 key parts = 1.96 / 1.40 = 40% +Total cost increases from 2 -> 4 key parts = 1.96 / 1.40 = 40% This includes the additional work in having more key pages, more work in finding next key (if key parts are packed or possible null) ,and copying the key parts to the record From dfa90257f6a7be45b421798e56e7e9c1f27caf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 28 Mar 2023 11:44:24 +0300 Subject: [PATCH 13/14] MDEV-30936 clang 15.0.7 -fsanitize=memory fails massively handle_slave_io(), handle_slave_sql(), os_thread_exit(): Remove a redundant pthread_exit(nullptr) call, because it would cause SIGSEGV. mysql_print_status(): Add MEM_MAKE_DEFINED() to work around some missing instrumentation around mallinfo2(). que_graph_free_stat_list(): Invoke que_node_get_next(node) before que_graph_free_recursive(node). That is the logical and MSAN_OPTIONS=poison_in_dtor=1 compatible way of freeing memory. ins_node_t::~ins_node_t(): Invoke mem_heap_free(entry_sys_heap). que_graph_free_recursive(): Rely on ins_node_t::~ins_node_t(). fts_t::~fts_t(): Invoke mem_heap_free(fts_heap). fts_free(): Replace with direct calls to fts_t::~fts_t(). The failures in free_root() due to MSAN_OPTIONS=poison_in_dtor=1 will be covered in MDEV-30942. --- sql/slave.cc | 6 ++---- sql/sql_test.cc | 4 ++++ storage/innobase/buf/buf0flu.cc | 4 +--- storage/innobase/dict/dict0dict.cc | 4 ++-- storage/innobase/dict/dict0load.cc | 3 ++- storage/innobase/dict/dict0mem.cc | 2 +- storage/innobase/fil/fil0crypt.cc | 4 +--- storage/innobase/fts/fts0fts.cc | 23 ++++------------------- storage/innobase/handler/ha_innodb.cc | 3 ++- storage/innobase/handler/handler0alter.cc | 6 ++++-- storage/innobase/include/fts0fts.h | 8 -------- storage/innobase/include/os0thread.h | 2 +- storage/innobase/include/row0ins.h | 1 + storage/innobase/os/os0thread.cc | 4 ++-- storage/innobase/que/que0que.cc | 13 ++----------- storage/innobase/row/row0mysql.cc | 4 ++-- storage/innobase/trx/trx0roll.cc | 4 +--- 17 files changed, 32 insertions(+), 63 deletions(-) diff --git a/sql/slave.cc b/sql/slave.cc index d4de869ba58..17379eda5a6 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5060,8 +5060,7 @@ err_during_init: DBUG_LEAVE; // Must match DBUG_ENTER() my_thread_end(); ERR_remove_state(0); - pthread_exit(0); - return 0; // Avoid compiler warnings + return nullptr; } /* @@ -5766,8 +5765,7 @@ err_during_init: DBUG_LEAVE; // Must match DBUG_ENTER() my_thread_end(); ERR_remove_state(0); - pthread_exit(0); - return 0; // Avoid compiler warnings + return nullptr; } diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 07ebcc7a37a..41adcce2135 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -623,6 +623,10 @@ Next alarm time: %lu\n", #elif defined(HAVE_MALLINFO) struct mallinfo info= mallinfo(); #endif +#if __has_feature(memory_sanitizer) + /* Work around missing MSAN instrumentation */ + MEM_MAKE_DEFINED(&info, sizeof info); +#endif #if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2) char llbuff[10][22]; printf("\nMemory status:\n\ diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index ee8bdaeb19d..77b1886ea5f 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2465,9 +2465,7 @@ next: my_thread_end(); /* We count the number of threads in os_thread_exit(). A created thread should always use that to exit and not use return() to exit. */ - os_thread_exit(); - - OS_THREAD_DUMMY_RETURN; + return os_thread_exit(); } /** Initialize page_cleaner. */ diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index a607b2b9576..cfc39dd8e32 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1962,8 +1962,8 @@ void dict_sys_t::remove(dict_table_t* table, bool lru, bool keep) #ifdef BTR_CUR_HASH_ADAPT if (table->fts) { fts_optimize_remove_table(table); - fts_free(table); - table->fts = NULL; + table->fts->~fts_t(); + table->fts = nullptr; } table->autoinc_mutex.lock(); diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index b7ace9db87f..5db679dbfc9 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -3092,7 +3092,8 @@ func_exit: /* the table->fts could be created in dict_load_column when a user defined FTS_DOC_ID is present, but no FTS */ - fts_free(table); + table->fts->~fts_t(); + table->fts = nullptr; } else if (fts_optimize_wq) { fts_optimize_add_table(table); } else if (table->can_be_evicted) { diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 9af27b6485d..bbdab865e3a 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -224,7 +224,7 @@ dict_mem_table_free( || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID) || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_ADD_DOC_ID)) { if (table->fts) { - fts_free(table); + table->fts->~fts_t(); } } diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 15e427a0ea5..3bc0f3e1f1f 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2240,9 +2240,7 @@ DECLARE_THREAD(fil_crypt_thread)(void*) /* We count the number of threads in os_thread_exit(). A created thread should always use that to exit and not use return() to exit. */ - os_thread_exit(); - - OS_THREAD_DUMMY_RETURN; + return os_thread_exit(); } /********************************************************************* diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index e35a7efa678..d0931de9614 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -833,7 +833,8 @@ void fts_clear_all(dict_table_t *table, trx_t *trx) fts_optimize_remove_table(table); fts_drop_tables(trx, table); - fts_free(table); + table->fts->~fts_t(); + table->fts= nullptr; DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS); } @@ -5350,14 +5351,14 @@ fts_t::~fts_t() { ut_ad(add_wq == NULL); - if (cache != NULL) { + if (cache) { fts_cache_clear(cache); fts_cache_destroy(cache); - cache = NULL; } /* There is no need to call ib_vector_free() on this->indexes because it is stored in this->fts_heap. */ + mem_heap_free(fts_heap); } /*********************************************************************//** @@ -5380,22 +5381,6 @@ fts_create( return(fts); } -/*********************************************************************//** -Free the FTS resources. */ -void -fts_free( -/*=====*/ - dict_table_t* table) /*!< in/out: table with FTS indexes */ -{ - fts_t* fts = table->fts; - - fts->~fts_t(); - - mem_heap_free(fts->fts_heap); - - table->fts = NULL; -} - /*********************************************************************//** Take a FTS savepoint. */ UNIV_INLINE diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ef7b8e51794..e3dfcc8c321 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12622,7 +12622,8 @@ int create_table_info_t::create_table(bool create_fk) m_table->name.m_name); if (m_table->fts) { - fts_free(m_table); + m_table->fts->~fts_t(); + m_table->fts = nullptr; } my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index e454a997340..e3c802a7b46 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1028,7 +1028,8 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx old_v_cols[i].~dict_v_col_t(); } if (instant_table->fts) { - fts_free(instant_table); + instant_table->fts->~fts_t(); + instant_table->fts = nullptr; } dict_mem_table_free(instant_table); } @@ -8753,7 +8754,8 @@ innobase_rollback_sec_index( && !DICT_TF2_FLAG_IS_SET(user_table, DICT_TF2_FTS_HAS_DOC_ID) && !innobase_fulltext_exist(table)) { - fts_free(user_table); + user_table->fts->~fts_t(); + user_table->fts = nullptr; } } diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 011731c5e7f..9c2153b7ca3 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -607,14 +607,6 @@ fts_create( dict_table_t* table); /*!< out: table with FTS indexes */ -/**********************************************************************//** -Free the FTS resources. */ -void -fts_free( -/*=====*/ - dict_table_t* table); /*!< in/out: table with - FTS indexes */ - /*********************************************************************//** Run OPTIMIZE on the given table. @return DB_SUCCESS if all OK */ diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h index ed989045f18..1e0bbbb2bd1 100644 --- a/storage/innobase/include/os0thread.h +++ b/storage/innobase/include/os0thread.h @@ -86,7 +86,7 @@ We do not return an error code because if there is one, we crash here. */ os_thread_t os_thread_create(os_thread_func_t func, void *arg= nullptr); /** Detach and terminate the current thread. */ -ATTRIBUTE_NORETURN void os_thread_exit(); +os_thread_ret_t os_thread_exit(); /*****************************************************************//** The thread sleeps at least the time given in microseconds. */ diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index 34427dc6dc7..75db0ad04b2 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -177,6 +177,7 @@ struct ins_node_t trx_id(0), entry_sys_heap(mem_heap_create(128)) { } + ~ins_node_t() { mem_heap_free(entry_sys_heap); } que_common_t common; /*!< node type: QUE_NODE_INSERT */ ulint ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */ dtuple_t* row; /*!< row to insert */ diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc index f3533acfaac..ccf9b5c4a92 100644 --- a/storage/innobase/os/os0thread.cc +++ b/storage/innobase/os/os0thread.cc @@ -86,7 +86,7 @@ os_thread_t os_thread_create(os_thread_func_t func, void *arg) } /** Detach and terminate the current thread. */ -ATTRIBUTE_NORETURN void os_thread_exit() +os_thread_ret_t os_thread_exit() { #ifdef UNIV_DEBUG_THREAD_CREATION ib::info() << "Thread exits, id " << os_thread_get_curr_id(); @@ -100,8 +100,8 @@ ATTRIBUTE_NORETURN void os_thread_exit() ExitThread(0); #else pthread_detach(pthread_self()); - pthread_exit(NULL); #endif + OS_THREAD_DUMMY_RETURN; } /*****************************************************************//** diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 125c50fbc8b..759c2cb95e2 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -360,9 +360,9 @@ que_graph_free_stat_list( que_node_t* node) /*!< in: first query graph node in the list */ { while (node) { + que_node_t* next = que_node_get_next(node); que_graph_free_recursive(node); - - node = que_node_get_next(node); + node = next; } } @@ -421,19 +421,10 @@ que_graph_free_recursive( break; case QUE_NODE_INSERT: - ins = static_cast(node); que_graph_free_recursive(ins->select); - ins->select = NULL; - ins->~ins_node_t(); - - if (ins->entry_sys_heap != NULL) { - mem_heap_free(ins->entry_sys_heap); - ins->entry_sys_heap = NULL; - } - break; case QUE_NODE_PURGE: purge = static_cast(node); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index f815251bdd5..514d4b3ecd9 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3225,8 +3225,8 @@ row_drop_ancillary_fts_tables( /* fts_que_graph_free_check_lock would try to acquire dict mutex lock */ table->fts->dict_locked = true; - - fts_free(table); + table->fts->~fts_t(); + table->fts = nullptr; } return(DB_SUCCESS); diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 23aa950a14a..fbe5a7e9b0a 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -845,9 +845,7 @@ DECLARE_THREAD(trx_rollback_all_recovered)(void*) /* We count the number of threads in os_thread_exit(). A created thread should always use that to exit and not use return() to exit. */ - os_thread_exit(); - - OS_THREAD_DUMMY_RETURN; + return os_thread_exit(); } /****************************************************************//** From 402f36dd652b57a48d2d3e18949f5d7a1450363d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 28 Mar 2023 15:10:32 +0300 Subject: [PATCH 14/14] MDEV-30936 fixup fil_space_t::~fil_space_t(): Invoke ut_free(name) because doing so in the callers would trip MSAN_OPTIONS=poison_in_dtor=1 --- storage/innobase/fil/fil0fil.cc | 2 -- storage/innobase/include/fil0fil.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 9b6afbeb793..e6def2968ea 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -873,7 +873,6 @@ fil_space_free_low( fil_space_destroy_crypt_data(&space->crypt_data); space->~fil_space_t(); - ut_free(space->name); ut_free(space); } @@ -998,7 +997,6 @@ fil_space_t *fil_space_t::create(const char *name, ulint id, ulint flags, mutex_exit(&fil_system.mutex); rw_lock_free(&space->latch); space->~fil_space_t(); - ut_free(space->name); ut_free(space); return(NULL); } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index b124f5c6358..385d547a060 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -339,6 +339,7 @@ struct fil_space_t final #endif { #ifndef UNIV_INNOCHECKSUM + ~fil_space_t() { ut_free(name); } friend fil_node_t; ulint id; /*!< space id */ hash_node_t hash; /*!< hash chain node */