From 424a7a262072f3cd171f33f4193aed23465059fc Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 6 Oct 2023 18:18:37 +0300 Subject: [PATCH 01/16] Fixed randomly failing test main.order_by_optimizer_innodb The problem was that sometimes InnoDB returned sligtly wrong record count for table, which causes the optimizer to disregard the result from the range optimizer. The end result was that the optimizer choosed a ref access instead of a range access which caused errors in buildbot. Fixed by adding more rows to the table to ensure that table scan is more costly than range scan of the given interval. --- .../main/order_by_optimizer_innodb.result | 17 +++++++---------- mysql-test/main/order_by_optimizer_innodb.test | 16 ++++++---------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/mysql-test/main/order_by_optimizer_innodb.result b/mysql-test/main/order_by_optimizer_innodb.result index 0b62ba997d8..18a62414cab 100644 --- a/mysql-test/main/order_by_optimizer_innodb.result +++ b/mysql-test/main/order_by_optimizer_innodb.result @@ -2,10 +2,6 @@ drop table if exists t0,t1,t2,t3; # # MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used # -create table t0(a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); -create table t1(a int); -insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; CREATE TABLE t2 ( pk1 int(11) NOT NULL, pk2 int(11) NOT NULL, @@ -17,13 +13,13 @@ UNIQUE KEY ux_pk1_fd5 (pk1,fd5) ) ENGINE=InnoDB; insert into t2 select -round(log(2,t1.a+1)), -t1.a, -t1.a, +round(log(2,seq+1)), +seq, +seq, REPEAT('filler-data-', 10), REPEAT('filler-data-', 10) from -t1; +seq_0_to_1999; select pk1, count(*) from t2 group by pk1; pk1 count(*) 0 1 @@ -36,7 +32,8 @@ pk1 count(*) 7 91 8 181 9 362 -10 276 +10 724 +11 552 # The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13) EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; id select_type table type possible_keys key key_len ref rows Extra @@ -45,7 +42,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where -drop table t0,t1, t2; +drop table t2; # # MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY # diff --git a/mysql-test/main/order_by_optimizer_innodb.test b/mysql-test/main/order_by_optimizer_innodb.test index 90430d11549..ef6e9aac450 100644 --- a/mysql-test/main/order_by_optimizer_innodb.test +++ b/mysql-test/main/order_by_optimizer_innodb.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +--source include/have_sequence.inc --disable_warnings drop table if exists t0,t1,t2,t3; @@ -7,11 +8,6 @@ drop table if exists t0,t1,t2,t3; --echo # --echo # MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used --echo # -create table t0(a int); -insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); - -create table t1(a int); -insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; CREATE TABLE t2 ( pk1 int(11) NOT NULL, @@ -25,13 +21,13 @@ CREATE TABLE t2 ( insert into t2 select - round(log(2,t1.a+1)), - t1.a, - t1.a, + round(log(2,seq+1)), + seq, + seq, REPEAT('filler-data-', 10), REPEAT('filler-data-', 10) from - t1; + seq_0_to_1999; select pk1, count(*) from t2 group by pk1; @@ -40,7 +36,7 @@ EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER B --echo # This also must use range, not ref. key_len must be 13 EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; -drop table t0,t1, t2; +drop table t2; --echo # --echo # MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY From 185591c1c0dfd16bc6f74999a23d5aa5d7cfb12b Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 8 Oct 2023 18:00:51 +0300 Subject: [PATCH 02/16] MDEV-31349 test maria.maria-purge failed on 'aria_log.00000002 not found' The bug was in the test case. The problem was that maria_empty_logs.inc deleted aria log files before the server was properly shutdown. Fixed by waiting for pid file to disappear before starting to delete log files. Other things: - Fixed that translog_purge_at_flush() will not stop deleting files even if one file could not be deleted. --- mysql-test/include/maria_empty_logs.inc | 2 + mysql-test/include/wait_until_no_pidfile.inc | 30 +++++++++++++++ storage/maria/ma_loghandler.c | 40 ++++++++++++-------- 3 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 mysql-test/include/wait_until_no_pidfile.inc diff --git a/mysql-test/include/maria_empty_logs.inc b/mysql-test/include/maria_empty_logs.inc index f1835c0d2c3..bdbe3ff3ac7 100644 --- a/mysql-test/include/maria_empty_logs.inc +++ b/mysql-test/include/maria_empty_logs.inc @@ -11,6 +11,7 @@ connection default; let $default_db=`select database()`; let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $pid_file=`select @@pid_file`; #it will used at end of test for wait_for_status_var.inc primitive #let $status_var= Threads_connected; @@ -23,6 +24,7 @@ wait-maria_empty_logs.inc EOF --source include/mysqladmin_shutdown.inc +--source include/wait_until_no_pidfile.inc --disable_warnings if (!$mel_keep_control_file) diff --git a/mysql-test/include/wait_until_no_pidfile.inc b/mysql-test/include/wait_until_no_pidfile.inc new file mode 100644 index 00000000000..9448400522b --- /dev/null +++ b/mysql-test/include/wait_until_no_pidfile.inc @@ -0,0 +1,30 @@ +# Include this script after a shutdown to wait until the pid file, +# stored in $pid_file, has disappered. + +#--echo $pid_file + +--disable_result_log +--disable_query_log +# Wait one minute +let $counter= 600; +while ($counter) +{ +--error 0,1 +--file_exists $pid_file + if (!$errno) + { + dec $counter; + --real_sleep 0.1 + } + if ($errno) + { + let $counter= 0; + } +} +if (!$errno) +{ + --die Pid file "$pid_file" failed to disappear +} + +--enable_query_log +--enable_result_log diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 0b403fd456d..857bb59d851 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -8427,34 +8427,41 @@ my_bool translog_is_file(uint file_no) static uint32 translog_first_file(TRANSLOG_ADDRESS horizon, int is_protected) { - uint min_file= 0, max_file; + uint min_file= 1, max_file; DBUG_ENTER("translog_first_file"); if (!is_protected) mysql_mutex_lock(&log_descriptor.purger_lock); - if (log_descriptor.min_file_number && - translog_is_file(log_descriptor.min_file_number)) + if (log_descriptor.min_file_number) { - DBUG_PRINT("info", ("cached %lu", - (ulong) log_descriptor.min_file_number)); - if (!is_protected) - mysql_mutex_unlock(&log_descriptor.purger_lock); - DBUG_RETURN(log_descriptor.min_file_number); + min_file= log_descriptor.min_file_number; + if (translog_is_file(log_descriptor.min_file_number)) + { + DBUG_PRINT("info", ("cached %lu", + (ulong) log_descriptor.min_file_number)); + if (!is_protected) + mysql_mutex_unlock(&log_descriptor.purger_lock); + DBUG_RETURN(log_descriptor.min_file_number); + } } max_file= LSN_FILE_NO(horizon); + if (!translog_is_file(max_file)) + { + if (!is_protected) + mysql_mutex_unlock(&log_descriptor.purger_lock); + DBUG_RETURN(max_file); /* For compatibility */ + } /* binary search for last file */ - while (min_file != max_file && min_file != (max_file - 1)) + while (min_file < max_file) { uint test= (min_file + max_file) / 2; DBUG_PRINT("info", ("min_file: %u test: %u max_file: %u", min_file, test, max_file)); - if (test == max_file) - test--; if (translog_is_file(test)) max_file= test; else - min_file= test; + min_file= test+1; } log_descriptor.min_file_number= max_file; if (!is_protected) @@ -8723,9 +8730,9 @@ my_bool translog_purge(TRANSLOG_ADDRESS low) /** @brief Purges files by stored min need file in case of - "ondemend" purge type + "one demand" purge type - @note This function do real work only if it is "ondemend" purge type + @note This function do real work only if it is "one demand" purge type and translog_purge() was called at least once and last time without errors @@ -8764,13 +8771,14 @@ my_bool translog_purge_at_flush() min_file= translog_first_file(translog_get_horizon(), 1); DBUG_ASSERT(min_file != 0); /* log is already started */ - for(i= min_file; i < log_descriptor.min_need_file && rc == 0; i++) + for(i= min_file; i < log_descriptor.min_need_file ; i++) { char path[FN_REFLEN], *file_name; DBUG_PRINT("info", ("purge file %lu\n", (ulong) i)); file_name= translog_filename_by_fileno(i, path); - rc= MY_TEST(mysql_file_delete(key_file_translog, + rc|= MY_TEST(mysql_file_delete(key_file_translog, file_name, MYF(MY_WME))); + DBUG_ASSERT(rc == 0); } mysql_mutex_unlock(&log_descriptor.purger_lock); From 9d19b6526917c94ca03ef1b4c57152882b192cfe Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 8 Oct 2023 18:04:15 +0300 Subject: [PATCH 03/16] MDEV-22243 type_test.type_test_double fails with 'NUMERIC_SCALE NULL' There where several reasons why the test failed: - Constructors for Field_double and Field_float changed an argument to the constructor instead of a the correct class variable. - gcc 7.5.0 produced wrong code when inlining Field_double constructor into Field_test_double constructor. Fixed by changing the correct class variable and make the constructors not inline to go around the gcc bug. --- .../type_test/type_test_double.result | 2 +- sql/field.cc | 54 +++++++++++++++++++ sql/field.h | 43 ++------------- 3 files changed, 60 insertions(+), 39 deletions(-) diff --git a/plugin/type_test/mysql-test/type_test/type_test_double.result b/plugin/type_test/mysql-test/type_test/type_test_double.result index 6241ff95b8a..edcfdc0eff8 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_double.result +++ b/plugin/type_test/mysql-test/type_test/type_test_double.result @@ -290,7 +290,7 @@ DATA_TYPE test_double CHARACTER_MAXIMUM_LENGTH NULL CHARACTER_OCTET_LENGTH NULL NUMERIC_PRECISION 22 -NUMERIC_SCALE 31 +NUMERIC_SCALE NULL DATETIME_PRECISION NULL CHARACTER_SET_NAME NULL COLLATION_NAME NULL diff --git a/sql/field.cc b/sql/field.cc index 6b4466db87e..f40a2b4cc28 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4645,6 +4645,28 @@ bool Field_longlong::is_max() single precision float ****************************************************************************/ +Field_float::Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + uchar null_bit_arg, + enum utype unireg_check_arg, + const LEX_CSTRING *field_name_arg, + uint8 dec_arg,bool zero_arg,bool unsigned_arg) + :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, + unireg_check_arg, field_name_arg, + (dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg), + zero_arg, unsigned_arg) +{ +} + +Field_float::Field_float(uint32 len_arg, bool maybe_null_arg, + const LEX_CSTRING *field_name_arg, uint8 dec_arg) + :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, + NONE, field_name_arg, + (dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg), + 0, 0) +{ +} + + int Field_float::store(const char *from,size_t len,CHARSET_INFO *cs) { int error; @@ -4793,6 +4815,38 @@ Binlog_type_info Field_float::binlog_type_info() const double precision floating point numbers ****************************************************************************/ +Field_double::Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, + uchar null_bit_arg, + enum utype unireg_check_arg, + const LEX_CSTRING *field_name_arg, + uint8 dec_arg,bool zero_arg,bool unsigned_arg) + :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, + unireg_check_arg, field_name_arg, + (dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg), + zero_arg, unsigned_arg) +{ +} + +Field_double::Field_double(uint32 len_arg, bool maybe_null_arg, + const LEX_CSTRING *field_name_arg, uint8 dec_arg) + :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, + NONE, field_name_arg, + (dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg), + 0, 0) +{ +} + +Field_double::Field_double(uint32 len_arg, bool maybe_null_arg, + const LEX_CSTRING *field_name_arg, + uint8 dec_arg, bool not_fixed_arg) + :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, + NONE, field_name_arg, + (dec_arg >= FLOATING_POINT_DECIMALS ? NOT_FIXED_DEC : dec_arg), + 0, 0) +{ + not_fixed= not_fixed_arg; +} + int Field_double::store(const char *from,size_t len,CHARSET_INFO *cs) { int error; diff --git a/sql/field.h b/sql/field.h index 804394c58a6..057bd8453c5 100644 --- a/sql/field.h +++ b/sql/field.h @@ -2842,22 +2842,9 @@ public: Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint8 dec_arg,bool zero_arg,bool unsigned_arg) - :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, - dec_arg, zero_arg, unsigned_arg) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } + uint8 dec_arg,bool zero_arg,bool unsigned_arg); Field_float(uint32 len_arg, bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, uint8 dec_arg) - :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0, - NONE, field_name_arg, dec_arg, 0, 0) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } + const LEX_CSTRING *field_name_arg, uint8 dec_arg); const Type_handler *type_handler() const override { return &type_handler_float; } enum ha_base_keytype key_type() const override { return HA_KEYTYPE_FLOAT; } @@ -2890,32 +2877,12 @@ public: Field_double(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg, - uint8 dec_arg,bool zero_arg,bool unsigned_arg) - :Field_real(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, - dec_arg, zero_arg, unsigned_arg) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } + uint8 dec_arg,bool zero_arg,bool unsigned_arg); Field_double(uint32 len_arg, bool maybe_null_arg, - const LEX_CSTRING *field_name_arg, uint8 dec_arg) - :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, - NONE, field_name_arg, dec_arg, 0, 0) - { - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } + const LEX_CSTRING *field_name_arg, uint8 dec_arg); Field_double(uint32 len_arg, bool maybe_null_arg, const LEX_CSTRING *field_name_arg, - uint8 dec_arg, bool not_fixed_arg) - :Field_real((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, (uint) 0, - NONE, field_name_arg, dec_arg, 0, 0) - { - not_fixed= not_fixed_arg; - if (dec_arg >= FLOATING_POINT_DECIMALS) - dec_arg= NOT_FIXED_DEC; - } + uint8 dec_arg, bool not_fixed_arg); void init_for_tmp_table(Field *org_field, TABLE *new_table) override { Field::init_for_tmp_table(org_field, new_table); From 1dd6d9a0bfb2dd99a9cfcad39e7ec0a77b393780 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 8 Oct 2023 20:17:52 +0300 Subject: [PATCH 04/16] Fixed compiler warnings in connect/odbconn.cpp --- storage/connect/odbconn.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 18bb77a9d00..b022319b49a 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -125,18 +125,21 @@ int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w) switch (stp) { case SQL_WVARCHAR: // (-9) w = true; + // Fall through case SQL_VARCHAR: // 12 v = 'V'; type = TYPE_STRING; break; case SQL_WCHAR: // (-8) w = true; + // Fall through case SQL_CHAR: // 1 type = TYPE_STRING; break; case SQL_WLONGVARCHAR: // (-10) w = true; - case SQL_LONGVARCHAR: // (-1) + // Fall through + case SQL_LONGVARCHAR: // (-1) if (GetTypeConv() == TPC_YES || GetTypeConv() == TPC_FORCE) { v = 'V'; type = TYPE_STRING; @@ -2355,6 +2358,7 @@ int ODBConn::GetCatInfo(CATPARM *cap) break; case CAT_SPC: ThrowDBX("SQLSpecialColumns not available yet"); + break; default: ThrowDBX("Invalid SQL function id"); } // endswitch infotype From b04af64882f233e3937f729aac321de504db3f63 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 8 Oct 2023 22:36:16 +0300 Subject: [PATCH 05/16] Fixed that log_slow.test works with view_protocol Part of the test did not work with view_protocol as the query written to the slow_log table is changed because of view_protocol. --- mysql-test/main/log_slow.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 6120ac77756..a5f6ac9baba 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -141,6 +141,7 @@ CREATE TABLE `tab_MDEV_30820` ( ); --disable_ps2_protocol +--disable_view_protocol --delimiter // CREATE FUNCTION `get_zero`() RETURNS int(11) @@ -182,6 +183,7 @@ drop table tab_MDEV_30820, tab2; drop function get_zero; --enable_ps2_protocol +--enable_view_protocol --echo # --echo # End of 10.4 tests From f9d471e2d5dc752917262a467ce83d080a5c6c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 12 Oct 2023 09:48:54 +0300 Subject: [PATCH 06/16] Cleanup: Remove innobase_init_vc_templ() This fixes up a merge of commit 4fb8f7d07a23b1ac1249dd1f60195ff946450c79 with respect to commit ea37b144094a0c2ebfc6774047fd473c1b2a8658. --- storage/innobase/handler/ha_innodb.cc | 24 ------------------------ storage/innobase/include/row0mysql.h | 5 ----- 2 files changed, 29 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 30a24107a21..291568c6e2a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -20364,30 +20364,6 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table) return mysql_table; } -/** Only used by the purge thread -@param[in,out] table table whose virtual column template to be built */ -TABLE* innobase_init_vc_templ(dict_table_t* table) -{ - DBUG_ENTER("innobase_init_vc_templ"); - - ut_ad(table->vc_templ == NULL); - - TABLE *mysql_table= innodb_find_table_for_vc(current_thd, table); - - ut_ad(mysql_table); - if (!mysql_table) { - DBUG_RETURN(NULL); - } - - dict_vcol_templ_t* vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); - - mutex_enter(&dict_sys.mutex); - table->vc_templ = vc_templ; - innobase_build_v_templ(mysql_table, table, vc_templ, nullptr, true); - mutex_exit(&dict_sys.mutex); - DBUG_RETURN(mysql_table); -} - /** Change dbname and table name in table->vc_templ. @param[in,out] table the table whose virtual column template dbname and tbname to be renamed. */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index eb90ec0f04c..7605a1904e3 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -940,11 +940,6 @@ innobase_get_computed_value( const upd_t* update=NULL, bool ignore_warnings=false); -/** Get the computed value by supplying the base column values. -@param[in,out] table the table whose virtual column - template to be built */ -TABLE* innobase_init_vc_templ(dict_table_t* table); - /** Change dbname and table name in table->vc_templ. @param[in,out] table the table whose virtual column template dbname and tbname to be renamed. */ From c79ca7c7add86ffa49cd1bebaea29bbc0dec592a Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 19 Sep 2023 11:33:51 +1000 Subject: [PATCH 07/16] MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success There are many filesystem related errors that can occur with MariaBackup. These already outputed to stderr with a good description of the error. Many of these are permission or resource (file descriptor) limits where the assertion and resulting core crash doesn't offer developers anything more than the log message. To the user, assertions and core crashes come across as poor error handling. As such we return an error and handle this all the way up the stack. --- extra/mariabackup/xtrabackup.cc | 32 +++++++++++------- .../suite/mariabackup/data_directory.result | 6 ++++ .../suite/mariabackup/data_directory.test | 15 +++++++++ storage/innobase/fil/fil0fil.cc | 5 +-- storage/innobase/include/log0log.h | 3 +- storage/innobase/include/log0recv.h | 3 +- storage/innobase/log/log0log.cc | 10 ++++-- storage/innobase/log/log0recv.cc | 33 ++++++++++++------- 8 files changed, 77 insertions(+), 30 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 5c122ad04f2..513f469e699 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4436,16 +4436,24 @@ bool Backup_datasinks::backup_low() if (recv_find_max_checkpoint(&max_cp_field) == DB_SUCCESS && log_sys.log.format != 0) { - if (max_cp_field == LOG_CHECKPOINT_1) { - log_sys.log.read(max_cp_field, - {log_sys.checkpoint_buf, - OS_FILE_LOG_BLOCK_SIZE}); + switch (max_cp_field) { + case LOG_CHECKPOINT_1: + if (log_sys.log.read(max_cp_field, + {log_sys.checkpoint_buf, + OS_FILE_LOG_BLOCK_SIZE})) + { + /* metadata_to_lsn still 0 so error returns below */ + msg("Error: recv_find_max_checkpoint() failed."); + break; + } + /* fallthrough */ + default: + metadata_to_lsn = mach_read_from_8( + log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN); + msg("mariabackup: The latest check point" + " (for incremental): '" LSN_PF "'", + metadata_to_lsn); } - metadata_to_lsn = mach_read_from_8( - log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN); - msg("mariabackup: The latest check point" - " (for incremental): '" LSN_PF "'", - metadata_to_lsn); } else { msg("Error: recv_find_max_checkpoint() failed."); } @@ -4661,14 +4669,14 @@ reread_log_header: checkpoint_lsn_start = log_sys.log.get_lsn(); checkpoint_no_start = log_sys.next_checkpoint_no; - log_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE}); + err = log_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE}); - if (checkpoint_no_start + if (err == DB_SUCCESS && (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO) || checkpoint_lsn_start != mach_read_from_8(buf + LOG_CHECKPOINT_LSN) || log_sys.log.get_lsn_offset() - != mach_read_from_8(buf + LOG_CHECKPOINT_OFFSET)) + != mach_read_from_8(buf + LOG_CHECKPOINT_OFFSET))) goto reread_log_header; } mysql_mutex_unlock(&log_sys.mutex); diff --git a/mysql-test/suite/mariabackup/data_directory.result b/mysql-test/suite/mariabackup/data_directory.result index 4e45127bd6a..8692c35239e 100644 --- a/mysql-test/suite/mariabackup/data_directory.result +++ b/mysql-test/suite/mariabackup/data_directory.result @@ -11,3 +11,9 @@ SELECT * FROM t; a 1 DROP TABLE t; +# +# MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success +# +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/mariabackup/data_directory.test b/mysql-test/suite/mariabackup/data_directory.test index a89b7bdccc4..ffb3ab3073c 100644 --- a/mysql-test/suite/mariabackup/data_directory.test +++ b/mysql-test/suite/mariabackup/data_directory.test @@ -21,4 +21,19 @@ rmdir $table_data_dir; SELECT * FROM t; DROP TABLE t; rmdir $targetdir; + +--echo # +--echo # MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success +--echo # +let $DATADIR= `select @@datadir`; +chmod 0000 $DATADIR/ibdata1; +--disable_result_log +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log +chmod 0755 $DATADIR/ibdata1; rmdir $table_data_dir; +rmdir $targetdir; +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 725345957ee..ea7c496b86b 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -363,6 +363,7 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle, return node; } +__attribute__((warn_unused_result, nonnull)) /** Open a tablespace file. @param node data file @return whether the file was successfully opened */ @@ -391,9 +392,9 @@ static bool fil_node_open_file_low(fil_node_t *node) : OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_AIO, type, srv_read_only_mode, &success); - if (node->is_open()) + + if (success && node->is_open()) { - ut_ad(success); #ifndef _WIN32 if (!node->space->id && !srv_read_only_mode && my_disable_locking && os_file_lock(node->handle, node->name)) diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index e8399ba4c96..16ff4ced5b2 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -506,7 +506,8 @@ public: /** reads buffer from log file @param[in] offset offset in log file @param[in] buf buffer where to read */ - void read(os_offset_t offset, span buf); + dberr_t MY_ATTRIBUTE((warn_unused_result)) read(os_offset_t offset, + span buf); /** Tells whether writes require calling flush() */ bool writes_are_durable() const noexcept; /** writes buffer to log file diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index e4a8f0d25a2..263996a78d3 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -283,7 +283,8 @@ public: /** Last added LSN to pages. */ lsn_t last_stored_lsn= 0; - void read(os_offset_t offset, span buf); + __attribute__((warn_unused_result)) + dberr_t read(os_offset_t offset, span buf); inline size_t files_size(); void close_files() { files.clear(); files.shrink_to_fit(); } diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 58d7689894d..279e2806b23 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -280,6 +280,7 @@ dberr_t file_os_io::close() noexcept return DB_SUCCESS; } +__attribute__((warn_unused_result)) dberr_t file_os_io::read(os_offset_t offset, span buf) noexcept { return os_file_read(IORequestRead, m_fd, buf.data(), offset, buf.size()); @@ -382,6 +383,7 @@ public: : DB_ERROR; } dberr_t close() noexcept final { return m_file.unmap(); } + __attribute__((warn_unused_result)) dberr_t read(os_offset_t offset, span buf) noexcept final { memcpy(buf.data(), m_file.data() + offset, buf.size()); @@ -448,6 +450,8 @@ dberr_t log_file_t::close() noexcept return DB_SUCCESS; } + +__attribute__((warn_unused_result)) dberr_t log_file_t::read(os_offset_t offset, span buf) noexcept { ut_ad(is_opened()); @@ -510,10 +514,10 @@ void log_t::file::write_header_durable(lsn_t lsn) log_sys.log.flush(); } -void log_t::file::read(os_offset_t offset, span buf) +__attribute__((warn_unused_result)) +dberr_t log_t::file::read(os_offset_t offset, span buf) { - if (const dberr_t err= fd.read(offset, buf)) - ib::fatal() << "read(" << fd.get_path() << ") returned "<< err; + return fd.read(offset, buf); } bool log_t::file::writes_are_durable() const noexcept diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 1b62b1fe111..a34f00e16c1 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -762,14 +762,15 @@ void recv_sys_t::open_log_files_if_needed() } } -void recv_sys_t::read(os_offset_t total_offset, span buf) +MY_ATTRIBUTE((warn_unused_result)) +dberr_t +recv_sys_t::read(os_offset_t total_offset, span buf) { open_log_files_if_needed(); size_t file_idx= static_cast(total_offset / log_sys.log.file_size); os_offset_t offset= total_offset % log_sys.log.file_size; - dberr_t err= recv_sys.files[file_idx].read(offset, buf); - ut_a(err == DB_SUCCESS); + return recv_sys.files[file_idx].read(offset, buf); } inline size_t recv_sys_t::files_size() @@ -1107,7 +1108,8 @@ loop: ut_a((source_offset >> srv_page_size_shift) <= ULINT_MAX); - recv_sys.read(source_offset, {buf, len}); + if (recv_sys.read(source_offset, {buf, len})) + return false; for (ulint l = 0; l < len; l += OS_FILE_LOG_BLOCK_SIZE, buf += OS_FILE_LOG_BLOCK_SIZE, @@ -1272,6 +1274,7 @@ inline uint32_t log_block_calc_checksum_format_0(const byte *b) ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() { uint64_t max_no= 0; + dberr_t err; byte *buf= log_sys.buf; ut_ad(log_sys.log.format == 0); @@ -1295,7 +1298,8 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() for (ulint field= LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2; field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) { - log_sys.log.read(field, {buf, OS_FILE_LOG_BLOCK_SIZE}); + if ((err= log_sys.log.read(field, {buf, OS_FILE_LOG_BLOCK_SIZE}))) + return err; if (static_cast(ut_fold_binary(buf, CHECKSUM_1)) != mach_read_from_4(buf + CHECKSUM_1) || @@ -1347,7 +1351,8 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() "InnoDB: Upgrade after a crash is not supported." " This redo log was created before MariaDB 10.2.2"; - recv_sys.read(source_offset & ~511, {buf, 512}); + if ((err= recv_sys.read(source_offset & ~511, {buf, 512}))) + return err; if (log_block_calc_checksum_format_0(buf) != log_block_get_checksum(buf) && !log_crypt_101_read_block(buf, lsn)) @@ -1414,8 +1419,9 @@ static dberr_t recv_log_recover_10_4() return DB_CORRUPTION; } - recv_sys.read(source_offset & ~lsn_t(OS_FILE_LOG_BLOCK_SIZE - 1), - {buf, OS_FILE_LOG_BLOCK_SIZE}); + if (dberr_t err= recv_sys.read(source_offset & ~lsn_t(OS_FILE_LOG_BLOCK_SIZE - 1), + {buf, OS_FILE_LOG_BLOCK_SIZE})) + return err; ulint crc = log_block_calc_checksum_crc32(buf); ulint cksum = log_block_get_checksum(buf); @@ -1473,7 +1479,8 @@ recv_find_max_checkpoint(ulint* max_field) buf = log_sys.checkpoint_buf; - log_sys.log.read(0, {buf, OS_FILE_LOG_BLOCK_SIZE}); + if (dberr_t err= log_sys.log.read(0, {buf, OS_FILE_LOG_BLOCK_SIZE})) + return err; /* Check the header page checksum. There was no checksum in the first redo log format (version 0). */ log_sys.log.format = mach_read_from_4(buf + LOG_HEADER_FORMAT); @@ -1512,7 +1519,8 @@ recv_find_max_checkpoint(ulint* max_field) for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2; field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) { - log_sys.log.read(field, {buf, OS_FILE_LOG_BLOCK_SIZE}); + if (dberr_t err= log_sys.log.read(field, {buf, OS_FILE_LOG_BLOCK_SIZE})) + return err; const ulint crc32 = log_block_calc_checksum_crc32(buf); const ulint cksum = log_block_get_checksum(buf); @@ -3452,7 +3460,10 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) } buf = log_sys.checkpoint_buf; - log_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE}); + if ((err= log_sys.log.read(max_cp_field, {buf, OS_FILE_LOG_BLOCK_SIZE}))) { + mysql_mutex_unlock(&log_sys.mutex); + return(err); + } checkpoint_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_LSN); checkpoint_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO); From fbd11d5f299a1e399ee5b46f141d6f56db0f7f58 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 13 Oct 2023 09:12:01 +1100 Subject: [PATCH 08/16] MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success Review cleanups. --- storage/innobase/include/log0log.h | 9 ++++++--- storage/innobase/log/log0log.cc | 11 ----------- storage/innobase/log/log0recv.cc | 11 +++++------ 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 16ff4ced5b2..26385bb4494 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -503,13 +503,16 @@ public: void write_header_durable(lsn_t lsn); /** opens log file which must be closed prior this call */ dberr_t rename(std::string path) { return fd.rename(path); } + + MY_ATTRIBUTE((warn_unused_result)) /** reads buffer from log file @param[in] offset offset in log file @param[in] buf buffer where to read */ - dberr_t MY_ATTRIBUTE((warn_unused_result)) read(os_offset_t offset, - span buf); + dberr_t read(os_offset_t offset, span buf) + { return fd.read(offset, buf); } /** Tells whether writes require calling flush() */ - bool writes_are_durable() const noexcept; + bool writes_are_durable() const noexcept + { return fd.writes_are_durable(); } /** writes buffer to log file @param[in] offset offset in log file @param[in] buf buffer from which to write */ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 279e2806b23..a9029a3df82 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -514,17 +514,6 @@ void log_t::file::write_header_durable(lsn_t lsn) log_sys.log.flush(); } -__attribute__((warn_unused_result)) -dberr_t log_t::file::read(os_offset_t offset, span buf) -{ - return fd.read(offset, buf); -} - -bool log_t::file::writes_are_durable() const noexcept -{ - return fd.writes_are_durable(); -} - void log_t::file::write(os_offset_t offset, span buf) { srv_stats.os_log_pending_writes.inc(); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index a34f00e16c1..e452267d2e8 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -763,8 +763,7 @@ void recv_sys_t::open_log_files_if_needed() } MY_ATTRIBUTE((warn_unused_result)) -dberr_t -recv_sys_t::read(os_offset_t total_offset, span buf) +dberr_t recv_sys_t::read(os_offset_t total_offset, span buf) { open_log_files_if_needed(); @@ -1274,7 +1273,6 @@ inline uint32_t log_block_calc_checksum_format_0(const byte *b) ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() { uint64_t max_no= 0; - dberr_t err; byte *buf= log_sys.buf; ut_ad(log_sys.log.format == 0); @@ -1298,7 +1296,7 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() for (ulint field= LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2; field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) { - if ((err= log_sys.log.read(field, {buf, OS_FILE_LOG_BLOCK_SIZE}))) + if (dberr_t err= log_sys.log.read(field, {buf, OS_FILE_LOG_BLOCK_SIZE})) return err; if (static_cast(ut_fold_binary(buf, CHECKSUM_1)) != @@ -1351,7 +1349,7 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2() "InnoDB: Upgrade after a crash is not supported." " This redo log was created before MariaDB 10.2.2"; - if ((err= recv_sys.read(source_offset & ~511, {buf, 512}))) + if (dberr_t err= recv_sys.read(source_offset & ~511, {buf, 512})) return err; if (log_block_calc_checksum_format_0(buf) != log_block_get_checksum(buf) && @@ -1419,7 +1417,8 @@ static dberr_t recv_log_recover_10_4() return DB_CORRUPTION; } - if (dberr_t err= recv_sys.read(source_offset & ~lsn_t(OS_FILE_LOG_BLOCK_SIZE - 1), + if (dberr_t err= + recv_sys.read(source_offset & ~lsn_t(OS_FILE_LOG_BLOCK_SIZE - 1), {buf, OS_FILE_LOG_BLOCK_SIZE})) return err; From e3e66a575bb9be247744d24b497e0a8cd26e7fb1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 7 Oct 2023 10:28:05 +0200 Subject: [PATCH 09/16] make perfschema.show_aggregate test more debuggable --- .../suite/perfschema/r/show_aggregate.result | 118 +++++++++--------- .../suite/perfschema/t/show_aggregate.test | 56 ++++----- 2 files changed, 83 insertions(+), 91 deletions(-) diff --git a/mysql-test/suite/perfschema/r/show_aggregate.result b/mysql-test/suite/perfschema/r/show_aggregate.result index 69861fa42c9..b5e957f3fc8 100644 --- a/mysql-test/suite/perfschema/r/show_aggregate.result +++ b/mysql-test/suite/perfschema/r/show_aggregate.result @@ -7,6 +7,7 @@ SET @@session.sql_log_bin=OFF; # CREATE 3 CLIENTS, 3 CONNECTIONS, RESULTS TABLE connection default; USE test; +flush status; # # Create results table CREATE TABLE test.status_results @@ -204,100 +205,99 @@ USE performance_schema; # # Verify expected counts for 'handler_delete' per thread # -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_thread WHERE thread_id = @con1_id AND variable_name IN ('handler_delete', 'handler_rollback'); +SELECT *, IF (variable_value = 1,'OK1','ERROR1') AS Expected FROM status_by_thread WHERE thread_id = @con1_id AND variable_name IN ('handler_delete', 'handler_rollback'); THREAD_ID VARIABLE_NAME VARIABLE_VALUE Expected -con_1 Handler_delete 1 OK -con_1 Handler_rollback 1 OK +con_1 Handler_delete 1 OK1 +con_1 Handler_rollback 1 OK1 # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_thread WHERE thread_id = @con2_id AND variable_name IN ('handler_delete', 'handler_rollback'); +SELECT *, IF (variable_value = 2,'OK2','ERROR2') AS Expected FROM status_by_thread WHERE thread_id = @con2_id AND variable_name IN ('handler_delete', 'handler_rollback'); THREAD_ID VARIABLE_NAME VARIABLE_VALUE Expected -con_2 Handler_delete 2 OK -con_2 Handler_rollback 2 OK +con_2 Handler_delete 2 OK2 +con_2 Handler_rollback 2 OK2 # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_thread WHERE thread_id = @con3_id AND variable_name IN ('handler_delete', 'handler_rollback'); +SELECT *, IF (variable_value = 3,'OK3','ERROR3') AS Expected FROM status_by_thread WHERE thread_id = @con3_id AND variable_name IN ('handler_delete', 'handler_rollback'); THREAD_ID VARIABLE_NAME VARIABLE_VALUE Expected -con_3 Handler_delete 3 OK -con_3 Handler_rollback 3 OK +con_3 Handler_delete 3 OK3 +con_3 Handler_rollback 3 OK3 # # STATUS_BY_THREAD vs. GLOBAL_STATUS # -SELECT variable_name, t1, t2, t3, delta, thread, IF(thread=delta,'OK','ERROR') Expected +SELECT variable_name, t1, t2, t3, delta, thread, IF(thread=delta,'OK4','ERROR4') Expected FROM test.status_results ORDER BY variable_name; variable_name t1 t2 t3 delta thread Expected -Handler_delete 1 2 3 6 6 OK -Handler_rollback 1 2 3 6 6 OK +Handler_delete 1 2 3 6 6 OK4 +Handler_rollback 1 2 3 6 6 OK4 # # ================================================================================ # TEST 2: STATUS_BY_USER: Verify expected status counts per user (1,2,3) # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OK5','ERROR5') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); USER VARIABLE_NAME VARIABLE_VALUE Expected -user1 Handler_delete 1 OK +user1 Handler_delete 1 OK5 # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OK6','ERROR6') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); USER VARIABLE_NAME VARIABLE_VALUE Expected -user2 Handler_delete 2 OK +user2 Handler_delete 2 OK6 # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OK7','ERROR7') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); USER VARIABLE_NAME VARIABLE_VALUE Expected -user3 Handler_delete 3 OK +user3 Handler_delete 3 OK7 # # STATUS_BY_USER vs. GLOBAL_STATUS # -SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OK','ERROR') Expected +SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OK8','ERROR8') Expected FROM test.status_results ORDER BY variable_name; variable_name u1 u2 u3 delta user Expected -Handler_delete 1 2 3 6 6 OK -Handler_rollback 1 2 3 6 6 OK +Handler_delete 1 2 3 6 6 OK8 +Handler_rollback 1 2 3 6 6 OK8 # # ================================================================================ # TEST 3: STATUS_BY_ACCOUNT: Verify expected status counts per user, host (1,2,3) # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OK9','ERROR9') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); USER HOST VARIABLE_NAME VARIABLE_VALUE Expected -user1 localhost Handler_delete 1 OK +user1 localhost Handler_delete 1 OK9 # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OKa','ERRORa') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); USER HOST VARIABLE_NAME VARIABLE_VALUE Expected -user2 localhost Handler_delete 2 OK +user2 localhost Handler_delete 2 OKa # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OKb','ERRORb') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); USER HOST VARIABLE_NAME VARIABLE_VALUE Expected -user3 localhost Handler_delete 3 OK +user3 localhost Handler_delete 3 OKb # # STATUS_BY_ACCOUNT vs. GLOBAL_STATUS # -SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OK','ERROR') Expected +SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OKc','ERRORc') Expected FROM test.status_results ORDER BY variable_name; variable_name a1 a2 a3 delta acct Expected -Handler_delete 1 2 3 6 6 OK -Handler_rollback 1 2 3 6 6 OK +Handler_delete 1 2 3 6 6 OKc +Handler_rollback 1 2 3 6 6 OKc # ================================================================================ # TEST 4: STATUS_BY_HOST: Verify expected status counts per host (6) # ================================================================================ -SELECT *, IF (variable_value = 6,'OK','ERROR') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 6,'OKd','ERRORd') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); HOST VARIABLE_NAME VARIABLE_VALUE Expected -localhost Handler_delete 6 OK +localhost Handler_delete 6 OKd # # STATUS_BY_HOST vs. GLOBAL_STATUS # # Special case: No way to isolate pre-existing 'localhost' activity, so # just check global totals = sum(status_by_host). # -SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OK','ERROR') Expected +SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OKe','ERRORe') Expected FROM test.status_results ORDER BY variable_name; variable_name h1 h2 h3 delta host Expected -Handler_delete 6 0 0 6 6 OK -Handler_rollback 6 0 0 6 6 OK +Handler_delete 6 0 0 6 6 OKe +Handler_rollback 6 0 0 6 6 OKe # # ================================================================================ # DISCONNECT ALL USERS AND RUN THE TESTS AGAIN. RESULTS SHOULD NOT CHANGE. # ================================================================================ -connection default; disconnect con1; disconnect con2; disconnect con3; @@ -429,68 +429,68 @@ USE performance_schema; # ================================================================================ # TEST 5: STATUS_BY_USER: Verify expected status counts per user (1,2,3) # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OKf','ERRORf') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); USER VARIABLE_NAME VARIABLE_VALUE Expected -user1 Handler_delete 1 OK +user1 Handler_delete 1 OKf # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OKg','ERRORg') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); USER VARIABLE_NAME VARIABLE_VALUE Expected -user2 Handler_delete 2 OK +user2 Handler_delete 2 OKg # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OKh','ERRORh') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); USER VARIABLE_NAME VARIABLE_VALUE Expected -user3 Handler_delete 3 OK +user3 Handler_delete 3 OKh # # STATUS_BY_USER vs. GLOBAL_STATUS # -SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OK','ERROR') Expected +SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OKi','ERRORi') Expected FROM test.status_results ORDER BY variable_name; variable_name u1 u2 u3 delta user Expected -Handler_delete 1 2 3 6 6 OK -Handler_rollback 1 2 3 6 6 OK +Handler_delete 1 2 3 6 6 OKi +Handler_rollback 1 2 3 6 6 OKi # # ================================================================================ # TEST 6: STATUS_BY_ACCOUNT: Verify expected status counts per user:host (1,2,3) # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OKj','ERRORj') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); USER HOST VARIABLE_NAME VARIABLE_VALUE Expected -user1 localhost Handler_delete 1 OK +user1 localhost Handler_delete 1 OKj # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OKk','ERRORk') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); USER HOST VARIABLE_NAME VARIABLE_VALUE Expected -user2 localhost Handler_delete 2 OK +user2 localhost Handler_delete 2 OKk # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OKl','ERRORl') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); USER HOST VARIABLE_NAME VARIABLE_VALUE Expected -user3 localhost Handler_delete 3 OK +user3 localhost Handler_delete 3 OKl # # STATUS_BY_ACCOUNT vs. GLOBAL_STATUS # -SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OK','ERROR') Expected +SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OKn','ERRORn') Expected FROM test.status_results ORDER BY variable_name; variable_name a1 a2 a3 delta acct Expected -Handler_delete 1 2 3 6 6 OK -Handler_rollback 1 2 3 6 6 OK +Handler_delete 1 2 3 6 6 OKn +Handler_rollback 1 2 3 6 6 OKn # ================================================================================ # TEST 7: STATUS_BY_HOST: Verify expected status counts per host (6) # ================================================================================ -SELECT *, IF (variable_value = 6,'OK','ERROR') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 6,'OKo','ERRORo') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); HOST VARIABLE_NAME VARIABLE_VALUE Expected -localhost Handler_delete 6 OK +localhost Handler_delete 6 OKo # # STATUS_BY_HOST vs. GLOBAL_STATUS # # Special case: No way to isolate pre-existing 'localhost' activity, so # just check global totals = sum(status_by_host). # -SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OK','ERROR') Expected +SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OKp','ERRORp') Expected FROM test.status_results ORDER BY variable_name; variable_name h1 h2 h3 delta host Expected -Handler_delete 6 0 0 6 6 OK -Handler_rollback 6 0 0 6 6 OK +Handler_delete 6 0 0 6 6 OKp +Handler_rollback 6 0 0 6 6 OKp # ================================================================================ # TEST 8: FLUSH STATUS should clear account, host and user status # ================================================================================ diff --git a/mysql-test/suite/perfschema/t/show_aggregate.test b/mysql-test/suite/perfschema/t/show_aggregate.test index a15dea45268..ba1d87d1f72 100644 --- a/mysql-test/suite/perfschema/t/show_aggregate.test +++ b/mysql-test/suite/perfschema/t/show_aggregate.test @@ -14,8 +14,6 @@ --source include/no_protocol.inc --source include/maybe_pool_of_threads.inc ---enable_connect_log - --echo # --echo # ================================================================================ --echo # SETUP @@ -26,10 +24,7 @@ SET @@session.sql_log_bin=OFF; connection default; USE test; -# Clear user, host and account status accumulated from preliminary checks by mtr. ---disable_query_log flush status; ---enable_query_log --echo # --echo # Create results table @@ -135,18 +130,18 @@ USE performance_schema; --echo # Verify expected counts for 'handler_delete' per thread --echo # --replace_column 1 con_1 -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_thread WHERE thread_id = @con1_id AND variable_name IN ('handler_delete', 'handler_rollback'); +SELECT *, IF (variable_value = 1,'OK1','ERROR1') AS Expected FROM status_by_thread WHERE thread_id = @con1_id AND variable_name IN ('handler_delete', 'handler_rollback'); --echo # --replace_column 1 con_2 -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_thread WHERE thread_id = @con2_id AND variable_name IN ('handler_delete', 'handler_rollback'); +SELECT *, IF (variable_value = 2,'OK2','ERROR2') AS Expected FROM status_by_thread WHERE thread_id = @con2_id AND variable_name IN ('handler_delete', 'handler_rollback'); --echo # --replace_column 1 con_3 -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_thread WHERE thread_id = @con3_id AND variable_name IN ('handler_delete', 'handler_rollback'); +SELECT *, IF (variable_value = 3,'OK3','ERROR3') AS Expected FROM status_by_thread WHERE thread_id = @con3_id AND variable_name IN ('handler_delete', 'handler_rollback'); --echo # --echo # STATUS_BY_THREAD vs. GLOBAL_STATUS --echo # -SELECT variable_name, t1, t2, t3, delta, thread, IF(thread=delta,'OK','ERROR') Expected +SELECT variable_name, t1, t2, t3, delta, thread, IF(thread=delta,'OK4','ERROR4') Expected FROM test.status_results ORDER BY variable_name; @@ -154,16 +149,16 @@ ORDER BY variable_name; --echo # ================================================================================ --echo # TEST 2: STATUS_BY_USER: Verify expected status counts per user (1,2,3) --echo # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OK5','ERROR5') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OK6','ERROR6') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OK7','ERROR7') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); --echo # --echo # STATUS_BY_USER vs. GLOBAL_STATUS --echo # -SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OK','ERROR') Expected +SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OK8','ERROR8') Expected FROM test.status_results ORDER BY variable_name; @@ -171,23 +166,23 @@ ORDER BY variable_name; --echo # ================================================================================ --echo # TEST 3: STATUS_BY_ACCOUNT: Verify expected status counts per user, host (1,2,3) --echo # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OK9','ERROR9') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OKa','ERRORa') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OKb','ERRORb') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); --echo # --echo # STATUS_BY_ACCOUNT vs. GLOBAL_STATUS --echo # -SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OK','ERROR') Expected +SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OKc','ERRORc') Expected FROM test.status_results ORDER BY variable_name; --echo # ================================================================================ --echo # TEST 4: STATUS_BY_HOST: Verify expected status counts per host (6) --echo # ================================================================================ -SELECT *, IF (variable_value = 6,'OK','ERROR') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 6,'OKd','ERRORd') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); --echo # --echo # STATUS_BY_HOST vs. GLOBAL_STATUS @@ -195,7 +190,7 @@ SELECT *, IF (variable_value = 6,'OK','ERROR') AS Expected FROM status_by_host W --echo # Special case: No way to isolate pre-existing 'localhost' activity, so --echo # just check global totals = sum(status_by_host). --echo # -SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OK','ERROR') Expected +SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OKe','ERRORe') Expected FROM test.status_results ORDER BY variable_name; @@ -203,7 +198,6 @@ ORDER BY variable_name; --echo # ================================================================================ --echo # DISCONNECT ALL USERS AND RUN THE TESTS AGAIN. RESULTS SHOULD NOT CHANGE. --echo # ================================================================================ -connection default; disconnect con1; disconnect con2; disconnect con3; @@ -232,16 +226,16 @@ USE performance_schema; --echo # ================================================================================ --echo # TEST 5: STATUS_BY_USER: Verify expected status counts per user (1,2,3) --echo # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OKf','ERRORf') AS Expected FROM status_by_user WHERE user IN ('user1') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OKg','ERRORg') AS Expected FROM status_by_user WHERE user IN ('user2') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OKh','ERRORh') AS Expected FROM status_by_user WHERE user IN ('user3') AND variable_name IN ('handler_delete'); --echo # --echo # STATUS_BY_USER vs. GLOBAL_STATUS --echo # -SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OK','ERROR') Expected +SELECT variable_name, u1, u2, u3, delta, user, IF(user=delta,'OKi','ERRORi') Expected FROM test.status_results ORDER BY variable_name; @@ -249,23 +243,23 @@ ORDER BY variable_name; --echo # ================================================================================ --echo # TEST 6: STATUS_BY_ACCOUNT: Verify expected status counts per user:host (1,2,3) --echo # ================================================================================ -SELECT *, IF (variable_value = 1,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 1,'OKj','ERRORj') AS Expected FROM status_by_account WHERE user IN ('user1') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 2,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 2,'OKk','ERRORk') AS Expected FROM status_by_account WHERE user IN ('user2') AND variable_name IN ('handler_delete'); --echo # -SELECT *, IF (variable_value = 3,'OK','ERROR') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 3,'OKl','ERRORl') AS Expected FROM status_by_account WHERE user IN ('user3') AND variable_name IN ('handler_delete'); --echo # --echo # STATUS_BY_ACCOUNT vs. GLOBAL_STATUS --echo # -SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OK','ERROR') Expected +SELECT variable_name, a1, a2, a3, delta, acct, IF(acct=delta,'OKn','ERRORn') Expected FROM test.status_results ORDER BY variable_name; --echo # ================================================================================ --echo # TEST 7: STATUS_BY_HOST: Verify expected status counts per host (6) --echo # ================================================================================ -SELECT *, IF (variable_value = 6,'OK','ERROR') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); +SELECT *, IF (variable_value = 6,'OKo','ERRORo') AS Expected FROM status_by_host WHERE host IN ('localhost') AND variable_name IN ('handler_delete'); --echo # --echo # STATUS_BY_HOST vs. GLOBAL_STATUS @@ -273,11 +267,10 @@ SELECT *, IF (variable_value = 6,'OK','ERROR') AS Expected FROM status_by_host W --echo # Special case: No way to isolate pre-existing 'localhost' activity, so --echo # just check global totals = sum(status_by_host). --echo # -SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OK','ERROR') Expected +SELECT variable_name, h1, h2, h3, delta, host, IF(host=delta,'OKp','ERRORp') Expected FROM test.status_results ORDER BY variable_name; - --echo # ================================================================================ --echo # TEST 8: FLUSH STATUS should clear account, host and user status --echo # ================================================================================ @@ -290,7 +283,6 @@ SELECT * FROM status_by_host WHERE host IN ('localhost') AND variable_name IN (' --echo # SELECT * FROM status_by_user WHERE user IN ('user1', 'user2', 'user3') AND variable_name IN ('handler_delete'); - --echo # ================================================================================ --echo # CLEANUP --echo # ================================================================================ From c378efeeb9bdd8d0f184d17493812bda83a5a0fb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 13 Oct 2023 13:33:36 +0200 Subject: [PATCH 10/16] make perfschema.show_aggregate test more reliable --- .../include/wait_for_pfs_thread_count.inc | 13 +------------ mysql-test/suite/perfschema/r/show_aggregate.result | 6 +++--- mysql-test/suite/perfschema/t/show_aggregate.test | 11 ++++++++--- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc b/mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc index 2375bdf1cac..49489b495e5 100644 --- a/mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc +++ b/mysql-test/suite/perfschema/include/wait_for_pfs_thread_count.inc @@ -4,17 +4,6 @@ # Wait until there is only one session left, this one. -let $wait_condition= - select count(*) = 1 from information_schema.processlist; ---source include/wait_condition.inc - -# Threads are removed from information_schema.processlist -# very soon, but continue to execute in the server, -# before finally be removed from performance_schema.threads. -# Because instrumentation is optional, we use "<=" here. - -let $wait_condition= - select count(*) <= 2 from performance_schema.threads - where `TYPE`='FOREGROUND'; +let $wait_condition= select count(*) = 1 from performance_schema.threads where `type`='foreground'; --source include/wait_condition.inc diff --git a/mysql-test/suite/perfschema/r/show_aggregate.result b/mysql-test/suite/perfschema/r/show_aggregate.result index b5e957f3fc8..3facb3c5f04 100644 --- a/mysql-test/suite/perfschema/r/show_aggregate.result +++ b/mysql-test/suite/perfschema/r/show_aggregate.result @@ -83,9 +83,9 @@ ROLLBACK; connection default; # Get thread ids for each connection. USE performance_schema; -SELECT thread_id INTO @con1_id FROM threads WHERE processlist_user IN ('user1'); -SELECT thread_id INTO @con2_id FROM threads WHERE processlist_user IN ('user2'); -SELECT thread_id INTO @con3_id FROM threads WHERE processlist_user IN ('user3'); +SELECT thread_id INTO @con1_id FROM threads WHERE processlist_user IN ('user1') and processlist_id; +SELECT thread_id INTO @con2_id FROM threads WHERE processlist_user IN ('user2') and processlist_id; +SELECT thread_id INTO @con3_id FROM threads WHERE processlist_user IN ('user3') and processlist_id; #================= # Global results #================= diff --git a/mysql-test/suite/perfschema/t/show_aggregate.test b/mysql-test/suite/perfschema/t/show_aggregate.test index ba1d87d1f72..c84e99f6efc 100644 --- a/mysql-test/suite/perfschema/t/show_aggregate.test +++ b/mysql-test/suite/perfschema/t/show_aggregate.test @@ -13,6 +13,7 @@ --source include/not_embedded.inc --source include/no_protocol.inc --source include/maybe_pool_of_threads.inc +--source include/wait_for_pfs_thread_count.inc --echo # --echo # ================================================================================ @@ -107,9 +108,9 @@ ROLLBACK; connection default; --echo # Get thread ids for each connection. USE performance_schema; -SELECT thread_id INTO @con1_id FROM threads WHERE processlist_user IN ('user1'); -SELECT thread_id INTO @con2_id FROM threads WHERE processlist_user IN ('user2'); -SELECT thread_id INTO @con3_id FROM threads WHERE processlist_user IN ('user3'); +SELECT thread_id INTO @con1_id FROM threads WHERE processlist_user IN ('user1') and processlist_id; +SELECT thread_id INTO @con2_id FROM threads WHERE processlist_user IN ('user2') and processlist_id; +SELECT thread_id INTO @con3_id FROM threads WHERE processlist_user IN ('user3') and processlist_id; --source ../include/show_aggregate.inc @@ -201,6 +202,7 @@ ORDER BY variable_name; disconnect con1; disconnect con2; disconnect con3; + --echo # USE test; --echo # @@ -212,6 +214,9 @@ UPDATE test.status_results h1=0, h2=0, h3=0, host=0, a1=0, a2=0, a3=0, acct=0; +let $wait_condition= select count(*) = 0 from performance_schema.threads where processlist_user like 'user%' and processlist_id; +--source include/wait_condition.inc + #--echo DEBUG #SELECT * FROM test.status_results; --echo # From ea0b1ccd411dbb8c45d4ff453a401a41e68cd30e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 7 Oct 2023 10:49:36 +0200 Subject: [PATCH 11/16] Revert "MDEV-29091: Correct event_name in PFS for wait caused by FOR UPDATE" This reverts commit 03c9a4ef4a0363ba0ffd1843284332fb9c5fd692. The fix is wrong. It was doing this: if the uninitialized wait->m_class has some specific value, then don't initialize it. --- .../r/events_waits_current_MDEV-29091.result | 41 ---- .../r/table_aggregate_hist_2u_2t.result | 120 ++++++++---- .../r/table_aggregate_hist_2u_3t.result | 180 ++++++++++++------ .../r/table_aggregate_hist_4u_2t.result | 120 ++++++++---- .../r/table_aggregate_hist_4u_3t.result | 180 ++++++++++++------ .../t/events_waits_current_MDEV-29091.test | 62 ------ storage/perfschema/pfs.cc | 3 +- 7 files changed, 401 insertions(+), 305 deletions(-) delete mode 100644 mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result delete mode 100644 mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test diff --git a/mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result b/mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result deleted file mode 100644 index 8f3a17a0fc5..00000000000 --- a/mysql-test/suite/perfschema/r/events_waits_current_MDEV-29091.result +++ /dev/null @@ -1,41 +0,0 @@ -SET default_storage_engine=InnoDB; -SELECT @save_instrument_enabled := ENABLED -, @save_instrument_timed := TIMED -FROM performance_schema.setup_instruments -WHERE NAME = 'wait/lock/table/sql/handler'; -@save_instrument_enabled := ENABLED @save_instrument_timed := TIMED -YES YES -SELECT @save_consumer_enabled := ENABLED -FROM performance_schema.setup_consumers -WHERE NAME = 'events_waits_current'; -@save_consumer_enabled := ENABLED -YES -UPDATE performance_schema.setup_instruments -SET ENABLED = 'YES', TIMED = 'YES' -WHERE NAME = 'wait/lock/table/sql/handler'; -UPDATE performance_schema.setup_consumers -SET ENABLED = 'YES' -WHERE NAME = 'events_waits_current'; -CREATE TABLE t1 (id1 INT(11), col1 VARCHAR (200)); -INSERT INTO t1 VALUES (1, 'aa'); -INSERT INTO t1 VALUES (2, 'bb'); -connect con1,localhost,root,,test; -connect con2,localhost,root,,test; -connection con1; -START TRANSACTION; -connection con2; -START TRANSACTION; -SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE; -connection default; -SELECT event_name FROM performance_schema.events_waits_current -WHERE event_name LIKE '%wait/lock/table/sql/handler%'; -event_name -UPDATE performance_schema.setup_instruments -SET ENABLED = @save_instrument_enabled, TIMED = @save_instrument_timed -WHERE NAME = 'wait/lock/table/sql/handler'; -UPDATE performance_schema.setup_consumers -SET ENABLED = @save_consumer_enabled -WHERE NAME = 'events_waits_current'; -disconnect con1; -disconnect con2; -DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result index 47f4d7ba346..52ece6d289d 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result @@ -202,8 +202,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -260,8 +262,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -324,8 +328,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -423,8 +429,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -492,8 +500,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -603,8 +613,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 48 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 41 TABLE test t1 -wait/lock/table/sql/handler 78 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -677,8 +689,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 48 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 41 TABLE test t1 -wait/lock/table/sql/handler 78 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -800,8 +814,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 48 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 41 TABLE test t1 -wait/lock/table/sql/handler 78 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -875,8 +891,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -947,8 +965,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1019,8 +1039,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1088,8 +1110,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1156,8 +1180,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1223,8 +1249,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1289,8 +1317,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1357,8 +1387,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1424,8 +1456,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1491,8 +1525,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1558,8 +1594,10 @@ wait/io/table/sql/handler 71 wait/lock/table/sql/handler 56 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1625,8 +1663,10 @@ wait/io/table/sql/handler 0 wait/lock/table/sql/handler 0 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 0 0 0 0 0 0 0 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result index 9810d104ed9..b0ea06f4254 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result @@ -211,9 +211,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -276,9 +279,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -347,9 +353,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -453,9 +462,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -529,9 +541,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -647,9 +662,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 72 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 41 TABLE test t1 -wait/lock/table/sql/handler 56 TABLE test t2 -wait/lock/table/sql/handler 78 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 24 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -728,9 +746,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 72 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 41 TABLE test t1 -wait/lock/table/sql/handler 56 TABLE test t2 -wait/lock/table/sql/handler 78 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 24 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -858,9 +879,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 72 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 41 TABLE test t1 -wait/lock/table/sql/handler 56 TABLE test t2 -wait/lock/table/sql/handler 78 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 24 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -940,9 +964,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1019,9 +1046,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1098,9 +1128,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1174,9 +1207,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1249,9 +1285,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1323,9 +1362,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1396,9 +1438,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1471,9 +1516,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1545,9 +1593,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1619,9 +1670,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1693,9 +1747,12 @@ wait/io/table/sql/handler 103 wait/lock/table/sql/handler 84 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 17 11 6 11 2 4 0 @@ -1767,9 +1824,12 @@ wait/io/table/sql/handler 0 wait/lock/table/sql/handler 0 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 45 TABLE test t1 -wait/lock/table/sql/handler 60 TABLE test t2 -wait/lock/table/sql/handler 82 TABLE test t3 +wait/io/table/sql/handler 21 TABLE test t1 +wait/lock/table/sql/handler 24 TABLE test t1 +wait/io/table/sql/handler 32 TABLE test t2 +wait/lock/table/sql/handler 28 TABLE test t2 +wait/io/table/sql/handler 50 TABLE test t3 +wait/lock/table/sql/handler 32 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 0 0 0 0 0 0 0 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result index 367a8a089eb..0a6dea739e4 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result @@ -202,8 +202,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -260,8 +262,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -324,8 +328,10 @@ wait/io/table/sql/handler 23 wait/lock/table/sql/handler 24 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -423,8 +429,10 @@ wait/io/table/sql/handler 58 wait/lock/table/sql/handler 48 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 38 TABLE test t1 -wait/lock/table/sql/handler 68 TABLE test t3 +wait/io/table/sql/handler 18 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 40 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 14 9 5 9 2 3 0 @@ -492,8 +500,10 @@ wait/io/table/sql/handler 58 wait/lock/table/sql/handler 48 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 38 TABLE test t1 -wait/lock/table/sql/handler 68 TABLE test t3 +wait/io/table/sql/handler 18 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 40 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 14 9 5 9 2 3 0 @@ -603,8 +613,10 @@ wait/io/table/sql/handler 106 wait/lock/table/sql/handler 72 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 61 TABLE test t1 -wait/lock/table/sql/handler 117 TABLE test t3 +wait/io/table/sql/handler 31 TABLE test t1 +wait/lock/table/sql/handler 30 TABLE test t1 +wait/io/table/sql/handler 75 TABLE test t3 +wait/lock/table/sql/handler 42 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 25 16 9 16 3 6 0 @@ -677,8 +689,10 @@ wait/io/table/sql/handler 106 wait/lock/table/sql/handler 72 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 61 TABLE test t1 -wait/lock/table/sql/handler 117 TABLE test t3 +wait/io/table/sql/handler 31 TABLE test t1 +wait/lock/table/sql/handler 30 TABLE test t1 +wait/io/table/sql/handler 75 TABLE test t3 +wait/lock/table/sql/handler 42 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 25 16 9 16 3 6 0 @@ -800,8 +814,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 96 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 87 TABLE test t1 -wait/lock/table/sql/handler 176 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 40 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 56 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -875,8 +891,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -947,8 +965,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1019,8 +1039,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1088,8 +1110,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1156,8 +1180,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1223,8 +1249,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1289,8 +1317,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1357,8 +1387,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1424,8 +1456,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1491,8 +1525,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1558,8 +1594,10 @@ wait/io/table/sql/handler 167 wait/lock/table/sql/handler 104 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1625,8 +1663,10 @@ wait/io/table/sql/handler 0 wait/lock/table/sql/handler 0 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 0 0 0 0 0 0 0 diff --git a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result index ed1ac9d979b..c2eda2b8f23 100644 --- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result +++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result @@ -211,9 +211,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -276,9 +279,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -347,9 +353,12 @@ wait/io/table/sql/handler 33 wait/lock/table/sql/handler 36 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 18 TABLE test t1 -wait/lock/table/sql/handler 22 TABLE test t2 -wait/lock/table/sql/handler 29 TABLE test t3 +wait/io/table/sql/handler 8 TABLE test t1 +wait/lock/table/sql/handler 10 TABLE test t1 +wait/io/table/sql/handler 10 TABLE test t2 +wait/lock/table/sql/handler 12 TABLE test t2 +wait/io/table/sql/handler 15 TABLE test t3 +wait/lock/table/sql/handler 14 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 6 4 2 4 1 1 0 @@ -453,9 +462,12 @@ wait/io/table/sql/handler 84 wait/lock/table/sql/handler 72 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 38 TABLE test t1 -wait/lock/table/sql/handler 50 TABLE test t2 -wait/lock/table/sql/handler 68 TABLE test t3 +wait/io/table/sql/handler 18 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 26 TABLE test t2 +wait/lock/table/sql/handler 24 TABLE test t2 +wait/io/table/sql/handler 40 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 14 9 5 9 2 3 0 @@ -529,9 +541,12 @@ wait/io/table/sql/handler 84 wait/lock/table/sql/handler 72 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 38 TABLE test t1 -wait/lock/table/sql/handler 50 TABLE test t2 -wait/lock/table/sql/handler 68 TABLE test t3 +wait/io/table/sql/handler 18 TABLE test t1 +wait/lock/table/sql/handler 20 TABLE test t1 +wait/io/table/sql/handler 26 TABLE test t2 +wait/lock/table/sql/handler 24 TABLE test t2 +wait/io/table/sql/handler 40 TABLE test t3 +wait/lock/table/sql/handler 28 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 14 9 5 9 2 3 0 @@ -647,9 +662,12 @@ wait/io/table/sql/handler 154 wait/lock/table/sql/handler 108 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 61 TABLE test t1 -wait/lock/table/sql/handler 84 TABLE test t2 -wait/lock/table/sql/handler 117 TABLE test t3 +wait/io/table/sql/handler 31 TABLE test t1 +wait/lock/table/sql/handler 30 TABLE test t1 +wait/io/table/sql/handler 48 TABLE test t2 +wait/lock/table/sql/handler 36 TABLE test t2 +wait/io/table/sql/handler 75 TABLE test t3 +wait/lock/table/sql/handler 42 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 25 16 9 16 3 6 0 @@ -728,9 +746,12 @@ wait/io/table/sql/handler 154 wait/lock/table/sql/handler 108 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 61 TABLE test t1 -wait/lock/table/sql/handler 84 TABLE test t2 -wait/lock/table/sql/handler 117 TABLE test t3 +wait/io/table/sql/handler 31 TABLE test t1 +wait/lock/table/sql/handler 30 TABLE test t1 +wait/io/table/sql/handler 48 TABLE test t2 +wait/lock/table/sql/handler 36 TABLE test t2 +wait/io/table/sql/handler 75 TABLE test t3 +wait/lock/table/sql/handler 42 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 25 16 9 16 3 6 0 @@ -858,9 +879,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 144 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 87 TABLE test t1 -wait/lock/table/sql/handler 124 TABLE test t2 -wait/lock/table/sql/handler 176 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 40 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 48 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 56 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -940,9 +964,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1019,9 +1046,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1098,9 +1128,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1174,9 +1207,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1249,9 +1285,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1323,9 +1362,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1396,9 +1438,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1471,9 +1516,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1545,9 +1593,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1619,9 +1670,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1693,9 +1747,12 @@ wait/io/table/sql/handler 243 wait/lock/table/sql/handler 156 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 39 25 14 25 4 10 0 @@ -1767,9 +1824,12 @@ wait/io/table/sql/handler 0 wait/lock/table/sql/handler 0 execute dump_waits_history; event_name count(event_name) object_type object_schema object_name -wait/lock/table/sql/handler 91 TABLE test t1 -wait/lock/table/sql/handler 128 TABLE test t2 -wait/lock/table/sql/handler 180 TABLE test t3 +wait/io/table/sql/handler 47 TABLE test t1 +wait/lock/table/sql/handler 44 TABLE test t1 +wait/io/table/sql/handler 76 TABLE test t2 +wait/lock/table/sql/handler 52 TABLE test t2 +wait/io/table/sql/handler 120 TABLE test t3 +wait/lock/table/sql/handler 60 TABLE test t3 execute dump_waits_index_io; object_type object_schema object_name index_name count_star count_read count_write count_fetch count_insert count_update count_delete TABLE test t1 NULL 0 0 0 0 0 0 0 diff --git a/mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test b/mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test deleted file mode 100644 index d9330ee5a9d..00000000000 --- a/mysql-test/suite/perfschema/t/events_waits_current_MDEV-29091.test +++ /dev/null @@ -1,62 +0,0 @@ -# -# proper event name wait/lock/table/sql/handler recorded in -# PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. Before this fix, it was -# labeled as wait/io/table/sql/handler. -# - ---source include/have_innodb.inc ---source include/have_perfschema.inc ---source include/not_embedded.inc - -SET default_storage_engine=InnoDB; - -SELECT @save_instrument_enabled := ENABLED -, @save_instrument_timed := TIMED -FROM performance_schema.setup_instruments -WHERE NAME = 'wait/lock/table/sql/handler'; - -SELECT @save_consumer_enabled := ENABLED -FROM performance_schema.setup_consumers -WHERE NAME = 'events_waits_current'; - -UPDATE performance_schema.setup_instruments -SET ENABLED = 'YES', TIMED = 'YES' -WHERE NAME = 'wait/lock/table/sql/handler'; - -UPDATE performance_schema.setup_consumers -SET ENABLED = 'YES' -WHERE NAME = 'events_waits_current'; - -CREATE TABLE t1 (id1 INT(11), col1 VARCHAR (200)); -INSERT INTO t1 VALUES (1, 'aa'); -INSERT INTO t1 VALUES (2, 'bb'); - -connect (con1,localhost,root,,test); -connect (con2,localhost,root,,test); - -connection con1; -START TRANSACTION; -let $wait_condition= - SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE; ---source include/wait_condition.inc - -connection con2; -START TRANSACTION; -send SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE; - -connection default; -SELECT event_name FROM performance_schema.events_waits_current -WHERE event_name LIKE '%wait/lock/table/sql/handler%'; - -# clean up -UPDATE performance_schema.setup_instruments -SET ENABLED = @save_instrument_enabled, TIMED = @save_instrument_timed -WHERE NAME = 'wait/lock/table/sql/handler'; - -UPDATE performance_schema.setup_consumers -SET ENABLED = @save_consumer_enabled -WHERE NAME = 'events_waits_current'; - -disconnect con1; -disconnect con2; -DROP TABLE t1; diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 8b3a159f7a2..1373f9dd43d 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -3068,8 +3068,7 @@ pfs_start_table_io_wait_v1(PSI_table_locker_state *state, PFS_table_share *share= pfs_table->m_share; wait->m_thread_internal_id= pfs_thread->m_thread_internal_id; - if (wait->m_class == NULL || wait->m_class->m_type != PFS_CLASS_TABLE_LOCK) - wait->m_class= &global_table_io_class; + wait->m_class= &global_table_io_class; wait->m_timer_start= timer_start; wait->m_timer_end= 0; wait->m_object_instance_addr= pfs_table->m_identity; From 3da5d047b8d8c193a872c5ae6c3fb213218117bc Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 17 Oct 2023 18:37:45 +0530 Subject: [PATCH 12/16] MDEV-31851 After crash recovery, undo tablespace fails to open Problem: ======== - InnoDB fails to open undo tablespace when page0 is corrupted and fails to throw error. Solution: ========= - InnoDB throws DB_CORRUPTION error when InnoDB encounters page0 corruption of undo tablespace. - InnoDB restores the page0 of undo tablespace from doublewrite buffer if it encounters page corruption - Moved Datafile::restore_from_doublewrite() to recv_dblwr_t::restore_first_page(). So that undo tablespace and system tablespace can use this function instead of duplicating the code srv_undo_tablespace_open(): Returns 0 if file doesn't exist or ULINT_UNDEFINED if page0 is corrupted. --- .../suite/innodb/r/undo_space_dblwr.result | 21 +++++++ .../suite/innodb/t/undo_space_dblwr.opt | 2 + .../suite/innodb/t/undo_space_dblwr.test | 47 +++++++++++++++ storage/innobase/buf/buf0dblwr.cc | 2 +- storage/innobase/fsp/fsp0file.cc | 58 +------------------ storage/innobase/fsp/fsp0sysspace.cc | 4 +- storage/innobase/handler/ha_innodb.cc | 1 + storage/innobase/include/fsp0file.h | 5 -- storage/innobase/include/log0recv.h | 9 +++ storage/innobase/log/log0recv.cc | 34 +++++++++++ storage/innobase/srv/srv0start.cc | 47 ++++++++------- 11 files changed, 145 insertions(+), 85 deletions(-) create mode 100644 mysql-test/suite/innodb/r/undo_space_dblwr.result create mode 100644 mysql-test/suite/innodb/t/undo_space_dblwr.opt create mode 100644 mysql-test/suite/innodb/t/undo_space_dblwr.test diff --git a/mysql-test/suite/innodb/r/undo_space_dblwr.result b/mysql-test/suite/innodb/r/undo_space_dblwr.result new file mode 100644 index 00000000000..7954c426341 --- /dev/null +++ b/mysql-test/suite/innodb/r/undo_space_dblwr.result @@ -0,0 +1,21 @@ +call mtr.add_suppression("Checksum mismatch in the first page of file"); +show variables like 'innodb_doublewrite'; +Variable_name Value +innodb_doublewrite ON +create table t1(f1 int not null, f2 int not null)engine=innodb; +insert into t1 values (1, 1); +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +InnoDB 0 transactions not purged +set GLOBAL innodb_log_checkpoint_now=1; +# Make the first page dirty for undo tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 1; +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=0.0; +# Kill the server +# restart +FOUND 1 /Checksum mismatch in the first page of file/ in mysqld.1.err +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/suite/innodb/t/undo_space_dblwr.opt b/mysql-test/suite/innodb/t/undo_space_dblwr.opt new file mode 100644 index 00000000000..0b4f59176f3 --- /dev/null +++ b/mysql-test/suite/innodb/t/undo_space_dblwr.opt @@ -0,0 +1,2 @@ +--innodb_undo_tablespaces=3 +--innodb_sys_tablespaces diff --git a/mysql-test/suite/innodb/t/undo_space_dblwr.test b/mysql-test/suite/innodb/t/undo_space_dblwr.test new file mode 100644 index 00000000000..c746f37ead7 --- /dev/null +++ b/mysql-test/suite/innodb/t/undo_space_dblwr.test @@ -0,0 +1,47 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc +call mtr.add_suppression("Checksum mismatch in the first page of file"); +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; + +show variables like 'innodb_doublewrite'; +create table t1(f1 int not null, f2 int not null)engine=innodb; +insert into t1 values (1, 1); + +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; +--source include/wait_all_purged.inc + +set GLOBAL innodb_log_checkpoint_now=1; +--source ../include/no_checkpoint_start.inc + +--echo # Make the first page dirty for undo tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 1; + +SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; +SET GLOBAL innodb_max_dirty_pages_pct=0.0; + +sleep 1; +--let CLEANUP_IF_CHECKPOINT=drop table t1; +--source ../include/no_checkpoint_end.inc + +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}/undo001"; +my $page_size = $ENV{INNODB_PAGE_SIZE}; +die unless open(FILE, "+<", $fname); +sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n"; +substr($page, 49, 4) = pack("N", 1000); +sysseek(FILE, 0, 0)||die "Unable to seek $fname\n"; +die unless syswrite(FILE, $page, $page_size) == $page_size; +close FILE; +EOF + +--source include/start_mysqld.inc +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN= Checksum mismatch in the first page of file; +--source include/search_pattern_in_file.inc + +check table t1; +drop table t1; diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index b6b6e87b6df..57ec3553b8d 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -350,7 +350,7 @@ void buf_dblwr_t::recover() { byte *page= *i; const uint32_t page_no= page_get_page_no(page); - if (!page_no) /* recovered via Datafile::restore_from_doublewrite() */ + if (!page_no) /* recovered via recv_dblwr_t::restore_first_page() */ continue; const lsn_t lsn= mach_read_from_8(page + FIL_PAGE_LSN); diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc index f131e4e90da..f0ead3b80a3 100644 --- a/storage/innobase/fsp/fsp0file.cc +++ b/storage/innobase/fsp/fsp0file.cc @@ -481,7 +481,8 @@ Datafile::validate_for_recovery() return(err); } - if (restore_from_doublewrite()) { + if (recv_sys.dblwr.restore_first_page( + m_space_id, m_filepath, m_handle)) { return(DB_CORRUPTION); } @@ -768,61 +769,6 @@ Datafile::find_space_id() return(DB_CORRUPTION); } - -/** Restore the first page of the tablespace from -the double write buffer. -@return whether the operation failed */ -bool -Datafile::restore_from_doublewrite() -{ - if (srv_operation > SRV_OPERATION_EXPORT_RESTORED) { - return true; - } - - /* Find if double write buffer contains page_no of given space id. */ - const page_id_t page_id(m_space_id, 0); - const byte* page = recv_sys.dblwr.find_page(page_id); - - if (!page) { - /* If the first page of the given user tablespace is not there - in the doublewrite buffer, then the recovery is going to fail - now. Hence this is treated as an error. */ - - ib::error() - << "Corrupted page " << page_id - << " of datafile '" << m_filepath - << "' could not be found in the doublewrite buffer."; - - return(true); - } - - ulint flags = mach_read_from_4( - FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); - - if (!fil_space_t::is_valid_flags(flags, m_space_id)) { - flags = fsp_flags_convert_from_101(flags); - /* recv_dblwr_t::validate_page() inside find_page() - checked this already. */ - ut_ad(flags != ULINT_UNDEFINED); - /* The flags on the page should be converted later. */ - } - - ulint physical_size = fil_space_t::physical_size(flags); - - ut_a(page_get_page_no(page) == page_id.page_no()); - - ib::info() << "Restoring page " << page_id - << " of datafile '" << m_filepath - << "' from the doublewrite buffer. Writing " - << physical_size << " bytes into file '" - << m_filepath << "'"; - - return(os_file_write( - IORequestWrite, - m_filepath, m_handle, page, 0, physical_size) - != DB_SUCCESS); -} - /** Create a link filename based on the contents of m_name, open that file, and read the contents into m_filepath. @retval DB_SUCCESS if remote linked tablespace file is opened and read. diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 07a8295a94e..a7bb417c502 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -594,7 +594,9 @@ SysTablespace::read_lsn_and_check_flags(lsn_t* flushed_lsn) if (err != DB_SUCCESS && (retry == 1 - || it->restore_from_doublewrite())) { + || recv_sys.dblwr.restore_first_page( + it->m_space_id, it->m_filepath, + it->handle()))) { it->close(); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 291568c6e2a..695f2895e4e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18298,6 +18298,7 @@ checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save) while (log_sys.last_checkpoint_lsn.load( std::memory_order_acquire) + SIZE_OF_FILE_CHECKPOINT + + log_sys.framing_size() < (lsn= log_sys.get_lsn(std::memory_order_acquire))) { log_make_checkpoint(); log_sys.log.flush(); diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h index 7db85e87ed0..342b243f731 100644 --- a/storage/innobase/include/fsp0file.h +++ b/storage/innobase/include/fsp0file.h @@ -423,11 +423,6 @@ private: else DB_ERROR. */ dberr_t find_space_id(); - /** Restore the first page of the tablespace from - the double write buffer. - @return whether the operation failed */ - bool restore_from_doublewrite(); - /** Points into m_filepath to the file name with extension */ char* m_filename; diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 263996a78d3..34211392ba3 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -134,6 +134,15 @@ struct recv_dblwr_t byte* find_page(const page_id_t page_id, const fil_space_t *space= NULL, byte *tmp_buf= NULL); + /** Restore the first page of the given tablespace from + doublewrite buffer. + @param space_id tablespace identifier + @param name tablespace filepath + @param file tablespace file handle + @return whether the operation failed */ + bool restore_first_page( + ulint space_id, const char *name, os_file_t file); + typedef std::deque > list; /** Recovered doublewrite buffer page frames */ diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index e452267d2e8..3b59fb43ed3 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3819,6 +3819,11 @@ byte *recv_dblwr_t::find_page(const page_id_t page_id, if (page_get_page_no(page) != page_id.page_no() || page_get_space_id(page) != page_id.space()) continue; + uint32_t flags= mach_read_from_4( + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); + if (!fil_space_t::is_valid_flags(flags, page_id.space())) + continue; + const lsn_t lsn= mach_read_from_8(page + FIL_PAGE_LSN); if (lsn <= max_lsn || !validate_page(page_id, page, space, tmp_buf)) @@ -3827,9 +3832,38 @@ byte *recv_dblwr_t::find_page(const page_id_t page_id, memset(page + FIL_PAGE_LSN, 0, 8); continue; } + + ut_a(page_get_page_no(page) == page_id.page_no()); max_lsn= lsn; result= page; } return result; } + +bool recv_dblwr_t::restore_first_page(ulint space_id, const char *name, + os_file_t file) +{ + const page_id_t page_id(space_id, 0); + const byte* page= find_page(page_id); + if (!page) + { + /* If the first page of the given user tablespace is not there + in the doublewrite buffer, then the recovery is going to fail + now. Hence this is treated as error. */ + ib::error() + << "Corrupted page " << page_id << " of datafile '" + << name <<"' could not be found in the doublewrite buffer."; + return true; + } + + ulint physical_size= fil_space_t::physical_size( + mach_read_from_4(page + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS)); + ib::info() << "Restoring page " << page_id << " of datafile '" + << name << "' from the doublewrite buffer. Writing " + << physical_size << " bytes into file '" << name << "'"; + + return os_file_write( + IORequestWrite, name, file, page, 0, physical_size) != + DB_SUCCESS; +} diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index cc6fed7f86c..180c8a1a825 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -484,7 +484,8 @@ static ulint trx_rseg_get_n_undo_tablespaces() @param[in] name tablespace file name @param[in] i undo tablespace count @return undo tablespace identifier -@retval 0 on failure */ +@retval 0 if file doesn't exist +@retval ULINT_UNDEFINED if page0 is corrupted */ static ulint srv_undo_tablespace_open(bool create, const char* name, ulint i) { bool success; @@ -523,13 +524,13 @@ static ulint srv_undo_tablespace_open(bool create, const char* name, ulint i) { page_t *page= static_cast(aligned_malloc(srv_page_size, srv_page_size)); - dberr_t err= os_file_read(IORequestRead, fh, page, 0, srv_page_size); - if (err != DB_SUCCESS) + if (os_file_read(IORequestRead, fh, page, 0, srv_page_size) != + DB_SUCCESS) { err_exit: ib::error() << "Unable to read first page of file " << name; aligned_free(page); - return err; + return ULINT_UNDEFINED; } uint32_t id= mach_read_from_4(FIL_PAGE_SPACE_ID + page); @@ -538,19 +539,18 @@ err_exit: FSP_HEADER_OFFSET + FSP_SPACE_ID + page, 4)) { ib::error() << "Inconsistent tablespace ID in file " << name; - err= DB_CORRUPTION; - goto err_exit; - } - - fsp_flags= mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); - if (buf_page_is_corrupted(false, page, fsp_flags)) - { - ib::error() << "Checksum mismatch in the first page of file " << name; - err= DB_CORRUPTION; goto err_exit; } space_id= id; + fsp_flags= mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); + if (buf_page_is_corrupted(false, page, fsp_flags)) + { + ib::error() << "Checksum mismatch in the first page of file " << name; + if (recv_sys.dblwr.restore_first_page(space_id, name, fh)) + goto err_exit; + } + snprintf(undo_name, sizeof undo_name, "innodb_undo%03u", id); aligned_free(page); } @@ -669,17 +669,19 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo) snprintf(name, sizeof name, "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, i + 1); ulint space_id= srv_undo_tablespace_open(create_new_db, name, i); - if (!space_id) - { + switch (space_id) { + case ULINT_UNDEFINED: + return DB_CORRUPTION; + case 0: if (!create_new_db) - break; - ib::error() << "Unable to open create tablespace '" << name << "'."; + goto unused_undo; + sql_print_error("InnoDB: Unable to open create tablespace '%s'", name); return DB_ERROR; + default: + /* Should be no gaps in undo tablespace ids. */ + ut_a(!i || prev_id + 1 == space_id); } - /* Should be no gaps in undo tablespace ids. */ - ut_a(!i || prev_id + 1 == space_id); - prev_id= space_id; /* Note the first undo tablespace id in case of @@ -692,14 +694,15 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo) We stop at the first failure. These are undo tablespaces that are not in use and therefore not required by recovery. We only check that there are no gaps. */ - +unused_undo: for (ulint i= prev_id + 1; i < srv_undo_space_id_start + TRX_SYS_N_RSEGS; ++i) { char name[OS_FILE_MAX_PATH]; snprintf(name, sizeof(name), "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, i); - if (!srv_undo_tablespace_open(create_new_db, name, i)) + ulint space_id= srv_undo_tablespace_open(create_new_db, name, i); + if (!space_id || space_id == SRV_SPACE_ID_UPPER_BOUND) break; ++srv_undo_tablespaces_open; } From cfd1788182b0deb399d4eb7a75fb6093087b0c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 18 Oct 2023 16:51:04 +0300 Subject: [PATCH 13/16] MDEV-32511: Race condition between checkpoint and page write fil_aio_callback(): Invoke fil_node_t::complete_write() before releasing any page latch, so that in case a log checkpoint is executed roughly concurrently with the first write into a file since the previous checkpoint, we will not miss a fdatasync() or fsync() call to make the write durable. --- storage/innobase/fil/fil0fil.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index ea7c496b86b..885b0a700ea 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -3445,18 +3445,18 @@ void fil_aio_callback(const IORequest &request) if (!request.bpage) { + request.node->complete_write(); ut_ad(!srv_read_only_mode); if (request.type == IORequest::DBLWR_BATCH) buf_dblwr.flush_buffered_writes_completed(request); else ut_ad(request.type == IORequest::WRITE_ASYNC); -write_completed: request.node->complete_write(); } else if (request.is_write()) { + request.node->complete_write(); buf_page_write_complete(request); - goto write_completed; } else { From 2d6dc65de56be1d151374cd0257e616407cd1c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Oct 2023 08:24:37 +0300 Subject: [PATCH 14/16] MDEV-32144 fixup In commit 384eb570a654261639dc1fc73c347f0d3759f567 the debug check was relaxed in trx_undo_header_create(), not in the intended function trx_undo_write_xid(). --- storage/innobase/trx/trx0undo.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 15acd40645a..bb327f6cc9d 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -523,8 +523,9 @@ static void trx_undo_write_xid(buf_block_t *block, uint16_t offset, static_cast(xid.bqual_length)); const ulint xid_length= static_cast(xid.gtrid_length + xid.bqual_length); - mtr->memcpy(*block, &block->frame[offset + TRX_UNDO_XA_XID], - xid.data, xid_length); + mtr->memcpy(*block, + &block->frame[offset + TRX_UNDO_XA_XID], + xid.data, xid_length); if (UNIV_LIKELY(xid_length < XIDDATASIZE)) mtr->memset(block, offset + TRX_UNDO_XA_XID + xid_length, XIDDATASIZE - xid_length, 0); From dbba1bb1c3522090f9a3bc54c107d684bfaed4ab Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 19 Oct 2023 13:11:20 +0530 Subject: [PATCH 15/16] MDEV-31851 After crash recovery, undo tablespace fails to open recv_recovery_from_checkpoint_start(): InnoDB should add the redo log block header + trailer size while checking the log sequence number in log file with log sequence number in the system tablespace first page. --- storage/innobase/log/log0recv.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 3b59fb43ed3..a213b4842ce 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3559,7 +3559,8 @@ completed: } else if (checkpoint_lsn != flush_lsn) { ut_ad(!srv_log_file_created); - if (checkpoint_lsn + sizeof_checkpoint < flush_lsn) { + if (checkpoint_lsn + sizeof_checkpoint + + log_sys.framing_size() < flush_lsn) { ib::warn() << "Are you sure you are using the right " << LOG_FILE_NAME From 85751ed81d6cdfffbe2572f401e62884a4e8c8dc Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 19 Oct 2023 15:39:44 +0530 Subject: [PATCH 16/16] MDEV-31851 After crash recovery, undo tablespace fails to open srv_all_undo_tablespaces_open(): While opening the extra unused undo tablespaces, InnoDB should use ULINT_UNDEFINED instead of SRV_SPACE_ID_UPPER_BOUND. --- storage/innobase/srv/srv0start.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 180c8a1a825..9b8ce4b2fa8 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -702,7 +702,7 @@ unused_undo: snprintf(name, sizeof(name), "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, i); ulint space_id= srv_undo_tablespace_open(create_new_db, name, i); - if (!space_id || space_id == SRV_SPACE_ID_UPPER_BOUND) + if (!space_id || space_id == ULINT_UNDEFINED) break; ++srv_undo_tablespaces_open; }