From 2b448e73371f464e0361fe18073ce774cbf76115 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 17 Apr 2025 10:51:48 +0300 Subject: [PATCH 01/89] print_ddl_recovery_log.pl ; Print content of the ddl_recovery.log --- .gitignore | 1 + scripts/CMakeLists.txt | 4 +- scripts/print_ddl_recovery_log.pl.in | 120 +++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100755 scripts/print_ddl_recovery_log.pl.in diff --git a/.gitignore b/.gitignore index a8f67d111c3..199776274e7 100644 --- a/.gitignore +++ b/.gitignore @@ -133,6 +133,7 @@ scripts/mysqld_safe scripts/mysqldumpslow scripts/mysqlhotcopy scripts/mytop +scripts/print_ddl_recovery_log.pl scripts/wsrep_sst_backup scripts/wsrep_sst_common scripts/wsrep_sst_mysqldump diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index a136125b5ae..2626aebcff3 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -272,7 +272,7 @@ IF(WIN32) # The resulting files will have .pl extension (those are perl scripts) # Input files with pl.in extension - SET(PLIN_FILES mysql_config) + SET(PLIN_FILES mysql_config print_ddl_recovery_log) # Input files with .sh extension SET(SH_FILES mysql_convert_table_format mysqld_multi mysqldumpslow @@ -331,6 +331,8 @@ ELSE() # Configure this one, for testing, but do not install it. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_config.pl.in ${CMAKE_CURRENT_BINARY_DIR}/mysql_config.pl ESCAPE_QUOTES @ONLY) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/print_ddl_recovery_log.pl.in + ${CMAKE_CURRENT_BINARY_DIR}/print_ddl_recovery_log.pl ESCAPE_QUOTES @ONLY) # On Unix, most of the files end up in the bin directory SET(BIN_SCRIPTS msql2mysql diff --git a/scripts/print_ddl_recovery_log.pl.in b/scripts/print_ddl_recovery_log.pl.in new file mode 100755 index 00000000000..6e300402cae --- /dev/null +++ b/scripts/print_ddl_recovery_log.pl.in @@ -0,0 +1,120 @@ +#!@PERL_PATH@ +use warnings; +use Fcntl qw(:seek); +use Getopt::Long; + +# Constants based on the source +use constant { + BLOCK_SIZE => 4096, + DDL_LOG_ACTION_TYPE_POS => 1, + DDL_LOG_PHASE_POS => 2, + DDL_LOG_NEXT_ENTRY_POS => 4, + DDL_LOG_FLAG_POS => 8, + DDL_LOG_XID_POS => 10, + DDL_LOG_UUID_POS => 18, + MY_UUID_SIZE => 16, + DDL_LOG_ID_POS => 34, + DDL_LOG_END_POS => 42, + NAME_START_POS => 56, +}; + +package main; + +my @log_entrys= ("Unknown", "EXECUTE", "ENTRY", "IGNORED" ); +my @log_actions= ("Unknown", "DELETE_FRM", "RENAME_FRM", "REPLACE", "EXCHANGE", + "RENAME_TABLE", "RENAME_VIEW", "DROP_INIT", "DROP_TABLE", + "DROP_VIEW", "DROP_TRIGGER", "DROP_DB", "CREATE_TABLE", + "CREATE_VIEW", "DELETE_TMP_FILE", "CREATE_TRIGGER", + "ALTER_TABLE", "STORE_QUERY"); + +$opt_skip_not_used= undef; +$opt_skip_ignored= undef; + +sub usage +{ + print < BLOCK_SIZE); + $str = substr($block, $pos, $len); + $pos += $len+1; + push @strings, $str; + } + + print "\n" if ($entry_num > 1); + print "=== DDL Log Entry $entry_num ===\n"; + $entry_num++; + + print "Entry Type : $log_entrys[$entry_type]\n"; + next if ($opt_skip_not_used && $entry_type == 0); + next if ($opt_skip_ignored && $entry_type >= 3); + + print "Action Type : $log_actions[$action_type]\n"; + print "Phase : $phase\n"; + print "Next Entry : $next_entry\n"; + print "Flags : $flags\n"; + print "XID : $xid\n"; + print "UUID : $uuid\n"; + print "Unique ID : $unique_id\n"; + print "Handler Name : $strings[0]\n"; + print "DB : $strings[1]\n"; + print "Name : $strings[2]\n"; + print "From Handler : $strings[3]\n"; + print "From DB : $strings[4]\n"; + print "From Name : $strings[5]\n"; + print "Temp/Extra : $strings[6]\n"; +} + +close $fh; From d3c5c47e0e8ba4cbca2b47e80a874841f7ba6108 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 2 Apr 2025 14:20:25 +1100 Subject: [PATCH 02/89] MDEV-36324 MDEV-35452 Missing appending FROM ... in spider_mbase_handler::append_key_select The missing append_from causes ill-formed query construction. This fixes spider/bugfix.mdev_35874 with --view-protocol. --- storage/spider/spd_db_mysql.cc | 4 +++- storage/spider/spd_db_mysql.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index b0c56b0376a..7cf3d2013cc 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -8889,12 +8889,13 @@ int spider_mbase_handler::append_key_select_part( default: DBUG_RETURN(0); } - error_num = append_key_select(str, idx); + error_num = append_key_select(str, sql_type, idx); DBUG_RETURN(error_num); } int spider_mbase_handler::append_key_select( spider_string *str, + ulong sql_type, uint idx ) { st_select_lex *select_lex = NULL; @@ -8943,6 +8944,7 @@ int spider_mbase_handler::append_key_select( str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN); } str->length(str->length() - SPIDER_SQL_COMMA_LEN); + DBUG_RETURN(append_from(str, sql_type, first_link_idx)); } else { table_name_pos = str->length() + mysql_share->key_select_pos[idx]; if (str->append(mysql_share->key_select[idx])) diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index ac00217ff4c..b9995faca7e 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -887,6 +887,7 @@ public: ) override; int append_key_select( spider_string *str, + ulong sql_type, uint idx ); int append_minimum_select_part( From 9089a75b7f63de4e487ec40c45dd2824f5d07b9a Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 15 Apr 2025 14:30:35 +1000 Subject: [PATCH 03/89] MDEV-36477 MDEV-35452 Fix Spider tests with view protocol fail with "Failed to drop view: 0: " The failure is caused by exec $stmt where $stmt has two queries. mtr with view protocol transforms the first query into a view, leaving the second query executed in the usual way. mtr being oblivious about the second query then does not handle its results, resulting in CR_COMMANDS_OUT_OF_SYNC. We disable view protocol for such edge cases. After fixing these "Failed to drop view: 0: " further failures emerge from two of the tests, which are the same problem as MDEV-36454, so we fix them to by disabling view protocol for the relevant SELECTs. --- .../spider/bugfix/include/mdev_21884_init.inc | 2 -- .../mysql-test/spider/bugfix/t/mdev_20100.test | 12 ++++++++++-- .../mysql-test/spider/bugfix/t/mdev_21884.test | 2 +- .../regression/e1121/t/direct_join_by_pkey_key.test | 4 ++-- .../regression/e1121/t/direct_join_by_pkey_pkey.test | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc b/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc index 25455ffcdf1..117899b0b69 100644 --- a/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc +++ b/storage/spider/mysql-test/spider/bugfix/include/mdev_21884_init.inc @@ -43,8 +43,6 @@ let $CHILD2_1_CREATE_TABLES= PRIMARY KEY(a,b) ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; --let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES -let $CHILD2_1_SELECT_TABLES= - SELECT pkey, txt FROM tbl_a ORDER BY pkey; let $CHILD2_1_SELECT_TABLES= SELECT a, b, c FROM ta_r2 ORDER BY a $STR_SEMICOLON SELECT a, b, c FROM ta_r3 ORDER BY a; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test index a440b370077..e4fd021d799 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test @@ -58,25 +58,33 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 --disable_ps2_protocol +--disable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt2) WHERE b = 'c'; +--enable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt1,pt2); +--disable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt3) WHERE b = 'c'; +--enable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt1,pt2); +--disable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt1) WHERE b = 'c'; +--enable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt1,pt3); +--disable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt1) WHERE b = 'c'; +--enable_view_protocol SELECT a, b, c FROM tbl_a PARTITION (pt2,pt3); --enable_ps2_protocol --connection child2_1 ---disable_ps2_protocol --disable_view_protocol +--disable_ps2_protocol eval $CHILD2_1_SELECT_ARGUMENT1; ---enable_view_protocol --enable_ps2_protocol --disable_ps_protocol eval $CHILD2_1_SELECT_TABLES; --enable_ps_protocol +--enable_view_protocol --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test index 01a2a1a1171..3b742e37655 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test @@ -85,10 +85,10 @@ SET NAMES utf8; --disable_ps2_protocol eval $CHILD2_1_SELECT_ARGUMENT1; --enable_ps2_protocol ---enable_view_protocol --disable_ps_protocol eval $CHILD2_1_SELECT_TABLES; --enable_ps_protocol +--enable_view_protocol --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test index fd61b986cb1..7c7c1dc69ce 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test +++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test @@ -60,6 +60,7 @@ INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),( --connection child2_1 TRUNCATE TABLE mysql.general_log; +--disable_view_protocol --connection master_1 --disable_ps2_protocol SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; @@ -67,11 +68,10 @@ SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; --connection child2_1 --disable_ps_protocol ---disable_view_protocol eval $CHILD2_1_SELECT_ARGUMENT1; ---enable_view_protocol eval $CHILD2_1_SELECT_TABLES; --enable_ps_protocol +--enable_view_protocol --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test index cc272be51b5..dd442272996 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test +++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test @@ -69,8 +69,8 @@ SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; --disable_ps_protocol --disable_view_protocol eval $CHILD2_1_SELECT_ARGUMENT1; ---enable_view_protocol eval $CHILD2_1_SELECT_TABLES; +--enable_view_protocol --enable_ps_protocol --echo From 08793310fb5b46e39057ba110661dd69d0201639 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 16 Apr 2025 14:45:21 +1000 Subject: [PATCH 04/89] MDEV-36478 MDEV-35452 Remove blocks testing SELECT SQL_CALC_FOUND_ROWS from spider tests Spider tables do not support SELECT SQL_CALC_FOUND_ROWS and the correct test output is a coincidence. Debugging shows that the limit_found_rows field was last updated in an unrelated statement: SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')\nFROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a As a byproduct, this fixes the "wrong found_rows() results" when running these tests with view protocol. --- .../mysql-test/spider/bg/r/basic_sql.result | 14 ------ .../mysql-test/spider/bg/t/basic_sql.test | 46 ------------------- .../spider/handler/r/basic_sql.result | 14 ------ .../spider/handler/t/basic_sql.test | 46 ------------------- .../mysql-test/spider/r/basic_sql.result | 14 ------ .../spider/mysql-test/spider/t/basic_sql.test | 46 ------------------- 6 files changed, 180 deletions(-) diff --git a/storage/spider/mysql-test/spider/bg/r/basic_sql.result b/storage/spider/mysql-test/spider/bg/r/basic_sql.result index 94a09fc317b..c28e69002b6 100644 --- a/storage/spider/mysql-test/spider/bg/r/basic_sql.result +++ b/storage/spider/mysql-test/spider/bg/r/basic_sql.result @@ -232,20 +232,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 4 i 2003-10-30 05:01:03 5 h 2001-10-31 23:59:59 -select sql_calc_found_rows -connection master_1; -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -connection master_1; -SELECT found_rows(); -found_rows() -5 - select high_priority connection master_1; SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l diff --git a/storage/spider/mysql-test/spider/bg/t/basic_sql.test b/storage/spider/mysql-test/spider/bg/t/basic_sql.test index 3aae2e34455..5278a27dd24 100644 --- a/storage/spider/mysql-test/spider/bg/t/basic_sql.test +++ b/storage/spider/mysql-test/spider/bg/t/basic_sql.test @@ -847,52 +847,6 @@ if ($USE_CHILD_GROUP2) } } ---echo ---echo select sql_calc_found_rows -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT found_rows(); ---enable_ps2_protocol - --echo --echo select high_priority if ($USE_CHILD_GROUP2) diff --git a/storage/spider/mysql-test/spider/handler/r/basic_sql.result b/storage/spider/mysql-test/spider/handler/r/basic_sql.result index 94a09fc317b..c28e69002b6 100644 --- a/storage/spider/mysql-test/spider/handler/r/basic_sql.result +++ b/storage/spider/mysql-test/spider/handler/r/basic_sql.result @@ -232,20 +232,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 4 i 2003-10-30 05:01:03 5 h 2001-10-31 23:59:59 -select sql_calc_found_rows -connection master_1; -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -connection master_1; -SELECT found_rows(); -found_rows() -5 - select high_priority connection master_1; SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l diff --git a/storage/spider/mysql-test/spider/handler/t/basic_sql.test b/storage/spider/mysql-test/spider/handler/t/basic_sql.test index 6421198fa95..c16d77d66e6 100644 --- a/storage/spider/mysql-test/spider/handler/t/basic_sql.test +++ b/storage/spider/mysql-test/spider/handler/t/basic_sql.test @@ -847,52 +847,6 @@ if ($USE_CHILD_GROUP2) } } ---echo ---echo select sql_calc_found_rows -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT found_rows(); ---enable_ps2_protocol - --echo --echo select high_priority if ($USE_CHILD_GROUP2) diff --git a/storage/spider/mysql-test/spider/r/basic_sql.result b/storage/spider/mysql-test/spider/r/basic_sql.result index 2443f3488bd..9b8ca4e08d1 100644 --- a/storage/spider/mysql-test/spider/r/basic_sql.result +++ b/storage/spider/mysql-test/spider/r/basic_sql.result @@ -232,20 +232,6 @@ a b date_format(c, '%Y-%m-%d %H:%i:%s') 4 i 2003-10-30 05:01:03 5 h 2001-10-31 23:59:59 -select sql_calc_found_rows -connection master_1; -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -a b date_format(c, '%Y-%m-%d %H:%i:%s') -1 f 2008-07-01 10:21:39 -2 g 2000-02-01 00:00:00 -3 j 2007-05-04 20:03:11 -4 i 2003-10-30 05:01:03 -connection master_1; -SELECT found_rows(); -found_rows() -5 - select high_priority connection master_1; SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l diff --git a/storage/spider/mysql-test/spider/t/basic_sql.test b/storage/spider/mysql-test/spider/t/basic_sql.test index ee77eacd885..5b8fb85aa31 100644 --- a/storage/spider/mysql-test/spider/t/basic_sql.test +++ b/storage/spider/mysql-test/spider/t/basic_sql.test @@ -847,52 +847,6 @@ if ($USE_CHILD_GROUP2) } } ---echo ---echo select sql_calc_found_rows -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 -SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l -ORDER BY a LIMIT 4; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } - --connection child2_1 - if ($USE_GENERAL_LOG) - { - SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} ---connection master_1 ---disable_ps2_protocol -SELECT found_rows(); ---enable_ps2_protocol - --echo --echo select high_priority if ($USE_CHILD_GROUP2) From b1446080d1e51808d188ded024b2fa2a6f5288f7 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 16 Apr 2025 17:31:39 +1000 Subject: [PATCH 05/89] MDEV-36476 MDEV-35452 Disable view protocol for spider tests where thread metadata could prevent lock wait timeout In spider/bugfix.mdev_29352, with flush tables with read lock, statements blocked in THD::has_read_only_protection() by checking THD::global_read_lock could result in view protocol to "hang" waiting for acquiring mdl in another THD. In spider/bugfix.mdev_34555, within an XA transaction, statements blocked by trans_check() by checking thd->transaction->xid_state could result in view protocol to "hang" for the same reason. Therefore we disable view protocol for relevant statements in these tests. --- storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test | 2 ++ storage/spider/mysql-test/spider/bugfix/t/mdev_34555.test | 2 ++ 2 files changed, 4 insertions(+) diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test index 626364efb99..52ad36735bd 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29352.test @@ -4,7 +4,9 @@ FLUSH TABLES WITH READ LOCK; --error ER_CANT_UPDATE_WITH_READLOCK CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so'; +--disable_view_protocol SELECT * FROM t; +--enable_view_protocol --source include/restart_mysqld.inc diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34555.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34555.test index 3a1cf604140..b1fcae38e2a 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_34555.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34555.test @@ -9,6 +9,7 @@ OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE '',user 'Spider', password 'foo'); CREATE TABLE tSpider (a INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"'; CREATE TABLE t2 (c INT,c2 CHAR(1)) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"'; XA START 'a'; +--disable_view_protocol --disable_result_log --error 0,ER_CONNECT_TO_FOREIGN_DATA_SOURCE SELECT * FROM information_schema.table_constraints; @@ -22,6 +23,7 @@ SELECT * FROM t2; SELECT SLEEP (1); --error ER_CONNECT_TO_FOREIGN_DATA_SOURCE SELECT * FROM t2; +--enable_view_protocol xa end 'a'; xa rollback 'a'; drop table tSpider, t2; From 5c92b27d5433df7558f41ac5718481f87bdfa544 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 17 Apr 2025 15:35:38 +1000 Subject: [PATCH 06/89] MDEV-36633 MDEV-35452 spider/bugfix.mdev_33434 reports wrong error in view protocol With view protocol collation_connection is reset in mysql_make_view in the "SELECT * FROM mysqltest_tmp_v" query. In the case of spider/bugfix.mdev_33434, it is reset to latin1_swedish_ci, with the latin1 charset. This results in no conversion needed since it is the same as character_set_client and the corresponding argument in the udf remains unchanged, with "dummy" srv value. Thus the reported error is 1477: 'The foreign server name you are trying to reference does not exist. Data source error: dummy' Without view protocol, the character_set_connection ucs2 setting in the test survives, and the conversion results in empty connection parameters, and the reported error is 1429 ER_CONNECT_TO_FOREIGN_DATA_SOURCE This failure is irrelevant to the test, or to spider at all. Therefore we disable view protocol for the statement. --- storage/spider/mysql-test/spider/bugfix/t/mdev_33434.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33434.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33434.test index dd9f882f42e..810b70f8fca 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_33434.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33434.test @@ -4,8 +4,10 @@ INSTALL SONAME 'ha_spider'; SET character_set_connection=ucs2; +--disable_view_protocol --error ER_CONNECT_TO_FOREIGN_DATA_SOURCE SELECT SPIDER_DIRECT_SQL('SELECT SLEEP(1)', '', 'srv "dummy", port "3307"'); +--enable_view_protocol --disable_query_log --source ../../include/clean_up_spider.inc --enable_query_log From 6f8ef26885073e1d0e3f69145d88c9452c0f4cf6 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 29 Apr 2025 16:28:01 +1000 Subject: [PATCH 07/89] MDEV-36032 Check whether a table can be a sequence when ALTERed with SEQUENCE=1 To check the rows, the table needs to be opened. To that end, and like MDEV-36038, we force COPY algorithm on ALTER TABLE ... SEQUENCE=1. This also results in checking the sequence state / metadata. The table structure was already validated before this patch. --- mysql-test/suite/sql_sequence/alter.result | 70 +++++++++++++++++++ mysql-test/suite/sql_sequence/alter.test | 81 ++++++++++++++++++++++ sql/handler.cc | 3 + sql/share/errmsg-utf8.txt | 4 ++ sql/sql_table.cc | 22 ++++++ 5 files changed, 180 insertions(+) diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 36cef2a3914..eb419609823 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -419,3 +419,73 @@ DROP SEQUENCE s2; # # End of 10.6 tests # +# +# MDEV-36032 Check when doing ALTER TABLE table_name sequence=1 that table can be a sequence +# +create sequence s; +alter table s sequence=0; +insert into s values (3,1,9223372036854775806,1,1,1000,0,0); +alter table s sequence=1; +ERROR HY000: More than one row in the table +drop table s; +create sequence s; +alter table s sequence=0; +delete from s; +insert into s values (2,500,200,1,1,1000,0,0); +select * from s; +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count +2 500 200 1 1 1000 0 0 +alter table s sequence=1; +ERROR HY000: Sequence 'test.s' has out of range value for options +check table s; +Table Op Msg_type Msg_text +test.s check status OK +select * from s; +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count +2 500 200 1 1 1000 0 0 +check table s; +Table Op Msg_type Msg_text +test.s check status OK +drop table s; +CREATE TABLE `s` ( +# `next_not_cached_value` bigint(21) NOT NULL, +`minimum_value` bigint(21) NOT NULL, +`maximum_value` bigint(21) NOT NULL, +`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', +`increment` bigint(21) NOT NULL COMMENT 'increment value', +`cache_size` bigint(21) unsigned NOT NULL, +`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', +`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=innodb; +alter table s sequence=1; +ERROR HY000: Sequence 'test.s' table structure is invalid (Wrong number of columns) +drop table s; +create sequence s; +alter table s drop column next_not_cached_value; +ERROR HY000: Sequence 'test.s' table structure is invalid (Wrong number of columns) +drop sequence s; +CREATE TABLE `s1` ( +`next_not_cached_value` bigint(21) NOT NULL, +`minimum_value` bigint(21) NOT NULL, +`maximum_value` bigint(21) NOT NULL, +`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', +`increment` bigint(21) NOT NULL COMMENT 'increment value', +`cache_size` bigint(21) unsigned NOT NULL, +`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', +`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=innodb; +alter table s1 sequence=1; +ERROR HY000: Fewer than one row in the table +alter table s1 sequence=0; +insert into s1 values (1,1,9223372036854775806,1,1,1000,0,0); +alter table s1 sequence=1; +alter table s1 sequence=0; +insert into s1 values (2,1,9223372036854775806,1,1,1000,0,0); +alter table s1 sequence=1; +ERROR HY000: More than one row in the table +alter table s1 sequence=0; +insert into s1 values (3,1,9223372036854775806,1,1,1000,0,0); +alter table s1 sequence=1; +ERROR HY000: More than one row in the table +drop table s1; +# End of 10.11 tests diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test index 9ac22b644e8..2bb2e1f62af 100644 --- a/mysql-test/suite/sql_sequence/alter.test +++ b/mysql-test/suite/sql_sequence/alter.test @@ -295,3 +295,84 @@ DROP SEQUENCE s2; --echo # --echo # End of 10.6 tests --echo # + +--echo # +--echo # MDEV-36032 Check when doing ALTER TABLE table_name sequence=1 that table can be a sequence +--echo # + +## Too many rows +create sequence s; +alter table s sequence=0; +insert into s values (3,1,9223372036854775806,1,1,1000,0,0); +--error ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS +alter table s sequence=1; +drop table s; + +## Insert a wrong row (min > max) +create sequence s; +alter table s sequence=0; +delete from s; +insert into s values (2,500,200,1,1,1000,0,0); +select * from s; +--error ER_SEQUENCE_INVALID_DATA +alter table s sequence=1; +check table s; +select * from s; +check table s; +drop table s; + +## Invalid table structure (already implemented before MDEV-36032) +CREATE TABLE `s` ( + # `next_not_cached_value` bigint(21) NOT NULL, + `minimum_value` bigint(21) NOT NULL, + `maximum_value` bigint(21) NOT NULL, + `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', + `increment` bigint(21) NOT NULL COMMENT 'increment value', + `cache_size` bigint(21) unsigned NOT NULL, + `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', + `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=innodb; +--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE +alter table s sequence=1; +drop table s; + +## Altering a sequence table to a wrong structure is detected (already +## implemented before MDEV-36032) +create sequence s; +--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE +alter table s drop column next_not_cached_value; +drop sequence s; + +## Create a normal table then alter to sequence +CREATE TABLE `s1` ( +`next_not_cached_value` bigint(21) NOT NULL, +`minimum_value` bigint(21) NOT NULL, +`maximum_value` bigint(21) NOT NULL, +`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used', +`increment` bigint(21) NOT NULL COMMENT 'increment value', +`cache_size` bigint(21) unsigned NOT NULL, +`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed', +`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' +) ENGINE=innodb; + +--error ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS +alter table s1 sequence=1; +# (for coverage) alter a non sequence table with sequence=0 +alter table s1 sequence=0; +insert into s1 values (1,1,9223372036854775806,1,1,1000,0,0); +alter table s1 sequence=1; + +alter table s1 sequence=0; +insert into s1 values (2,1,9223372036854775806,1,1,1000,0,0); +--error ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS +alter table s1 sequence=1; + +# (for coverage) alter a non sequence table with sequence=0 +alter table s1 sequence=0; +insert into s1 values (3,1,9223372036854775806,1,1,1000,0,0); +--error ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS +alter table s1 sequence=1; + +drop table s1; + +--echo # End of 10.11 tests diff --git a/sql/handler.cc b/sql/handler.cc index 85358db6f15..705fd0370e0 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -5454,6 +5454,9 @@ handler::check_if_supported_inplace_alter(TABLE *altered_table, (table->s->row_type != create_info->row_type)) DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + if (create_info->sequence) + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + uint table_changes= (ha_alter_info->handler_flags & ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE) ? IS_EQUAL_PACK_LENGTH : IS_EQUAL_YES; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index e7cbb87824c..93224d9c1b3 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -10758,3 +10758,7 @@ ER_CM_OPTION_MISSING_REQUIREMENT eng "CHANGE MASTER TO option '%s=%s' is missing requirement %s" ER_SLAVE_STATEMENT_TIMEOUT 70100 eng "Slave log event execution was interrupted (slave_max_statement_time exceeded)" +ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS + eng "Fewer than one row in the table" +ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS + eng "More than one row in the table" diff --git a/sql/sql_table.cc b/sql/sql_table.cc index d9ba09fd2a2..41978063f33 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -12154,6 +12154,16 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, Create_field *def; copy_end=copy; to->s->default_fields= 0; + if (to->s->table_type == TABLE_TYPE_SEQUENCE && + from->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT && + from->file->stats.records != 1) + { + if (from->file->stats.records > 1) + my_error(ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS, MYF(0)); + else + my_error(ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS, MYF(0)); + goto err; + } for (Field **ptr=to->field ; *ptr ; ptr++) { def=it++; @@ -12337,6 +12347,12 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, else to->next_number_field->reset(); } + if (to->s->table_type == TABLE_TYPE_SEQUENCE && found_count == 1) + { + my_error(ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS, MYF(0)); + error= 1; + break; + } error= to->file->ha_write_row(to->record[0]); to->auto_increment_field_not_null= FALSE; if (unlikely(error)) @@ -12356,6 +12372,12 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, thd->get_stmt_da()->inc_current_row_for_warning(); } + if (to->s->table_type == TABLE_TYPE_SEQUENCE && found_count == 0) + { + my_error(ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS, MYF(0)); + error= 1; + } + THD_STAGE_INFO(thd, stage_enabling_keys); thd_progress_next_stage(thd); From 0db5622c4fa34bbc46f01ac4ebd5aaf1519088ed Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Mon, 28 Apr 2025 10:22:58 -0600 Subject: [PATCH 08/89] MDEV-36663: Testcase Fixup There were two issues with the test: 1. A race between a race_condition.inc and status variable, where the status variable Rpl_semi_sync_master_status could be ON before the semi-sync connection finished establishing, resulting in Rpl_semi_sync_master_clients showing 0 (instead of 1). To fix this, we simply instead wait for Rpl_semi_sync_master_clients to be 1 before proceeding. 2. Another race between a race_condition.inc and status variable, where the wait_condition waited on a process_list command of 'BINLOG DUMP' to disappear to infer the binlog dump thread was killed, to where we then verified semi-sync state was correct using status variables. However, the 'BINLOG DUMP' command is overridden with a killed status before the semi-sync tear-down happens, and thereby we could see invalid values. The fix for this is to change the wait_condition to instead wait for the connection with the replication user is gone, because that stays through the binlog dump thread tear-down life-cycle --- mysql-test/suite/rpl/t/rpl_semi_sync_ssl_stop.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_ssl_stop.test b/mysql-test/suite/rpl/t/rpl_semi_sync_ssl_stop.test index cab9caf8ac4..e9d6e241f84 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_ssl_stop.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_ssl_stop.test @@ -49,8 +49,8 @@ SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1; --connection master --echo # Verify Semi-Sync is active ---let $status_var= Rpl_semi_sync_master_status ---let $status_var_value= ON +--let $status_var= Rpl_semi_sync_master_clients +--let $status_var_value= 1 --source include/wait_for_status_var.inc SHOW STATUS LIKE 'Rpl_semi_sync_master_clients'; @@ -67,7 +67,7 @@ STOP SLAVE; --echo # MDEV-36663: Verifying dump thread connection is killed.. # Prior to MDEV-36663 fixes, this would time out and # Rpl_semi_sync_master_clients would remain 1. ---let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump' +--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE USER = 'replssl' --source include/wait_condition.inc --let $n_master_clients= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_master_clients', Value, 1) From 2263c8a1f7db9b308e1458d1ddc4203d006940d7 Mon Sep 17 00:00:00 2001 From: bsrikanth-mariadb Date: Sun, 20 Apr 2025 14:06:17 -0400 Subject: [PATCH 09/89] MDEV-36461: Optimizer trace: remove join_execution node In non-EXPLAIN queries with subqueries, the trace was flooded with empty "join_execution":{} nodes. Now, they are gone. The "Range checked for each record" optimization still prints content into trace on join execution. Now, we wrap it into "range-checked-for-each-record" to delimit the invocations. This new object has fields "select_id" which corresponds to the outer query block, and the "loop" which corresponds to the inner query block iteration number. Additionally, the field "row_estimation" which itself is an object has "table", and "range_analysis" fields that were moved from the old "join_execution"'s steps array. --- mysql-test/main/opt_trace.result | 464 ++++++++---------- mysql-test/main/opt_trace.test | 56 +++ mysql-test/main/opt_trace_index_merge.result | 6 - .../main/opt_trace_index_merge_innodb.result | 6 - mysql-test/main/opt_trace_security.result | 12 - sql/sql_select.cc | 12 +- 6 files changed, 262 insertions(+), 294 deletions(-) diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 0961d250e83..93a5508327b 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -179,12 +179,6 @@ select * from v1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -337,12 +331,6 @@ select * from (select * from t1 where t1.a=1)q { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -582,19 +570,6 @@ select * from v2 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [ - { - "join_execution": { - "select_id": 2, - "steps": [] - } - } - ] - } } ] } 0 0 @@ -726,12 +701,6 @@ explain select * from v2 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -931,19 +900,6 @@ explain select * from v1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [ - { - "join_execution": { - "select_id": 2, - "steps": [] - } - } - ] - } } ] } 0 0 @@ -1230,12 +1186,6 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -1404,12 +1354,6 @@ EXPLAIN SELECT DISTINCT a FROM t1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -1618,12 +1562,6 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -1839,12 +1777,6 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -2037,12 +1969,6 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -2430,12 +2356,6 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -2601,12 +2521,6 @@ select t1.a from t1 left join t2 on t1.a=t2.a { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -2798,12 +2712,6 @@ explain select * from t1 left join t2 on t2.a=t1.a { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -2976,12 +2884,6 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -3328,12 +3230,6 @@ explain extended select * from t1 where a in (select pk from t10) { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -3696,12 +3592,6 @@ explain select * from t1 where pk = 2 and a=5 and b=1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -3826,12 +3716,6 @@ select f1(a) from t1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -3930,12 +3814,6 @@ select f2(a) from t1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -3956,7 +3834,7 @@ a 2 select length(trace) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; length(trace) -2360 +2269 set optimizer_trace_max_mem_size=100; select * from t1; a @@ -3970,7 +3848,7 @@ select * from t1 { "join_preparation": { "select_id": 1, "steps": [ - 2260 0 + 2169 0 set optimizer_trace_max_mem_size=0; select * from t1; a @@ -3978,7 +3856,7 @@ a 2 select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES -select * from t1 2360 0 +select * from t1 2269 0 drop table t1; set optimizer_trace='enabled=off'; set @@optimizer_trace_max_mem_size= @save_optimizer_trace_max_mem_size; @@ -4439,12 +4317,6 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -4642,19 +4514,6 @@ explain select * from (select rand() from t1)q { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [ - { - "join_execution": { - "select_id": 2, - "steps": [] - } - } - ] - } } ] } 0 0 @@ -5155,12 +5014,6 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -7245,12 +7098,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -8813,12 +8660,6 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -9977,12 +9818,6 @@ SELECT 'a\0' LIMIT 0 { "select_id": 1, "steps": [] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } @@ -10321,111 +10156,86 @@ UPDATE t, v SET t.b = t.a, t.a = v.c WHERE v.c < t.a { } }, { - "join_execution": { - "select_id": 1, + "join_preparation": { + "select_id": "fake", "steps": [ { - "join_execution": { - "select_id": 2, - "steps": [] - } + "expanded_query": "select c AS c from dual" + } + ] + } + }, + { + "join_optimization": { + "select_id": "fake", + "steps": [ + { + "table_dependencies": [ + { + "table": "union", + "row_may_be_null": false, + "map_bit": 0, + "depends_on_map_bits": [] + } + ] }, { - "join_execution": { - "select_id": 3, - "steps": [] - } - }, - { - "join_preparation": { - "select_id": "fake", - "steps": [ - { - "expanded_query": "select c AS c from dual" + "rows_estimation": [ + { + "table": "union", + "table_scan": { + "rows": 2, + "cost": 10.1 } - ] - } + } + ] }, { - "join_optimization": { - "select_id": "fake", - "steps": [ - { - "table_dependencies": [ - { + "considered_execution_plans": [ + { + "plan_prefix": [], + "get_costs_for_tables": [ + { + "best_access_path": { "table": "union", - "row_may_be_null": false, - "map_bit": 0, - "depends_on_map_bits": [] - } - ] - }, - { - "rows_estimation": [ - { - "table": "union", - "table_scan": { - "rows": 2, - "cost": 10.1 - } - } - ] - }, - { - "considered_execution_plans": [ - { - "plan_prefix": [], - "get_costs_for_tables": [ + "considered_access_paths": [ { - "best_access_path": { - "table": "union", - "considered_access_paths": [ - { - "access_type": "scan", - "resulting_rows": 2, - "cost": 10.1, - "chosen": true - } - ], - "chosen_access_method": { - "type": "scan", - "records": 2, - "cost": 10.1, - "uses_join_buffering": false - } - } + "access_type": "scan", + "resulting_rows": 2, + "cost": 10.1, + "chosen": true } - ] - }, - { - "plan_prefix": [], - "table": "union", - "rows_for_plan": 2, - "cost_for_plan": 10.5 - } - ] - }, - { - "best_join_order": ["union"] - }, - { - "attaching_conditions_to_tables": { - "attached_conditions_computation": [], - "attached_conditions_summary": [ - { - "table": "union", - "attached": null + ], + "chosen_access_method": { + "type": "scan", + "records": 2, + "cost": 10.1, + "uses_join_buffering": false } - ] + } } - } - ] - } + ] + }, + { + "plan_prefix": [], + "table": "union", + "rows_for_plan": 2, + "cost_for_plan": 10.5 + } + ] }, { - "join_execution": { - "select_id": "fake", - "steps": [] + "best_join_order": ["union"] + }, + { + "attaching_conditions_to_tables": { + "attached_conditions_computation": [], + "attached_conditions_summary": [ + { + "table": "union", + "attached": null + } + ] } } ] @@ -10662,12 +10472,6 @@ select count(*) from seq_1_to_10000000 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -11147,3 +10951,133 @@ left(trace, 100) set optimizer_trace='enabled=off'; # End of 10.6 tests +# +# MDEV-36461: Remove join_execution nodes and add range_check_for_each_record when appropriate +# +create table t1 (a int, b int); +insert into t1 values (1, 999),(999, 1),(987,987); +create table t2 (a int, b int, index(a),index(b)); +insert into t2 select seq, seq from seq_1_to_1000; +create table t3 (a int); +insert into t3 select seq from seq_1_to_2; +set optimizer_trace='enabled=on'; +analyze +select +( +select count(*) +from t1, t2 +where t2.at3.a +) as SUBQ, a +from t3; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t3 ALL NULL NULL NULL NULL 2 2.00 100.00 100.00 +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +2 DEPENDENT SUBQUERY t2 ALL a,b NULL NULL NULL 1000 333.33 100.00 98.60 Range checked for each record (index map: 0x3) +# The trace must contain 6 objects with select_id 2 and +# loop varying from 1..2 for each of the 3 ranges from t1: +set @trace=(select trace from information_schema.optimizer_trace); +set @trace=(select json_extract(@trace, '$**.range-checked-for-each-record')); +set @trace=json_replace(@trace, '$[0].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[1].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[2].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[3].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[4].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[5].rows_estimation[0].range_analysis','REPLACED'); +select json_detailed(@trace) as TRACE; +TRACE +[ + { + "select_id": 2, + "loop": 1, + "rows_estimation": + [ + { + "table": "t2", + "range_analysis": "REPLACED" + } + ] + }, + { + "select_id": 2, + "loop": 1, + "rows_estimation": + [ + { + "table": "t2", + "range_analysis": "REPLACED" + } + ] + }, + { + "select_id": 2, + "loop": 1, + "rows_estimation": + [ + { + "table": "t2", + "range_analysis": "REPLACED" + } + ] + }, + { + "select_id": 2, + "loop": 2, + "rows_estimation": + [ + { + "table": "t2", + "range_analysis": "REPLACED" + } + ] + }, + { + "select_id": 2, + "loop": 2, + "rows_estimation": + [ + { + "table": "t2", + "range_analysis": "REPLACED" + } + ] + }, + { + "select_id": 2, + "loop": 2, + "rows_estimation": + [ + { + "table": "t2", + "range_analysis": "REPLACED" + } + ] + } +] +# The trace must be empty: +select json_detailed(json_extract(trace, '$**.join_execution')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.join_execution')) +NULL +select +( +select count(*) +from t1, t2 +where t2.a+1t3.a +) as SUBQ, a +from t3; +SUBQ a +985 1 +985 2 +# The trace must be empty: +select json_detailed(json_extract(trace, '$**.range-checked-for-each-record')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.range-checked-for-each-record')) +NULL +# The trace must be empty: +select json_detailed(json_extract(trace, '$**.join_execution')) +from information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.join_execution')) +NULL +set optimizer_trace='enabled=off'; +drop table t1,t2,t3; +# End of 10.11 tests diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index 8ef1c4ddf2d..55fe4edf328 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -1195,3 +1195,59 @@ set optimizer_trace='enabled=off'; --echo # End of 10.6 tests +--echo # +--echo # MDEV-36461: Remove join_execution nodes and add range_check_for_each_record when appropriate +--echo # + +create table t1 (a int, b int); +insert into t1 values (1, 999),(999, 1),(987,987); +create table t2 (a int, b int, index(a),index(b)); +insert into t2 select seq, seq from seq_1_to_1000; +create table t3 (a int); +insert into t3 select seq from seq_1_to_2; + +set optimizer_trace='enabled=on'; + +analyze +select +( + select count(*) + from t1, t2 + where t2.at3.a +) as SUBQ, a +from t3; + +--echo # The trace must contain 6 objects with select_id 2 and +--echo # loop varying from 1..2 for each of the 3 ranges from t1: +set @trace=(select trace from information_schema.optimizer_trace); +set @trace=(select json_extract(@trace, '$**.range-checked-for-each-record')); +set @trace=json_replace(@trace, '$[0].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[1].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[2].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[3].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[4].rows_estimation[0].range_analysis','REPLACED'); +set @trace=json_replace(@trace, '$[5].rows_estimation[0].range_analysis','REPLACED'); +select json_detailed(@trace) as TRACE; + +--echo # The trace must be empty: +select json_detailed(json_extract(trace, '$**.join_execution')) + from information_schema.optimizer_trace; + +select +( + select count(*) + from t1, t2 + where t2.a+1t3.a +) as SUBQ, a +from t3; + +--echo # The trace must be empty: +select json_detailed(json_extract(trace, '$**.range-checked-for-each-record')) + from information_schema.optimizer_trace; +--echo # The trace must be empty: +select json_detailed(json_extract(trace, '$**.join_execution')) + from information_schema.optimizer_trace; +set optimizer_trace='enabled=off'; + +drop table t1,t2,t3; +--echo # End of 10.11 tests diff --git a/mysql-test/main/opt_trace_index_merge.result b/mysql-test/main/opt_trace_index_merge.result index d0f171bf60b..8f9c701dfb5 100644 --- a/mysql-test/main/opt_trace_index_merge.result +++ b/mysql-test/main/opt_trace_index_merge.result @@ -255,12 +255,6 @@ explain select * from t1 where a=1 or b=1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 diff --git a/mysql-test/main/opt_trace_index_merge_innodb.result b/mysql-test/main/opt_trace_index_merge_innodb.result index adb9cd5d622..bdd45a509c3 100644 --- a/mysql-test/main/opt_trace_index_merge_innodb.result +++ b/mysql-test/main/opt_trace_index_merge_innodb.result @@ -261,12 +261,6 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 diff --git a/mysql-test/main/opt_trace_security.result b/mysql-test/main/opt_trace_security.result index 48ca5c5e36f..f38e4737423 100644 --- a/mysql-test/main/opt_trace_security.result +++ b/mysql-test/main/opt_trace_security.result @@ -135,12 +135,6 @@ select * from db1.t1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 @@ -264,12 +258,6 @@ select * from db1.v1 { } ] } - }, - { - "join_execution": { - "select_id": 1, - "steps": [] - } } ] } 0 0 diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5a98220fab3..87dabd1e222 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4780,11 +4780,6 @@ void JOIN::exec_inner() UNION temp table. */ - Json_writer_object trace_wrapper(thd); - Json_writer_object trace_exec(thd, "join_execution"); - trace_exec.add_select_number(select_lex->select_number); - Json_writer_array trace_steps(thd, "steps"); - if (!select_lex->outer_select() && // (1) select_lex != select_lex->master_unit()->fake_select_lex) // (2) thd->lex->set_limit_rows_examined(); @@ -23934,6 +23929,13 @@ test_if_quick_select(JOIN_TAB *tab) tab->table->file->ha_index_or_rnd_end(); quick_select_return res; + Json_writer_object wrapper(tab->join->thd); + Json_writer_object range_fer(tab->join->thd, + "range-checked-for-each-record"); + range_fer.add_select_number(tab->join->select_lex->select_number); + range_fer.add("loop", tab->join->explain->time_tracker.get_loops()); + + Json_writer_array rows_est(tab->join->thd, "rows_estimation"); res= tab->select->test_quick_select(tab->join->thd, tab->keys, (table_map) 0, HA_POS_ERROR, 0, FALSE, /*remove where parts*/FALSE, From 1b934a387ccfa91dd0cbbc3e4fd200fabe1b7fc1 Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 21 Apr 2025 19:12:58 +0300 Subject: [PATCH 10/89] MDEV-36536 Add option to not collect statistics for long char/varchars This is needed to make it easy for users to automatically ignore long char and varchars when using ANALYZE TABLE PERSISTENT. These fields can cause problems as they will consume 'CHARACTERS * MAX_CHARACTER_LENGTH * 2 * number_of_rows' space on disk during analyze, which can easily be much bigger than the analyzed table. This commit adds a new user variable, analyze_max_length, default value 4G. Any field that is bigger than this in bytes, will be ignored by ANALYZE TABLE PERSISTENT unless it is specified in FOR COLUMNS(). While doing this patch, I noticed that we do not skip GEOMETRY columns from ANALYZE TABLE, like we do with BLOB. This should be fixed when merging to the 'main' branch. At the same time we should add a resonable default value for analyze_max_length, probably 1024, like we have for max_sort_length. --- mysql-test/main/analyze.result | 51 +++++++++++++++++++ mysql-test/main/analyze.test | 20 ++++++++ mysql-test/main/mysqld--help.result | 4 ++ mysql-test/main/mysqld--help.test | 4 +- .../sys_vars/r/sysvars_server_embedded.result | 10 ++++ .../r/sysvars_server_notembedded.result | 10 ++++ sql/sql_admin.cc | 5 +- sql/sql_class.h | 1 + sql/sys_vars.cc | 14 +++++ 9 files changed, 115 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/analyze.result b/mysql-test/main/analyze.result index 8819f15f27b..cf86bb31e7d 100644 --- a/mysql-test/main/analyze.result +++ b/mysql-test/main/analyze.result @@ -453,5 +453,56 @@ SELECT * FROM t1 WHERE f LIKE '2023%'; f DROP TABLE t1; # +# MDEV-36536 Add option to not collect statistics for long char/varchars +# +select @@session.analyze_max_length; +@@session.analyze_max_length +4294967295 +create table t1 (c0 char(2), c1 char(16), c2 char(64), v1 varchar(16), v2 varchar(1000), b1 blob, i1 int) +character set utf8mb4 COLLATE utf8mb4_bin; +insert into t1 values ("A", "A","A","A","A","A",1), ("B","B","B","B","B","B",1); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b1' +test.t1 analyze status OK +select column_name from mysql.column_stats where table_name = 't1'; +column_name +c0 +c1 +c2 +i1 +v1 +v2 +set @@session.analyze_max_length= 64; +truncate table mysql.column_stats; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'c2' +test.t1 analyze Warning Engine-independent statistics are not collected for column 'v2' +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b1' +test.t1 analyze status Table is already up to date +select column_name from mysql.column_stats where table_name = 't1'; +column_name +c0 +c1 +i1 +v1 +truncate table mysql.column_stats; +ANALYZE TABLE t1 PERSISTENT for COLUMNS (c0,c2,v1,v2,i1) INDEXES ALL; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +select column_name from mysql.column_stats where table_name = 't1'; +column_name +c0 +c2 +i1 +v1 +v2 +set @@session.analyze_max_length= default; +drop table t1; +# # End of 10.6 tests # diff --git a/mysql-test/main/analyze.test b/mysql-test/main/analyze.test index fb07e11b0c6..768b18dcb73 100644 --- a/mysql-test/main/analyze.test +++ b/mysql-test/main/analyze.test @@ -306,6 +306,26 @@ ANALYZE TABLE t1 PERSISTENT FOR ALL; SELECT * FROM t1 WHERE f LIKE '2023%'; DROP TABLE t1; +--echo # +--echo # MDEV-36536 Add option to not collect statistics for long char/varchars +--echo # + +select @@session.analyze_max_length; +create table t1 (c0 char(2), c1 char(16), c2 char(64), v1 varchar(16), v2 varchar(1000), b1 blob, i1 int) +character set utf8mb4 COLLATE utf8mb4_bin; +insert into t1 values ("A", "A","A","A","A","A",1), ("B","B","B","B","B","B",1); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +select column_name from mysql.column_stats where table_name = 't1'; +set @@session.analyze_max_length= 64; +truncate table mysql.column_stats; +ANALYZE TABLE t1 PERSISTENT FOR ALL; +select column_name from mysql.column_stats where table_name = 't1'; +truncate table mysql.column_stats; +ANALYZE TABLE t1 PERSISTENT for COLUMNS (c0,c2,v1,v2,i1) INDEXES ALL; +select column_name from mysql.column_stats where table_name = 't1'; +set @@session.analyze_max_length= default; +drop table t1; + --echo # --echo # End of 10.6 tests --echo # diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 8857aff2fc2..f4aa81e0d66 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -15,6 +15,10 @@ The following specify which files/extra groups are read (specified before remain --alter-algorithm[=name] Specify the alter table algorithm. One of: DEFAULT, COPY, INPLACE, NOCOPY, INSTANT + --analyze-max-length=# + Fields that require more storage than analyze_max_length + and are not listed in ANALYZE ... FOR COLUMNS () will + automatically be skipped by ANALYZE TABLE PERSISTENT --analyze-sample-percentage=# Percentage of rows from the table ANALYZE TABLE will sample to collect table statistics. Set to 0 to let diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test index 971983fd66c..44449cd3ad5 100644 --- a/mysql-test/main/mysqld--help.test +++ b/mysql-test/main/mysqld--help.test @@ -20,14 +20,14 @@ exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --log-bin=foo --lower-case-table-n perl; # Variables which we don't want to display in the result file since - # their paths may vary: + # their paths may vary or they may use a default of 4294967295 : @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity log-slow-queries pid-file slow-query-log-file log-basename datadir slave-load-tmpdir tmpdir socket thread-pool-size large-files-support lower-case-file-system system-time-zone collation-server character-set-server log-tc-size table-cache table-open-cache table-open-cache-instances max-connections - server-uid tls-version version.*/; + server-uid tls-version version.* analyze-max-length/; # Plugins which may or may not be there: @plugins=qw/innodb archive blackhole federated partition s3 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 7ec89b4dbf3..9eb4e5687d1 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -22,6 +22,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST DEFAULT,COPY,INPLACE,NOCOPY,INSTANT READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME ANALYZE_MAX_LENGTH +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Fields which length in bytes are more than analyze_max_length are skipped by ANALYZE TABLE PERSISTENT unless explicitly listed in the FOR COLUMNS () clause +NUMERIC_MIN_VALUE 32 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ANALYZE_SAMPLE_PERCENTAGE VARIABLE_SCOPE SESSION VARIABLE_TYPE DOUBLE diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index c8f0760e38b..7f08e1bbfc2 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -22,6 +22,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST DEFAULT,COPY,INPLACE,NOCOPY,INSTANT READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME ANALYZE_MAX_LENGTH +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Fields that require more storage than analyze_max_length and are not listed in ANALYZE ... FOR COLUMNS () will automatically be skipped by ANALYZE TABLE PERSISTENT +NUMERIC_MIN_VALUE 32 +NUMERIC_MAX_VALUE 4294967295 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ANALYZE_SAMPLE_PERCENTAGE VARIABLE_SCOPE SESSION VARIABLE_TYPE DOUBLE diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index fd2d5178f1d..1d578266c98 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -988,8 +988,9 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, types here. */ enum enum_field_types type= field->type(); - if (type < MYSQL_TYPE_TINY_BLOB || - type > MYSQL_TYPE_BLOB) + if ((type < MYSQL_TYPE_TINY_BLOB || + type > MYSQL_TYPE_BLOB) && + field->field_length <= thd->variables.analyze_max_length) { field->register_field_in_read_map(); bitmap_set_bit(&tab->has_value_set, field->field_index); diff --git a/sql/sql_class.h b/sql/sql_class.h index 69b021cd41d..aac433181a4 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -731,6 +731,7 @@ typedef struct system_variables ha_rows select_limit; ha_rows max_join_size; ha_rows expensive_subquery_limit; + ulong analyze_max_length; ulong auto_increment_increment, auto_increment_offset; #ifdef WITH_WSREP /* diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 0d4a8e4c6fe..4ae14a58feb 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -445,6 +445,20 @@ static Sys_var_double Sys_analyze_sample_percentage( CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100), DEFAULT(100)); +/* + The max length have to be UINT_MAX32 to not remove GEOMETRY fields + from analyze. +*/ + +static Sys_var_ulong Sys_analyze_max_length( + "analyze_max_length", + "Fields that require more storage than analyze_max_length and are not " + "listed in ANALYZE ... FOR COLUMNS () will automatically be skipped by " + "ANALYZE TABLE PERSISTENT", + SESSION_VAR(analyze_max_length), + CMD_LINE(REQUIRED_ARG), VALID_RANGE(32, UINT_MAX32), + DEFAULT(UINT_MAX32), BLOCK_SIZE(1)); + static Sys_var_ulong Sys_auto_increment_increment( "auto_increment_increment", "Auto-increment columns are incremented by this", From d9cd4e1f752a730b58ed9ccb2a05647163a8ae05 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 22 Apr 2025 16:54:25 +0300 Subject: [PATCH 11/89] MDEV-22250 InnoDB: Failing assertion: opt_no_lock during mariabackup --backup Ensure that backup_reset_alter_copy_lock() is called in case of rollback or error in mysql_inplace_alter_table() or copy_data_between_tables(). Other things: - Improved error from mariabackup when unexpected DDL operation is encountered. - Added assert if backup_ddl_log() is called in the wrong context. --- extra/mariabackup/xtrabackup.cc | 15 ++++++++++++--- sql/backup.cc | 14 +++++++++++++- sql/sql_table.cc | 28 ++++++++++++++++++---------- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 33d172de82e..d44c7a6a4d1 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -974,6 +974,7 @@ static void backup_file_op_fail(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len) { + const char *error= ""; bool fail = false; switch(type) { case FILE_CREATE: @@ -981,6 +982,7 @@ static void backup_file_op_fail(uint32_t space_id, int type, space_id, int(len), name); fail = !check_if_skip_table( filename_to_spacename(name, len).c_str()); + error= "create"; break; case FILE_MODIFY: break; @@ -991,12 +993,14 @@ static void backup_file_op_fail(uint32_t space_id, int type, filename_to_spacename(name, len).c_str()) || !check_if_skip_table( filename_to_spacename(new_name, new_len).c_str()); + error= "rename"; break; case FILE_DELETE: fail = !check_if_skip_table( filename_to_spacename(name, len).c_str()); msg("DDL tracking : delete %" PRIu32 " \"%.*s\"", space_id, int(len), name); + error= "delete"; break; default: ut_ad(0); @@ -1004,9 +1008,14 @@ static void backup_file_op_fail(uint32_t space_id, int type, } if (fail) { - ut_a(opt_no_lock); - die("DDL operation detected in the late phase of backup." - "Backup is inconsistent. Remove --no-lock option to fix."); + if (opt_no_lock) + die("DDL operation detected in the late phase of backup while " + "executing %s on %s. " + "Backup is inconsistent. Remove --no-lock option to fix.", + error, name); + die("Unexpected DDL operation detected in the late phase of backup " + "while executing %s on %s. Backup is inconsistent.", + error, name); } } diff --git a/sql/backup.cc b/sql/backup.cc index 1496ee953a6..d6d7c25f4c5 100644 --- a/sql/backup.cc +++ b/sql/backup.cc @@ -50,6 +50,7 @@ TYPELIB backup_stage_names= static MDL_ticket *backup_flush_ticket; static File volatile backup_log= -1; static int backup_log_error= 0; +static backup_stages backup_stage; static bool backup_start(THD *thd); static bool backup_flush(THD *thd); @@ -67,6 +68,7 @@ void backup_init() backup_flush_ticket= 0; backup_log= -1; backup_log_error= 0; + backup_stage= BACKUP_FINISHED; } bool run_backup_stage(THD *thd, backup_stages stage) @@ -139,6 +141,7 @@ bool run_backup_stage(THD *thd, backup_stages stage) my_error(ER_BACKUP_STAGE_FAILED, MYF(0), stage_names[(uint) stage]); DBUG_RETURN(1); } + backup_stage= next_stage; next_stage= (backup_stages) ((uint) next_stage + 1); } while ((uint) next_stage <= (uint) stage); @@ -173,6 +176,7 @@ static bool backup_start(THD *thd) /* this will be reset if this stage fails */ thd->current_backup_stage= BACKUP_START; + backup_stage= BACKUP_START; /* Wait for old backup to finish and block ddl's so that we can start the @@ -422,6 +426,7 @@ bool backup_end(THD *thd) // This is needed as we may call backup_end without backup_block_commit stop_ddl_logging(); backup_flush_ticket= 0; + backup_stage= BACKUP_FINISHED; thd->current_backup_stage= BACKUP_FINISHED; thd->mdl_context.release_lock(old_ticket); #ifdef WITH_WSREP @@ -476,7 +481,7 @@ bool backup_reset_alter_copy_lock(THD *thd) bool res= 0; MDL_ticket *ticket= thd->mdl_backup_ticket; - /* Ticket maybe NULL in case of LOCK TABLES or for temporary tables*/ + /* Ticket maybe NULL in case of LOCK TABLES or for temporary tables */ if (ticket) res= thd->mdl_context.upgrade_shared_lock(ticket, MDL_BACKUP_DDL, thd->variables.lock_wait_timeout); @@ -601,6 +606,13 @@ static char *add_bool_to_buffer(char *ptr, bool value) { void backup_log_ddl(const backup_log_info *info) { + /* + We should not get any backup_log_ddl request after BACKUP_WAIT_FOR_FLUSH + has been executed. + */ + DBUG_ASSERT(backup_stage <= BACKUP_WAIT_FOR_FLUSH || + backup_stage >= BACKUP_END); + if (backup_log >= 0 && backup_log_error == 0) { mysql_mutex_lock(&LOCK_backup_log); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bf032d3ca03..3a963403d65 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7680,7 +7680,7 @@ static bool mysql_inplace_alter_table(THD *thd, if (table->file->ha_prepare_inplace_alter_table(altered_table, ha_alter_info)) - goto rollback; + goto rollback_no_restore_lock; debug_crash_here("ddl_log_alter_after_prepare_inplace"); @@ -7732,16 +7732,16 @@ static bool mysql_inplace_alter_table(THD *thd, res= table->file->ha_inplace_alter_table(altered_table, ha_alter_info); thd->abort_on_warning= false; if (res) - goto rollback; + goto rollback_no_restore_lock; DEBUG_SYNC(thd, "alter_table_inplace_before_lock_upgrade"); // Upgrade to EXCLUSIVE before commit. if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME)) - goto rollback; + goto rollback_no_restore_lock; /* Set MDL_BACKUP_DDL */ if (backup_reset_alter_copy_lock(thd)) - goto rollback; + goto rollback_no_restore_lock; /* Crashing here should cause the original table to be used */ debug_crash_here("ddl_log_alter_after_copy"); @@ -7770,7 +7770,7 @@ static bool mysql_inplace_alter_table(THD *thd, if (!(table->file->partition_ht()->flags & HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT) && notify_tabledef_changed(table_list)) - goto rollback; + goto rollback_restore_lock; { TR_table trt(thd, true); @@ -7783,17 +7783,17 @@ static bool mysql_inplace_alter_table(THD *thd, if (!TR_table::use_transaction_registry) { my_error(ER_VERS_TRT_IS_DISABLED, MYF(0)); - goto rollback; + goto rollback_restore_lock; } if (trt.update(trx_start_id, trx_end_id)) - goto rollback; + goto rollback_restore_lock; } } if (table->file->ha_commit_inplace_alter_table(altered_table, ha_alter_info, true)) - goto rollback; + goto rollback_restore_lock; DEBUG_SYNC(thd, "alter_table_inplace_after_commit"); } @@ -7890,7 +7890,11 @@ static bool mysql_inplace_alter_table(THD *thd, DBUG_RETURN(commit_succeded_with_error); - rollback: +rollback_restore_lock: + /* Wait for backup if it is running */ + backup_reset_alter_copy_lock(thd); + +rollback_no_restore_lock: table->file->ha_commit_inplace_alter_table(altered_table, ha_alter_info, false); @@ -11825,7 +11829,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, if (unlikely(mysql_trans_commit_alter_copy_data(thd))) error= 1; - err: +end: if (bulk_insert_started) (void) to->file->ha_end_bulk_insert(); @@ -11856,6 +11860,10 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, error= 1; thd_progress_end(thd); DBUG_RETURN(error > 0 ? -1 : 0); + +err: + backup_reset_alter_copy_lock(thd); + goto end; } From 739578915f3ead1c86d8b4d03e7d1dd81a1ebfa0 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 28 Apr 2025 17:47:45 +0200 Subject: [PATCH 12/89] Make the test more stable. --- .../mysql-test/connect/r/part_table.result | 18 +++++++++--------- .../mysql-test/connect/t/part_table.test | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/storage/connect/mysql-test/connect/r/part_table.result b/storage/connect/mysql-test/connect/r/part_table.result index 0cd4f0115a4..3152bdcecda 100644 --- a/storage/connect/mysql-test/connect/r/part_table.result +++ b/storage/connect/mysql-test/connect/r/part_table.result @@ -164,16 +164,16 @@ Warnings: Note 1105 xt1: 1 affected rows SELECT * FROM t1; id msg -4 four -7 sept 1 one -8 eight -40 forty 10 ten 11 eleven 35 thirty five -72 big +4 four +40 forty 60 big +7 sept +72 big +8 eight 81 big DELETE FROM t1 WHERE id in (60,72); Warnings: @@ -181,14 +181,14 @@ Note 1105 xt3: 2 affected rows Note 1105 xt3: 0 affected rows SELECT * FROM t1; id msg -4 four -7 sept 1 one -8 eight -40 forty 10 ten 11 eleven 35 thirty five +4 four +40 forty +7 sept +8 eight 81 big DROP TABLE t1; CREATE TABLE t1 ( diff --git a/storage/connect/mysql-test/connect/t/part_table.test b/storage/connect/mysql-test/connect/t/part_table.test index 0fb2a11f0f9..0be8563cd52 100644 --- a/storage/connect/mysql-test/connect/t/part_table.test +++ b/storage/connect/mysql-test/connect/t/part_table.test @@ -75,11 +75,14 @@ SELECT * FROM t1 WHERE id = 7; SELECT * FROM t1 WHERE id = 35; UPDATE t1 SET msg = 'number' WHERE id in (60,72); UPDATE t1 SET msg = 'soixante' WHERE id = 60; +--sorted_result SELECT * FROM t1 WHERE id > 50; UPDATE t1 SET msg = 'big' WHERE id > 50; UPDATE t1 SET msg = 'sept' WHERE id = 7; +--sorted_result SELECT * FROM t1; DELETE FROM t1 WHERE id in (60,72); +--sorted_result SELECT * FROM t1; DROP TABLE t1; From aae8c5a5aa613c9d3f6f96c8cf8e657611e8bb2a Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Wed, 5 Mar 2025 17:12:25 +0200 Subject: [PATCH 13/89] Update 11.8 man pages --- man/comp_err.1 | 4 ++-- man/galera_new_cluster.1 | 2 +- man/galera_recovery.1 | 2 +- man/innochecksum.1 | 4 ++-- man/mariadb-access.1 | 4 ++-- man/mariadb-admin.1 | 4 ++-- man/mariadb-backup.1 | 2 +- man/mariadb-binlog.1 | 4 ++-- man/mariadb-check.1 | 4 ++-- man/mariadb-client-test.1 | 4 ++-- man/mariadb-conv.1 | 4 ++-- man/mariadb-convert-table-format.1 | 4 ++-- man/mariadb-dump.1 | 4 ++-- man/mariadb-dumpslow.1 | 4 ++-- man/mariadb-find-rows.1 | 4 ++-- man/mariadb-fix-extensions.1 | 4 ++-- man/mariadb-hotcopy.1 | 4 ++-- man/mariadb-install-db.1 | 4 ++-- man/mariadb-plugin.1 | 4 ++-- man/mariadb-secure-installation.1 | 4 ++-- man/mariadb-service-convert.1 | 2 +- man/mariadb-setpermission.1 | 4 ++-- man/mariadb-show.1 | 4 ++-- man/mariadb-slap.1 | 4 ++-- man/mariadb-test.1 | 4 ++-- man/mariadb-tzinfo-to-sql.1 | 4 ++-- man/mariadb-upgrade.1 | 4 ++-- man/mariadb-waitpid.1 | 4 ++-- man/mariadb.1 | 4 ++-- man/mariadb_config.1 | 4 ++-- man/mariadbd-multi.1 | 4 ++-- man/mariadbd-safe-helper.1 | 2 +- man/mariadbd-safe.1 | 4 ++-- man/mariadbd.8 | 4 ++-- man/mbstream.1 | 2 +- man/msql2mysql.1 | 4 ++-- man/my_print_defaults.1 | 4 ++-- man/my_safe_process.1 | 2 +- man/myisam_ftdump.1 | 4 ++-- man/myisamchk.1 | 4 ++-- man/myisamlog.1 | 4 ++-- man/myisampack.1 | 4 ++-- man/mysql-stress-test.pl.1 | 4 ++-- man/mysql-test-run.pl.1 | 4 ++-- man/mysql.server.1 | 4 ++-- man/mytop.1 | 2 +- man/perror.1 | 4 ++-- man/replace.1 | 4 ++-- man/resolve_stack_dump.1 | 4 ++-- man/resolveip.1 | 4 ++-- man/wsrep_sst_backup.1 | 2 +- man/wsrep_sst_common.1 | 2 +- man/wsrep_sst_mariabackup.1 | 2 +- man/wsrep_sst_mysqldump.1 | 2 +- man/wsrep_sst_rsync.1 | 2 +- man/wsrep_sst_rsync_wan.1 | 2 +- 56 files changed, 98 insertions(+), 98 deletions(-) diff --git a/man/comp_err.1 b/man/comp_err.1 index 5bda07b7ea1..ba8b2635bb4 100644 --- a/man/comp_err.1 +++ b/man/comp_err.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBCOMP_ERR\fR" "1" "4 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBCOMP_ERR\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -247,7 +247,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1 index 28708728079..46a28a82895 100644 --- a/man/galera_new_cluster.1 +++ b/man/galera_new_cluster.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBGALERA_NEW_CLUSTER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBGALERA_NEW_CLUSTER\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_recovery.1 b/man/galera_recovery.1 index 1d93c865b0d..7464ff79ccc 100644 --- a/man/galera_recovery.1 +++ b/man/galera_recovery.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBGALERA_RECOVERY\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBGALERA_RECOVERY\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/innochecksum.1 b/man/innochecksum.1 index 1046d4a0d74..940e059a29d 100644 --- a/man/innochecksum.1 +++ b/man/innochecksum.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBINNOCHECKSUM\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBINNOCHECKSUM\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -303,7 +303,7 @@ Displays version information and exits\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-access.1 b/man/mariadb-access.1 index eb01301a573..d0aa39aae10 100644 --- a/man/mariadb-access.1 +++ b/man/mariadb-access.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-ACCESS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-ACCESS\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -415,7 +415,7 @@ error will occur when you run .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-admin.1 b/man/mariadb-admin.1 index db970e1a0cd..2f2993aaf93 100644 --- a/man/mariadb-admin.1 +++ b/man/mariadb-admin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-ADMIN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-ADMIN\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -1522,7 +1522,7 @@ The maximum number of seconds to wait for server shutdown\&. The default value i .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-backup.1 b/man/mariadb-backup.1 index fc7c4d6552a..531dc24b020 100644 --- a/man/mariadb-backup.1 +++ b/man/mariadb-backup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIABACKUP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIABACKUP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-binlog.1 b/man/mariadb-binlog.1 index ba03372f046..4a2aaa08f9e 100644 --- a/man/mariadb-binlog.1 +++ b/man/mariadb-binlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-BINLOG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-BINLOG\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -2128,7 +2128,7 @@ option can be used to prevent this header from being written\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-check.1 b/man/mariadb-check.1 index 3a401bd4071..a5a510d4a05 100644 --- a/man/mariadb-check.1 +++ b/man/mariadb-check.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CHECK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-CHECK\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -1143,7 +1143,7 @@ when these statements should not be sent to replication slaves or run when using .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-client-test.1 b/man/mariadb-client-test.1 index dba0aa6f225..0c82aac4902 100644 --- a/man/mariadb-client-test.1 +++ b/man/mariadb-client-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CLIENT-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-CLIENT-TEST\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -318,7 +318,7 @@ mariadb\-test/var\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-conv.1 b/man/mariadb-conv.1 index 9a04fe53a49..a9fa6177207 100644 --- a/man/mariadb-conv.1 +++ b/man/mariadb-conv.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CONV\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-CONV\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -90,7 +90,7 @@ Treat the specified characters as delimiters\&. .SH "COPYRIGHT" .br .PP -Copyright 2024 MariaDB Foundation +Copyright 2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-convert-table-format.1 b/man/mariadb-convert-table-format.1 index 90daee617f8..63951400ea7 100644 --- a/man/mariadb-convert-table-format.1 +++ b/man/mariadb-convert-table-format.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CONVERT-TABLE-FORMAT\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-CONVERT-TABLE-FORMAT\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -208,7 +208,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-dump.1 b/man/mariadb-dump.1 index 08bfd982d7d..0c8868a9e13 100644 --- a/man/mariadb-dump.1 +++ b/man/mariadb-dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-DUMP\fR" "1" "8 October 2024" "MariaDB 11.6" "MariaDB Database System" +.TH "\fBMARIADB-DUMP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -2906,7 +2906,7 @@ If you encounter problems backing up views, please read the section that covers .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-dumpslow.1 b/man/mariadb-dumpslow.1 index d7d575e06e5..c1b180c025c 100644 --- a/man/mariadb-dumpslow.1 +++ b/man/mariadb-dumpslow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-DUMPSLOW\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-DUMPSLOW\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -318,7 +318,7 @@ Count: 3 Time=2\&.13s (6s) Lock=0\&.00s (0s) Rows=0\&.0 (0), root[root]@local .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-find-rows.1 b/man/mariadb-find-rows.1 index d93972f016b..0b07401a84a 100644 --- a/man/mariadb-find-rows.1 +++ b/man/mariadb-find-rows.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-FIND-ROWS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-FIND-ROWS\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -144,7 +144,7 @@ Start output from this row\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-fix-extensions.1 b/man/mariadb-fix-extensions.1 index 14e6975ac88..4eaee13777b 100644 --- a/man/mariadb-fix-extensions.1 +++ b/man/mariadb-fix-extensions.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-FIX-EXTENSIONS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-FIX-EXTENSIONS\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -56,7 +56,7 @@ shell> \fBmariadb-fix-extensions \fR\fB\fIdata_dir\fR\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-hotcopy.1 b/man/mariadb-hotcopy.1 index 94e4f9c1005..24ebb543344 100644 --- a/man/mariadb-hotcopy.1 +++ b/man/mariadb-hotcopy.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-HOTCOPY\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-HOTCOPY\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -520,7 +520,7 @@ shell> \fBperldoc mariadb-hotcopy\fR .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-install-db.1 b/man/mariadb-install-db.1 index 53ff26bdeae..8f93d080a9c 100644 --- a/man/mariadb-install-db.1 +++ b/man/mariadb-install-db.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-INSTALL-DB\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-INSTALL-DB\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -384,7 +384,7 @@ For internal use\&. This option is used for creating Windows distributions\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-plugin.1 b/man/mariadb-plugin.1 index a383d99da1e..d34bb17c86c 100644 --- a/man/mariadb-plugin.1 +++ b/man/mariadb-plugin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-PLUGIN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-PLUGIN\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -361,7 +361,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2024 MariaDB Foundation +Copyright \(co 1997, 2013, Oracle and/or its affiliates. All rights reserved., 2013-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-secure-installation.1 b/man/mariadb-secure-installation.1 index aff28db32f9..6248838aedb 100644 --- a/man/mariadb-secure-installation.1 +++ b/man/mariadb-secure-installation.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SECURE-INSTALLATION\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-SECURE-INSTALLATION\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -153,7 +153,7 @@ Other unrecognized options will be passed on to the server\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1 index 3ee9d54f2be..11597340a81 100644 --- a/man/mariadb-service-convert.1 +++ b/man/mariadb-service-convert.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SERVICE-CONVERT\fR" "1" "3 September 2024" "MariaDB 10.11" "MariaDB Database System" +.TH "\fBMARIADB-SERVICE-CONVERT\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-setpermission.1 b/man/mariadb-setpermission.1 index f5c7f78156b..1cfae88408f 100644 --- a/man/mariadb-setpermission.1 +++ b/man/mariadb-setpermission.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SETPERMISSION\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-SETPERMISSION\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -154,7 +154,7 @@ The MariaDB user name to use when connecting to the server\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-show.1 b/man/mariadb-show.1 index cefd05ff4be..ce0b6939a60 100644 --- a/man/mariadb-show.1 +++ b/man/mariadb-show.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SHOW\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-SHOW\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -705,7 +705,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-slap.1 b/man/mariadb-slap.1 index edcc2b3a6a9..a9ff7e89812 100644 --- a/man/mariadb-slap.1 +++ b/man/mariadb-slap.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-SLAP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-SLAP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -1151,7 +1151,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-test.1 b/man/mariadb-test.1 index 5baef13d4e0..a94c9c013b2 100644 --- a/man/mariadb-test.1 +++ b/man/mariadb-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-TEST\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -1069,7 +1069,7 @@ statement is wrapped inside a view\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-tzinfo-to-sql.1 b/man/mariadb-tzinfo-to-sql.1 index f1b751229d7..8037b16d8e0 100644 --- a/man/mariadb-tzinfo-to-sql.1 +++ b/man/mariadb-tzinfo-to-sql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-TZINFO-TO-SQL\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-TZINFO-TO-SQL\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -109,7 +109,7 @@ After running .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-upgrade.1 b/man/mariadb-upgrade.1 index 32d506d8dfe..3c1c0d4ab50 100644 --- a/man/mariadb-upgrade.1 +++ b/man/mariadb-upgrade.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-UPGRADE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-UPGRADE\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -714,7 +714,7 @@ runs\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb-waitpid.1 b/man/mariadb-waitpid.1 index 3c4448d3faa..f1f70893280 100644 --- a/man/mariadb-waitpid.1 +++ b/man/mariadb-waitpid.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-WAITPID\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-WAITPID\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -113,7 +113,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb.1 b/man/mariadb.1 index 2e65f9c50bb..381c2267999 100644 --- a/man/mariadb.1 +++ b/man/mariadb.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -3115,7 +3115,7 @@ option\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadb_config.1 b/man/mariadb_config.1 index 6e47a2240d5..6a1c727d6c7 100644 --- a/man/mariadb_config.1 +++ b/man/mariadb_config.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB-CONFIG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB-CONFIG\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -233,7 +233,7 @@ this way, be sure to invoke it within backtick (\(lq`\(rq) characters\&. That te .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd-multi.1 b/man/mariadbd-multi.1 index 06f58c69e08..398045b061a 100644 --- a/man/mariadbd-multi.1 +++ b/man/mariadbd-multi.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-MULTI\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADBD-MULTI\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -668,7 +668,7 @@ user = jani .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd-safe-helper.1 b/man/mariadbd-safe-helper.1 index 58b1707f504..cca851e3eb0 100644 --- a/man/mariadbd-safe-helper.1 +++ b/man/mariadbd-safe-helper.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-SAFE-HELPER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE-HELPER\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadbd-safe.1 b/man/mariadbd-safe.1 index aabe5a24ac9..dea792495d1 100644 --- a/man/mariadbd-safe.1 +++ b/man/mariadbd-safe.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD-SAFE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -857,7 +857,7 @@ file in the data directory\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mariadbd.8 b/man/mariadbd.8 index e84a271127d..3dc9627aef1 100644 --- a/man/mariadbd.8 +++ b/man/mariadbd.8 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADBD\fR" "8" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADBD\fR" "8" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -45,7 +45,7 @@ the MariaDB Knowledge Base\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mbstream.1 b/man/mbstream.1 index da2d3fc2c39..4053f0eca7e 100644 --- a/man/mbstream.1 +++ b/man/mbstream.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMBSTREAM\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMBSTREAM\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/msql2mysql.1 b/man/msql2mysql.1 index f9355a9d232..0a7a0545c70 100644 --- a/man/msql2mysql.1 +++ b/man/msql2mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMSQL2MYSQL\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMSQL2MYSQL\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -53,7 +53,7 @@ utility to make the function name substitutions\&. See .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1 index 8816e46b06e..6e464806920 100644 --- a/man/my_print_defaults.1 +++ b/man/my_print_defaults.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMY_PRINT_DEFAULTS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMY_PRINT_DEFAULTS\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -219,7 +219,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/my_safe_process.1 b/man/my_safe_process.1 index 955275bfb01..7ac2dbc79cf 100644 --- a/man/my_safe_process.1 +++ b/man/my_safe_process.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMY_SAFE_PROCESS\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMY_SAFE_PROCESS\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1 index 8df198f0354..fcca2cb06a1 100644 --- a/man/myisam_ftdump.1 +++ b/man/myisam_ftdump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAM_FTDUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMYISAM_FTDUMP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -235,7 +235,7 @@ Verbose mode\&. Print more output about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisamchk.1 b/man/myisamchk.1 index fd68cf378b5..0c46fb83cef 100644 --- a/man/myisamchk.1 +++ b/man/myisamchk.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMCHK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMYISAMCHK\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -2505,7 +2505,7 @@ instead of .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisamlog.1 b/man/myisamlog.1 index 4f99586ff90..cd1caf397f9 100644 --- a/man/myisamlog.1 +++ b/man/myisamlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMLOG\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMYISAMLOG\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -218,7 +218,7 @@ Display version information\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/myisampack.1 b/man/myisampack.1 index db999d33a13..11040b9b157 100644 --- a/man/myisampack.1 +++ b/man/myisampack.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYISAMPACK\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMYISAMPACK\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -823,7 +823,7 @@ option to .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1 index b6929463b43..a7b6e089058 100644 --- a/man/mysql-stress-test.pl.1 +++ b/man/mysql-stress-test.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB\-STRESS\-TEST\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB\-STRESS\-TEST\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -482,7 +482,7 @@ Verbose mode\&. Print more information about what the program does\&. .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index a1ac726ae68..17f1c432063 100644 --- a/man/mysql-test-run.pl.1 +++ b/man/mysql-test-run.pl.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMARIADB\-TEST\-RUN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMARIADB\-TEST\-RUN\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -2304,7 +2304,7 @@ Search the server log for errors or warning after each test and report any suspi .SH "COPYRIGHT" .br .PP -Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2024 MariaDB Foundation +Copyright \(co 2007, 2010, Oracle and/or its affiliates, 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mysql.server.1 b/man/mysql.server.1 index 5a367298724..6940f2e3aea 100644 --- a/man/mysql.server.1 +++ b/man/mysql.server.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBMYSQL\&.SERVER\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBMYSQL\&.SERVER\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -166,7 +166,7 @@ The login user name to use for running .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/mytop.1 b/man/mytop.1 index d1ffa9d085d..d646df1d459 100644 --- a/man/mytop.1 +++ b/man/mytop.1 @@ -1,4 +1,4 @@ -.TH MYTOP "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH MYTOP "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .SH NAME mytop \- display MariaDB server performance info like 'top' .SH "SEE ALSO" diff --git a/man/perror.1 b/man/perror.1 index 581387c1839..772d7ef51f0 100644 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBPERROR\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBPERROR\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -143,7 +143,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/replace.1 b/man/replace.1 index adc79e9f451..03568f5e87a 100644 --- a/man/replace.1 +++ b/man/replace.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBREPLACE\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBREPLACE\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -153,7 +153,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1 index e3e473bec0e..2ee42345e1a 100644 --- a/man/resolve_stack_dump.1 +++ b/man/resolve_stack_dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBRESOLVE_STACK_DUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBRESOLVE_STACK_DUMP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -110,7 +110,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/resolveip.1 b/man/resolveip.1 index c21a8d034ba..f4151af5061 100644 --- a/man/resolveip.1 +++ b/man/resolveip.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBRESOLVEIP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBRESOLVEIP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -92,7 +92,7 @@ Display version information and exit\&. .SH "COPYRIGHT" .br .PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2024 MariaDB Foundation +Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2025 MariaDB Foundation .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP diff --git a/man/wsrep_sst_backup.1 b/man/wsrep_sst_backup.1 index fe69d6938fd..2d34f8ce617 100644 --- a/man/wsrep_sst_backup.1 +++ b/man/wsrep_sst_backup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBWSREP_SST_BACKUP\FR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\FBWSREP_SST_BACKUP\FR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1 index cf9e9a03dcd..e9d27455991 100644 --- a/man/wsrep_sst_common.1 +++ b/man/wsrep_sst_common.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_COMMON\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBWSREP_SST_COMMON\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mariabackup.1 b/man/wsrep_sst_mariabackup.1 index 1bc94893677..6df4342372d 100644 --- a/man/wsrep_sst_mariabackup.1 +++ b/man/wsrep_sst_mariabackup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_MARIABACKUP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBWSREP_SST_MARIABACKUP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1 index 6646df59e93..cab1ae90bc3 100644 --- a/man/wsrep_sst_mysqldump.1 +++ b/man/wsrep_sst_mysqldump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_MYSQLDUMP\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBWSREP_SST_MYSQLDUMP\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1 index fab949e1ee4..93ae6086a7e 100644 --- a/man/wsrep_sst_rsync.1 +++ b/man/wsrep_sst_rsync.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_RSYNC\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync_wan.1 b/man/wsrep_sst_rsync_wan.1 index 7205dbc2e0c..9894bda4231 100644 --- a/man/wsrep_sst_rsync_wan.1 +++ b/man/wsrep_sst_rsync_wan.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\fBWSREP_SST_RSYNC_WAN\fR" "1" "3 September 2024" "MariaDB 11.4" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC_WAN\fR" "1" "5 March 2025" "MariaDB 11.8" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- From 865b05bf4acf10e0d4b3359019ed7b2efe0be81d Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Mon, 24 Feb 2025 20:53:39 -0700 Subject: [PATCH 14/89] MDEV-35837: Update CODING_STANDARDS to C++17 [skip ci] also annotate with MariaDB version --- CODING_STANDARDS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODING_STANDARDS.md b/CODING_STANDARDS.md index 64496e1c174..2eecadba755 100644 --- a/CODING_STANDARDS.md +++ b/CODING_STANDARDS.md @@ -187,7 +187,7 @@ C file names use the `.c` extension, C++ files use the `.cc` extension and heade ### Language standards -For pure-C files we use C99 and for C++ we use C++11. +For pure-C files we use C99 (starting with 10.4.25) and for C++ we use C++11 (starting with 11.8.1). The code need to be able to compile on multiple platforms using different compilers (for example: Windows / Linux, x86_64 / ARM). ### Line lengths From 83e0438f628450dc88af59425da3ece5dfa746a0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 29 Apr 2025 11:34:35 +0200 Subject: [PATCH 15/89] MDEV-36536 post-review changes that were apparently partially lost in a rebase --- mysql-test/main/mysqld--help.result | 6 +++--- mysql-test/suite/sys_vars/r/sysvars_server_embedded.result | 4 ++-- .../suite/sys_vars/r/sysvars_server_notembedded.result | 4 ++-- sql/sql_class.h | 2 +- sql/sys_vars.cc | 7 +++---- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index f4aa81e0d66..abe7c10952b 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -16,9 +16,9 @@ The following specify which files/extra groups are read (specified before remain Specify the alter table algorithm. One of: DEFAULT, COPY, INPLACE, NOCOPY, INSTANT --analyze-max-length=# - Fields that require more storage than analyze_max_length - and are not listed in ANALYZE ... FOR COLUMNS () will - automatically be skipped by ANALYZE TABLE PERSISTENT + Fields which length in bytes more than this are skipped + by ANALYZE TABLE PERSISTENT unless explicitly listed in + the FOR COLUMNS () clause --analyze-sample-percentage=# Percentage of rows from the table ANALYZE TABLE will sample to collect table statistics. Set to 0 to let diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 9eb4e5687d1..977afb94f0d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -24,8 +24,8 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ANALYZE_MAX_LENGTH VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Fields which length in bytes are more than analyze_max_length are skipped by ANALYZE TABLE PERSISTENT unless explicitly listed in the FOR COLUMNS () clause +VARIABLE_TYPE INT UNSIGNED +VARIABLE_COMMENT Fields which length in bytes more than this are skipped by ANALYZE TABLE PERSISTENT unless explicitly listed in the FOR COLUMNS () clause NUMERIC_MIN_VALUE 32 NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 7f08e1bbfc2..c5781705847 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -24,8 +24,8 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ANALYZE_MAX_LENGTH VARIABLE_SCOPE SESSION -VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Fields that require more storage than analyze_max_length and are not listed in ANALYZE ... FOR COLUMNS () will automatically be skipped by ANALYZE TABLE PERSISTENT +VARIABLE_TYPE INT UNSIGNED +VARIABLE_COMMENT Fields which length in bytes more than this are skipped by ANALYZE TABLE PERSISTENT unless explicitly listed in the FOR COLUMNS () clause NUMERIC_MIN_VALUE 32 NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 1 diff --git a/sql/sql_class.h b/sql/sql_class.h index aac433181a4..f544c2e3fd1 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -731,7 +731,7 @@ typedef struct system_variables ha_rows select_limit; ha_rows max_join_size; ha_rows expensive_subquery_limit; - ulong analyze_max_length; + uint analyze_max_length; ulong auto_increment_increment, auto_increment_offset; #ifdef WITH_WSREP /* diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 4ae14a58feb..9477a26beec 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -450,11 +450,10 @@ static Sys_var_double Sys_analyze_sample_percentage( from analyze. */ -static Sys_var_ulong Sys_analyze_max_length( +static Sys_var_uint Sys_analyze_max_length( "analyze_max_length", - "Fields that require more storage than analyze_max_length and are not " - "listed in ANALYZE ... FOR COLUMNS () will automatically be skipped by " - "ANALYZE TABLE PERSISTENT", + "Fields which length in bytes more than this are skipped by ANALYZE " + "TABLE PERSISTENT unless explicitly listed in the FOR COLUMNS () clause", SESSION_VAR(analyze_max_length), CMD_LINE(REQUIRED_ARG), VALID_RANGE(32, UINT_MAX32), DEFAULT(UINT_MAX32), BLOCK_SIZE(1)); From 55ddfe1c95cba66fb7b0b46007e97eba9b0d93eb Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Mon, 28 Apr 2025 22:45:10 +0400 Subject: [PATCH 16/89] MDEV-36684 - main.mdl_sync fails under valgrind (test for Bug#42643) Valgrind is single threaded and only changes threads as part of system calls or waits. Some busy loops were identified and fixed where the server assumes that some other thread will change the state, which will not happen with valgrind. Based on patch by Monty. Original patch introduced VALGRIND_YIELD, which emits pthread_yield() only in valgrind builds. However it was agreed that it is a good idea to emit yield() unconditionally, such that other affected schedulers (like SCHED_FIFO) benefit from this change. Also avoid pthread_yield() in favour of standard std::this_thread::yield(). --- sql/sql_base.cc | 2 ++ sql/sql_class.h | 1 + sql/table_cache.cc | 1 + storage/innobase/trx/trx0purge.cc | 1 + 4 files changed, 5 insertions(+) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ea25ffd6b4d..713a0b455e9 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4460,6 +4460,7 @@ restart: goto error; error= FALSE; + std::this_thread::yield(); goto restart; } goto error; @@ -4522,6 +4523,7 @@ restart: goto error; error= FALSE; + std::this_thread::yield(); goto restart; } /* diff --git a/sql/sql_class.h b/sql/sql_class.h index f544c2e3fd1..7da9418c5ea 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -20,6 +20,7 @@ /* Classes in mysql */ #include +#include #include "dur_prop.h" #include #include "sql_const.h" diff --git a/sql/table_cache.cc b/sql/table_cache.cc index b804a3e0627..48cd63401e6 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -901,6 +901,7 @@ retry: { mysql_mutex_unlock(&element->LOCK_table_share); lf_hash_search_unpin(thd->tdc_hash_pins); + std::this_thread::yield(); goto retry; } lf_hash_search_unpin(thd->tdc_hash_pins); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 8292bb063b4..9e8b256ffb6 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1076,6 +1076,7 @@ static void trx_purge_close_tables(purge_node_t *node, THD *thd) noexcept void purge_sys_t::wait_FTS(bool also_sys) { + std::this_thread::yield(); for (const uint32_t mask= also_sys ? ~0U : ~PAUSED_SYS; m_FTS_paused & mask;) std::this_thread::sleep_for(std::chrono::milliseconds(10)); } From c62671543976eb397576f1b57fb6817029bc21ee Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 30 Apr 2025 10:38:44 +1000 Subject: [PATCH 17/89] MDEV-35452 [fixup] fix spider/bugfix.perfschema view protocol mtr with --view-protocol creates new threads --- storage/spider/mysql-test/spider/bugfix/t/perfschema.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/spider/mysql-test/spider/bugfix/t/perfschema.test b/storage/spider/mysql-test/spider/bugfix/t/perfschema.test index 9346d2b5aa3..cb9e5f1ad1d 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/perfschema.test +++ b/storage/spider/mysql-test/spider/bugfix/t/perfschema.test @@ -7,8 +7,10 @@ enable_query_log; --echo # MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled --echo # connect foo,localhost,root; +--disable_view_protocol select variable_name, variable_value from performance_schema.status_by_thread where variable_name like '%spider_direct_aggregate%'; +--enable_view_protocol disconnect foo; connection default; From 60f046d7e6b0a61f9b0762fe05c4021cff1b79d8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 2 May 2025 17:34:39 +1000 Subject: [PATCH 18/89] MDEV-35009: Initialize affected_rows in SQL service The SQL service leaves the affected rows uninitialized. The initialization of the spider plugin that uses this service will fail under MSAN because there isn't an initialized value to return at the end of the query. --- sql/sql_prepare.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ec3cdddfa0a..f39b0e23e58 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -6485,6 +6485,7 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql) new_thd->variables.wsrep_on= 0; new_thd->client_capabilities= client_flag; new_thd->variables.sql_log_bin= 0; + new_thd->affected_rows= 0; new_thd->set_binlog_bit(); /* TOSO: decide if we should turn the auditing off From 84dd2437c507ed194da03fe04fea14e261e47bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 8 May 2025 11:18:16 +0300 Subject: [PATCH 19/89] MDEV-36760 log_t::append_prepare_wait(): Bogus assertion on write_lsn log_t::append_prepare_wait(): Do not attempt to read log_sys.write_lsn because it is not protected by log_sys.latch but by write_lock, which we cannot hold here. The assertion could fail if log_t::write_buf() is executing concurrently, and it has not yet executed log_write_buf() or updated log_sys.write_lsn. Fixes up commit acd071f599f416ddb4821dec485c4d912844213f (MDEV-21923) --- storage/innobase/mtr/mtr0mtr.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 716dac624d5..3c984da3d5d 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -916,17 +916,16 @@ ATTRIBUTE_COLD void log_t::append_prepare_wait(bool late, bool ex) noexcept { got_ex: const uint64_t l= write_lsn_offset.load(std::memory_order_relaxed); - const lsn_t lsn{base_lsn.load(std::memory_order_relaxed)}; - ut_d(lsn_t ll= lsn + (l & (WRITE_BACKOFF - 1))); - ut_ad(is_mmap() - ? ll - get_flushed_lsn(std::memory_order_relaxed) < capacity() - : ll - write_lsn - ((write_size - 1) & (write_lsn - first_lsn)) < - buf_size); + const lsn_t lsn= base_lsn.load(std::memory_order_relaxed) + + (l & (WRITE_BACKOFF - 1)); waits++; #ifdef HAVE_PMEM const bool is_pmem{is_mmap()}; if (is_pmem) - persist(lsn + (l & (WRITE_BACKOFF - 1))); + { + ut_ad(lsn - get_flushed_lsn(std::memory_order_relaxed) < capacity()); + persist(lsn); + } #endif latch.wr_unlock(); /* write_buf() or persist() will clear the WRITE_BACKOFF flag, @@ -934,7 +933,7 @@ ATTRIBUTE_COLD void log_t::append_prepare_wait(bool late, bool ex) noexcept #ifdef HAVE_PMEM if (!is_pmem) #endif - log_write_up_to(lsn + (l & (WRITE_BACKOFF - 1)), false); + log_write_up_to(lsn, false); if (ex) { latch.wr_lock(SRW_LOCK_CALL); From d7457b40764eb3477f4bcc40094f0b756ac4b337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 24 Apr 2025 14:11:38 +0300 Subject: [PATCH 20/89] MDEV-36628 : galera_vote_during_ist test failed Test changes only. Added wait_conditions to wait for expected database state. Signed-off-by: Julius Goryavsky --- .../galera/r/galera_vote_during_ist.result | 14 +++++- .../galera/t/galera_vote_during_ist.test | 43 ++++++++++++++++++- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_vote_during_ist.result b/mysql-test/suite/galera/r/galera_vote_during_ist.result index adbe0e2fe7d..8d95cd8ee15 100644 --- a/mysql-test/suite/galera/r/galera_vote_during_ist.result +++ b/mysql-test/suite/galera/r/galera_vote_during_ist.result @@ -8,6 +8,8 @@ connection node_2; connection node_3; connection node_4; connection node_1; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY); CREATE PROCEDURE p1(IN max INT) BEGIN @@ -48,6 +50,8 @@ CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY); SET SESSION wsrep_on = ON; INSERT INTO t2 VALUES (DEFAULT); CALL p1(130); +connection node_2; +connection node_3; connection node_1; SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation"; Restarting server 4 @@ -58,8 +62,6 @@ SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_conti SET GLOBAL debug = ""; SET DEBUG_SYNC='RESET'; Waiting for server 4 to leave the cluster -SET SESSION wsrep_on = ON; -SET SESSION wsrep_sync_wait = 15; connection node_2; SET SESSION wsrep_on = ON; SET SESSION wsrep_sync_wait = 15; @@ -69,10 +71,18 @@ SET SESSION wsrep_sync_wait = 15; connection node_4; Server 4 left the cluster, killing it... Killed server 4... +connection node_1; +connection node_4; Restarting server 4... connection node_1; SET SESSION wsrep_on = ON; SET SESSION wsrep_sync_wait = 15; +connection node_2; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +connection node_3; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; connection node_1; SELECT count(*) AS expect1_390 FROM t1; expect1_390 diff --git a/mysql-test/suite/galera/t/galera_vote_during_ist.test b/mysql-test/suite/galera/t/galera_vote_during_ist.test index eff7f527300..fc319a767da 100644 --- a/mysql-test/suite/galera/t/galera_vote_during_ist.test +++ b/mysql-test/suite/galera/t/galera_vote_during_ist.test @@ -20,6 +20,10 @@ source ../wsrep/include/check_galera_version.inc; # create table t1 and procedure p1 to generate wirtesets --connection node_1 + +--let $members = 4 +--source include/wsrep_wait_membership.inc + CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY); DELIMITER |; @@ -39,11 +43,17 @@ DELIMITER ;| CALL p1(130); --connection node_4 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 130 FROM t1; +--source include/wait_condition.inc + --echo Shutting down server 4... --let $node_4_server_id= `SELECT @@server_id` --let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect --let $node_4_pid_file= `SELECT @@pid_file` --source include/shutdown_mysqld.inc +--source include/wait_until_disconnected.inc # Wait for node #4 to leave cluster --let $members = 3 @@ -65,16 +75,23 @@ CALL p1(130); SET SESSION wsrep_on = OFF; CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY); SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_2 +--let $wait_condition = SELECT COUNT(*) = 260 FROM t1; +--source include/wait_condition.inc SET SESSION wsrep_on = OFF; CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY); SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_3 +--let $wait_condition = SELECT COUNT(*) = 260 FROM t1; +--source include/wait_condition.inc SET SESSION wsrep_on = OFF; CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY); SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc # This should cause error during IST INSERT INTO t2 VALUES (DEFAULT); @@ -82,6 +99,13 @@ INSERT INTO t2 VALUES (DEFAULT); # make sure nodes 1,2,3 progress far enough for commit cut update CALL p1(130); +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 390 FROM t1; +--source include/wait_condition.inc +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 390 FROM t1; +--source include/wait_condition.inc + --connection node_1 # prepare to stop SST donor thread when it receives a request from starting node #4 SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation"; @@ -96,14 +120,12 @@ SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reach SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue"; SET GLOBAL debug = ""; SET DEBUG_SYNC='RESET'; - # # After this point node #4 shall proceed to IST and bail out # --echo Waiting for server 4 to leave the cluster --let $members = 3 ---source include/wsrep_wait_membership.inc --connection node_2 --source include/wsrep_wait_membership.inc --connection node_3 @@ -124,14 +146,27 @@ SET DEBUG_SYNC='RESET'; EOF --echo Killed server 4... --source include/wait_until_disconnected.inc + +--connection node_1 +--source include/wait_until_ready.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--let $wait_condition_on_error_output = SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition_with_debug.inc + +--connection node_4 --echo Restarting server 4... --source include/start_mysqld.inc --source include/galera_wait_ready.inc + # Confirm node #4 has rejoined --connection node_1 --let $members = 4 --source include/wsrep_wait_membership.inc +--connection node_2 +--source include/wsrep_wait_membership.inc +--connection node_3 +--source include/wsrep_wait_membership.inc # Confirm that all is good and all nodes have identical data @@ -148,6 +183,10 @@ SELECT count(*) AS expect3_390 FROM t1; SELECT count(*) AS expect3_1 FROM t2; --connection node_4 +--let $wait_condition = SELECT COUNT(*) = 390 FROM t1; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM t2; +--source include/wait_condition.inc SELECT count(*) AS expect4_390 FROM t1; SELECT count(*) AS expect4_1 FROM t2; From 235029564373b5a6a52c66a1e68418bf846ec05a Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 6 May 2025 02:26:35 +0200 Subject: [PATCH 21/89] MDEV-36740: galera.galera_ssl_upgrade fails due to expired certificate The certificate used in tests has been renewed. --- mysql-test/std_data/galera-cert.pem | 109 ++++++++++++++---- mysql-test/std_data/galera-key.pem | 52 ++++----- .../std_data/galera-upgrade-ca-cert.pem | 68 +++++------ .../std_data/galera-upgrade-server-cert.pem | 103 ++++++++++++++--- .../std_data/galera-upgrade-server-key.pem | 52 ++++----- .../suite/galera/t/galera_ssl_cipher.cnf | 4 +- .../suite/galera/t/galera_ssl_upgrade.cnf | 4 +- .../t/galera_dynamic_protocol.cnf | 4 +- .../t/galera_dynamic_protocol.test | 2 +- 9 files changed, 259 insertions(+), 139 deletions(-) diff --git a/mysql-test/std_data/galera-cert.pem b/mysql-test/std_data/galera-cert.pem index 2996b330cc0..dba44e01585 100644 --- a/mysql-test/std_data/galera-cert.pem +++ b/mysql-test/std_data/galera-cert.pem @@ -1,26 +1,87 @@ +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 4096 (0x1000) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=Galera CA + Validity + Not Before: May 20 01:31:39 2025 GMT + Not After : May 20 01:31:39 2125 GMT + Subject: + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:a5:04:b1:45:03:ef:44:cb:1f:31:0c:5d:87:60: + 82:25:a8:f7:62:1f:a9:ed:82:06:67:23:6a:b0:0c: + 59:3e:b7:c9:ec:17:16:e2:0b:55:06:49:26:82:e9: + d0:bb:82:a4:79:08:6d:93:2f:6b:a2:40:73:3a:77: + a0:e8:47:99:40:27:fa:d7:39:33:26:9c:3d:c5:0b: + 82:ba:ea:48:71:53:18:0f:f6:47:a5:02:89:80:16: + 68:77:33:d1:a2:bb:34:7f:38:ae:c4:cd:85:f1:8d: + 84:e4:e3:dc:23:93:be:b3:93:bc:de:db:bb:67:6a: + ec:55:f6:6a:c0:bd:b5:18:6e:2e:15:06:a1:b9:f2: + fc:72:12:4d:fc:c1:5a:38:b2:30:17:c0:de:83:19: + 4c:fc:9c:c5:0f:c2:b1:86:57:30:88:82:07:f7:ff: + 96:68:1e:55:7c:18:3f:53:5e:40:20:06:02:a1:6e: + f7:03:4b:82:ea:9e:4f:07:97:03:33:d0:bf:1c:de: + b8:17:bf:7d:4c:3a:48:2d:41:ed:82:e6:3a:2c:6f: + 4f:fd:b1:2d:33:ed:d6:36:8c:bc:f2:ff:52:af:aa: + 32:9b:cf:87:45:f3:b3:61:d1:20:7d:03:a3:2f:1f: + 6c:1d:f9:b8:41:e9:88:04:c1:ae:b9:23:36:80:59: + d1:4f + Exponent: 65537 (0x10001) + Signature Algorithm: sha256WithRSAEncryption + Signature Value: + a1:d1:8e:b3:3f:47:3a:4a:2c:f0:bf:34:72:69:99:f2:fa:a9: + a0:72:3c:7e:7a:69:c1:d6:97:4f:bd:44:ac:92:79:46:e4:8e: + 62:c0:cd:41:e9:55:a7:29:33:d6:f6:e7:e5:13:e9:5a:a1:83: + 85:16:cb:e2:38:9a:55:b1:57:51:ea:cc:ca:5c:46:ab:1d:a5: + 73:d6:d6:df:57:e8:7c:40:16:63:17:75:b2:13:ac:31:eb:96: + 85:3b:fb:92:d6:69:4d:ab:e2:1d:22:82:0f:71:66:8d:b0:a9: + 56:a2:77:5e:f8:56:90:22:1f:ee:e7:79:33:37:c7:9f:a1:06: + 01:35:fe:13:12:75:2e:d9:2a:04:e5:8f:21:4a:20:de:a5:07: + 89:aa:0c:c2:d2:ec:a1:47:d6:f6:87:f7:ed:29:f9:69:c6:83: + f6:18:8d:7e:7e:3a:53:c7:b3:91:bd:9a:b8:e3:ac:66:de:57: + b8:2d:c5:d5:54:61:1b:27:96:e8:34:0d:a9:88:4f:03:5a:27: + e0:5f:b5:90:97:9f:57:39:f5:a9:9d:c6:b6:77:1a:bb:86:57: + 57:0c:79:6e:66:5f:93:c1:f7:df:c8:06:3c:df:c5:f8:ef:b3: + e3:61:8b:15:8a:45:4f:db:1d:7f:2b:eb:c9:54:ba:6e:c8:b8: + 40:ca:de:10:93:a9:a4:8c:17:56:50:37:9c:6b:ba:9c:b0:5f: + 4c:49:a7:9c:ba:3c:81:37:e3:a2:b3:6a:71:b9:f6:a6:bb:81: + f3:5c:40:ae:f5:e1:68:32:e3:af:22:5b:88:aa:df:2e:3b:5d: + e2:63:ab:c7:01:a3:c8:3a:e1:06:9f:2f:d1:9f:b4:06:c4:11: + 83:c2:99:4a:de:f0:c2:32:04:b8:65:26:e9:57:3f:7d:52:d7: + d8:1c:6e:2c:55:53:d3:81:1d:b9:9e:0a:c1:34:a6:6a:48:af: + 3b:d9:6e:84:16:30:33:a6:10:17:36:b4:30:68:fd:95:e9:3e: + 35:c3:95:71:7a:86:26:a7:46:66:09:95:91:c6:c2:ba:a6:61: + c2:a5:b6:38:8e:34:a0:14:f1:d7:0c:11:93:0a:a4:d3:f8:b7: + 32:fd:12:38:64:9f:68:fe:3d:a1:f6:28:c1:c8:9f:1f:ea:a5: + e2:77:fd:ad:d9:21:22:40:b2:9e:8e:81:3f:79:0e:13:19:1e: + 70:0f:4a:4b:81:ea:92:c5:fa:4f:80:e9:8f:5e:ac:dc:09:74: + 70:e1:7b:23:68:0c:18:c7:7f:07:4a:39:42:29:d6:c3:62:16: + ec:15:73:02:93:a6:a3:5f:21:90:59:8e:e6:b1:0a:be:32:cf: + 6d:4e:7e:56:3d:87:13:0f -----BEGIN CERTIFICATE----- -MIIDWTCCAkGgAwIBAgIJAIlW4JmZGnU4MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwIBcNMTQxMDI0MDc1MTU1WhgPMzAxNDAyMjQwNzUxNTVaMEIx -CzAJBgNVBAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl -ZmF1bHQgQ29tcGFueSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQDDzU6xLZDD5rZENsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2Qa -MyTkvyjzf7bSFsDt9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BW -B3lcoKXXJgMnWw0WGrt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5 -kdcIbDRVw81J4eAZ6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrM -mhOeL8kuQV0fI8v2xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWX -Qo98swTu7mb89qVYmR71d3L3AgMBAAGjUDBOMB0GA1UdDgQWBBRdWet/kGNTyvXK -wuBdP/eSldOgWjAfBgNVHSMEGDAWgBRdWet/kGNTyvXKwuBdP/eSldOgWjAMBgNV -HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCcJpP+DR4AJxVelNTSZa+V38c+ -jgrMD2Ku2eU8NQlsjgMfNEU5Md/g7FpP8aCFzVf0kAAT7DxZmSE3uWXQbMXyVJmy -bF+qXinf71QzdWULm6sASoshC6wbHnXL9ZjWQ3gh1nqVgo3MmLQYrb3eJfKaaLoc -wpjhYxVxGFOx1ITN3jED64lUfoLHvR6NFbESYKAuAAzSNqX4HOQ3uGk2THM8JocZ -oH2+38d81Kd4HQ7DDDKS/isG0+rR60Ti1cMgu7OT7p1dZCwT/KQuI5eGjE9lubkc -yAJjaod4rVLdBri3XVvtySfS2+/75qUgv2TF7d/s7mxMq4DDt29yeKSUhZCs +MIID0DCCAbgCAhAAMA0GCSqGSIb3DQEBCwUAMFkxCzAJBgNVBAYTAkZJMREwDwYD +VQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kxEDAOBgNVBAoMB01hcmlh +REIxEjAQBgNVBAMMCUdhbGVyYSBDQTAgFw0yNTA1MjAwMTMxMzlaGA8yMTI1MDUy +MDAxMzEzOVowADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKUEsUUD +70TLHzEMXYdggiWo92Ifqe2CBmcjarAMWT63yewXFuILVQZJJoLp0LuCpHkIbZMv +a6JAczp3oOhHmUAn+tc5MyacPcULgrrqSHFTGA/2R6UCiYAWaHcz0aK7NH84rsTN +hfGNhOTj3COTvrOTvN7bu2dq7FX2asC9tRhuLhUGobny/HISTfzBWjiyMBfA3oMZ +TPycxQ/CsYZXMIiCB/f/lmgeVXwYP1NeQCAGAqFu9wNLguqeTweXAzPQvxzeuBe/ +fUw6SC1B7YLmOixvT/2xLTPt1jaMvPL/Uq+qMpvPh0Xzs2HRIH0Doy8fbB35uEHp +iATBrrkjNoBZ0U8CAwEAATANBgkqhkiG9w0BAQsFAAOCAgEAodGOsz9HOkos8L80 +cmmZ8vqpoHI8fnppwdaXT71ErJJ5RuSOYsDNQelVpykz1vbn5RPpWqGDhRbL4jia +VbFXUerMylxGqx2lc9bW31fofEAWYxd1shOsMeuWhTv7ktZpTaviHSKCD3FmjbCp +VqJ3XvhWkCIf7ud5MzfHn6EGATX+ExJ1LtkqBOWPIUog3qUHiaoMwtLsoUfW9of3 +7Sn5acaD9hiNfn46U8ezkb2auOOsZt5XuC3F1VRhGyeW6DQNqYhPA1on4F+1kJef +Vzn1qZ3Gtncau4ZXVwx5bmZfk8H338gGPN/F+O+z42GLFYpFT9sdfyvryVS6bsi4 +QMreEJOppIwXVlA3nGu6nLBfTEmnnLo8gTfjorNqcbn2pruB81xArvXhaDLjryJb +iKrfLjtd4mOrxwGjyDrhBp8v0Z+0BsQRg8KZSt7wwjIEuGUm6Vc/fVLX2BxuLFVT +04EduZ4KwTSmakivO9luhBYwM6YQFza0MGj9lek+NcOVcXqGJqdGZgmVkcbCuqZh +wqW2OI40oBTx1wwRkwqk0/i3Mv0SOGSfaP49ofYowcifH+ql4nf9rdkhIkCyno6B +P3kOExkecA9KS4HqksX6T4Dpj16s3Al0cOF7I2gMGMd/B0o5QinWw2IW7BVzApOm +o18hkFmO5rEKvjLPbU5+Vj2HEw8= -----END CERTIFICATE----- ------BEGIN DH PARAMETERS----- -MIGHAoGBAJWyvKjE+s7OP4Lj1jXKGlJGWT4Vd5YaxPljihTsRe1aXkWAgsuwISXk -/TQ8Rx5Zmze7rtwtU0PoYxvuam9FMXYqhw2dVe4qRdeSX78DSiL/YBkQzaxlfWVy -RE9+9dzHbCtRVDlN7K1kA+mGWH4/r7NAu4Qm/003V0NTtMwQSqebAgEC ------END DH PARAMETERS----- - diff --git a/mysql-test/std_data/galera-key.pem b/mysql-test/std_data/galera-key.pem index c88c613cacf..82c20e8dd49 100644 --- a/mysql-test/std_data/galera-key.pem +++ b/mysql-test/std_data/galera-key.pem @@ -1,28 +1,28 @@ -----BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDDzU6xLZDD5rZE -NsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2QaMyTkvyjzf7bSFsDt -9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BWB3lcoKXXJgMnWw0W -Grt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5kdcIbDRVw81J4eAZ -6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrMmhOeL8kuQV0fI8v2 -xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWXQo98swTu7mb89qVY -mR71d3L3AgMBAAECggEBAIMT0UdZSp1quL/nrYqNGa9kuSuDz4uCM3+3jNcGZVU4 -vCYHxpmINLi0UK8W5ROJA3zC4AZKjDgOlW93NXK5iKyyiUTIN3hiJi4jiVDuGbh2 -DZtH7mmAKAU1zCx2y2osLLmurfbe8qOJF7ShhrZfgWsHFujFhhUdU92dsTkhZ7EU -2NF8ScxCo4PbOJoHC3j0ApfwCMxUMAKZF5+08EeKYqK7OAXI79HeIvEbHn3cUDGm -bvg6ykwlz2UUO4sg+xdCmn1Bt36HF/4e973Y5fkE/vd9mryHIlu9t7GJgWyUiPr8 -BGEoAWDSpPOMd/b9ivtxh9Gd+LW/uitMuBIfrRPgz9kCgYEA+JqeeD2xqF2IzZyq -i1UqgKe3su2U2zhkgbu1h/1M/reNIZGylF0wFs3P+kNIB2NavmHjXcgSjdJzqRL9 -XEWfFJRmeARo9RTEQEVd8zp1Eo8ISeiksGgvbL4rrNIRR5V5MZytfISRiGCWN6jx -ulJ6EieQk5EcvknGlWpJY/bBsQ0CgYEAyaCLqrR38gVl2Z0t6YlhW/HWAwGt+lf4 -apN1AS4uykx7wRW2B0y9QUDfsrYeVlbbeRPP4UzPmJez+J2cweoIIeFFyo3KP2L7 -79E3EVYywjXhPg52F7OjFA4Bp970XclIC5Al7kDufSgwZmWdceSx4Jjc5ixyQEC8 -Ad0ThgP6yxMCgYAvC4OFmZcvF1Q2JLmZWGqMojB/KbqLqaZLbqwxqduSMEYC3kF/ -FgttpVEAOQ8+ZqzbbkbKjnwEXpkIm9FaTsqF6HdjquH5zw48Y2QeDSfudSbKZb4U -rAKdf3dgYvhmJYEjxFSIRcYMmsqSieQEsGrtWJNheYqI8AkmaVCuHBoXWQKBgQCj -daelNffD2wJuQNI28axfiRjSiSsNuQHpDTCfS1ydnxH5QGu5UUphO4HfdWv03SfC -6f/vDIGEmQBLvyOVxfDf3qzhAMCFUO8kxj1ZrcMq1dmMoNa2cmj0WkKXYNZFrmfd -D/jgRf3Ss6FBcoIJErnudp8nb8MUOibxb9RjIpjQxwKBgEliKaGN+/QkPTNJ4vXz -609CIilxpE+YVTzlv3YeZP5HqsJTJPS2ARIUr/Pjpbl3LHfYNeeGDCwgkJIK0JJH -iA1M51q6t3zG2y9gKmC15FF0jShoZkRgqBxqrSHAnrCo5t2C48ElxJ3FEU8T75sz -dlGTbkmR0Wm43Kh++dWICJ3g +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQClBLFFA+9Eyx8x +DF2HYIIlqPdiH6ntggZnI2qwDFk+t8nsFxbiC1UGSSaC6dC7gqR5CG2TL2uiQHM6 +d6DoR5lAJ/rXOTMmnD3FC4K66khxUxgP9kelAomAFmh3M9GiuzR/OK7EzYXxjYTk +49wjk76zk7ze27tnauxV9mrAvbUYbi4VBqG58vxyEk38wVo4sjAXwN6DGUz8nMUP +wrGGVzCIggf3/5ZoHlV8GD9TXkAgBgKhbvcDS4Lqnk8HlwMz0L8c3rgXv31MOkgt +Qe2C5josb0/9sS0z7dY2jLzy/1KvqjKbz4dF87Nh0SB9A6MvH2wd+bhB6YgEwa65 +IzaAWdFPAgMBAAECggEAT55ae46g8MPCWnN5YvqNAOer6IOXhPlh5nx/ms5yduDN +Q6SGTW0jSmOb+bkflYE8owsOd1//YisPjauvjrMQ/ZPsotA93kivQvXBTzb/2fG6 +H+V3fuWg+xSUtcLiSE5jz2hFZr40/K2H67oG+oFsFw/Wpn5FRuofeoBo1HMTv+OO +8JvDGOC3jNBxqvajf2+YTpHkS2Bm0CujlspMv+LYYJm4kjlmaE+PEKGAqp+WT+rK +10HXYQGsOLld3DVfO0aHJQ+ji5WskTtmJxi/Gutra2BL7upiPByvdInCBFL5WObw +1gQCYZeUgD0Djofmk4Jst8M7fU/v8HDTgyMzy544EQKBgQDOVXuS3wkxz5QqKAt9 +js8nAb+M9w84cCn89hLZN60IBBWb933EtRun5M6Izy7PWRnSUH4Oeao9cGU1GsKQ +AuTLJKfbNVCrYo5dTpRDpK1zgRaiT2IPn8Wi337qP89dcb0NPXpWkzrkmhZJ3C6t +YkvDp8jhunudCpisWsA5cDGmcQKBgQDMvUyI7wyukMt+VDIi1tnzJgJlezXRRCCH +MO1qMSAn0UIIp/9nR41mdj9gQJby1uc+eL5eLY/KTjZgU9NTOhJ3ZT/GkvoR9xQt +yZfWz8117OXoJxMgfUITKijtlQSCY4i3kAcA+bEerFIW+6xtNXzte5Q+LH/knmbh +HmC689hTvwKBgERRwa0L9LtthB3BTKyyUJ0V0xsV4xBI814zDGKoML7qu0z9UcOE +RDf/ZvOdxl4Znpco19RrLJdTU++VgL62dpNc+8d1i9RzubfjgOw05snMAHaV2l5a +BNK9NgTSRBMoyfRMWum3rlRrQN4L7dizJ2sNb1JusOd6zrqjAesC3y3BAoGAAdlz +54jBRJJqRCneihIGxfuB6gjC47EJ2i7G9j6bW8C4J/vcgsJStKo8yFHNC0SFsjrE +/XTL57ftJdGcBxRvNkTj3pdVSvRAaml3xaj64iXRrdcshQ6cmi+3Tu4ZrFPZ2E6k +wY1/3BcSZsK/O/1Ps5V6MVWVkiscIsxzczzgp2ECgYAqC6yFmIbw1Ui/YIqprj8c +nb5xl5KGj47ZGFIWeoNIZKOwUZu+POu+WZ4kOvySP276xvLfjLjWl+HHjN73AMaT +RvW2+xwSEfGR4d5wqGGxk5TnJOzi0vd21tGUCGdc+AAYDE/M00skdW8AfK1fUuVm +qkpHixGjosFWeZn9IGyu0g== -----END PRIVATE KEY----- diff --git a/mysql-test/std_data/galera-upgrade-ca-cert.pem b/mysql-test/std_data/galera-upgrade-ca-cert.pem index 13d27e84bb3..6c6ce469368 100644 --- a/mysql-test/std_data/galera-upgrade-ca-cert.pem +++ b/mysql-test/std_data/galera-upgrade-ca-cert.pem @@ -1,40 +1,32 @@ -----BEGIN CERTIFICATE----- -MIIDWTCCAkGgAwIBAgIJAIlW4JmZGnU4MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwIBcNMTQxMDI0MDc1MTU1WhgPMzAxNDAyMjQwNzUxNTVaMEIx -CzAJBgNVBAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl -ZmF1bHQgQ29tcGFueSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQDDzU6xLZDD5rZENsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2Qa -MyTkvyjzf7bSFsDt9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BW -B3lcoKXXJgMnWw0WGrt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5 -kdcIbDRVw81J4eAZ6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrM -mhOeL8kuQV0fI8v2xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWX -Qo98swTu7mb89qVYmR71d3L3AgMBAAGjUDBOMB0GA1UdDgQWBBRdWet/kGNTyvXK -wuBdP/eSldOgWjAfBgNVHSMEGDAWgBRdWet/kGNTyvXKwuBdP/eSldOgWjAMBgNV -HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCcJpP+DR4AJxVelNTSZa+V38c+ -jgrMD2Ku2eU8NQlsjgMfNEU5Md/g7FpP8aCFzVf0kAAT7DxZmSE3uWXQbMXyVJmy -bF+qXinf71QzdWULm6sASoshC6wbHnXL9ZjWQ3gh1nqVgo3MmLQYrb3eJfKaaLoc -wpjhYxVxGFOx1ITN3jED64lUfoLHvR6NFbESYKAuAAzSNqX4HOQ3uGk2THM8JocZ -oH2+38d81Kd4HQ7DDDKS/isG0+rR60Ti1cMgu7OT7p1dZCwT/KQuI5eGjE9lubkc -yAJjaod4rVLdBri3XVvtySfS2+/75qUgv2TF7d/s7mxMq4DDt29yeKSUhZCs ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDVzCCAj+gAwIBAgIJALBO5bqmtlYkMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwHhcNMTUwNjI2MDcxMjQ1WhcNMjUwNTA0MDcxMjQ1WjBCMQsw -CQYDVQQGEwJGSTEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZh -dWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -1DlcztIzSngGeTUFibj9GZ4ZO78ASpgYySZv/DRIVn/3hbF41ZRD/6uJlb5rf1R7 -fpFsurbXNDDxeap7b/Gz2XSQy96Dbm0SbsFSZttV/R2WtlT1Wf5n9ix6RLqhKSbg -nPyL2fsDaxtZh2uywGJEXhwXFtdx3deIo/tYivDfl5Tcsv0NnZY8Vg0boBRP+FEn -ReJOdSa5LLn+QJN2Xa+wutbLHe0hI6huKUXU2YUeBfgyk1nWol5241ZUDCgDsoaW -8r2YeJNHmNInd3wERbqFgFHsR4N1+Atcyrfn/uQSj9zrTPO/Pp51KpjWf/gjxjXP -biu5De50qZ4+U4no20EIOwIDAQABo1AwTjAdBgNVHQ4EFgQU3kSPGchrOoQJ5gq1 -mmV2HEra6GswHwYDVR0jBBgwFoAU3kSPGchrOoQJ5gq1mmV2HEra6GswDAYDVR0T -BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAfoBD64FJ9fAR19+vwueFGmpWNIqF -PzN7QmEpCMduV3DXuxYO73q2ikXgrVO5HWFz9IjNvzXbSRmWNzJGaZ3QYZ+Xx1JJ -8MrAOUr6djWuyD659f64dh/2jMxiQNoEHrknXm9HSqR5oJVwndFyr/zvSkYSRexE -KFciIprb9LOba9G3ZMBYBdqK+f3Ky16BMjaD6XfaTx+xjHk/8peSueXIQl+v2biz -zSfpEUa0dKCIxckrzD4JknDHFimTsrzlRftcg8t8piOXwZomFcnVunyGs2bJ/Npj -25c2e6sx7XSc5bUgPGuQcSGflZPLg9zWyJ69sVYUNAz+gqfvWfOOJuzPNg== +MIIFkzCCA3ugAwIBAgIUV3aBq/Mk/AlwaHlG2fWsrojezT4wDQYJKoZIhvcNAQEL +BQAwWTELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhI +ZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjESMBAGA1UEAwwJR2FsZXJhIENBMB4X +DTI1MDUyMDAxMTUxNFoXDTM1MDUxODAxMTUxNFowWTELMAkGA1UEBhMCRkkxETAP +BgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFy +aWFEQjESMBAGA1UEAwwJR2FsZXJhIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +MIICCgKCAgEA0w+K6kwQVLDyg//YVYxDXFElDpzUlZo66Yq7y8Y2LcG088GqPQlf +g9tMd/HFat8HXaRu2N3Mjd7cgtt7Sp+wuSC3MadGObqaipwnGMUC04FUI3aOlhyu +NPdS6o+LQ3LIhRNS251SqYJ+lZkWlw7ygw/pyovAwyWKkUib1n1C0O9DwLcZEGdY +4GkkifSp7gF+xHf9NZ3AI0nnXZccmQm3EYslepR8Do+D635Hk+49kN/OPm44uUjn +ul9Xlh4azn6AXgd1VPBWV7Ic6EtMhXIVdIiJTIbhHVBTuMXlwS2TzXEJN0QcGMLF +AyA6aDPkFHwZDAyP/fgh7v2DVkEh8UQUUW4m3GibJmyYcQw0pvILcC8sUHMQ8ZAb +eTchzwB+2L3DywGHmcDMYeUpmYANABNdLGBZTnjy06ZBs0EAPMaUujUXWjb4zI5+ +NQ5KTfYQ3nOePKyFzf+W7aO09ApM9zbYI5fZwoAlgxqwL58LlxmW6QDDSMtu9xE+ +3p0/iJnUD3mCUYPKINqT8ZaJOTOywELntUq/eFjPHZlCebbBhVBGjJQnhNAlWD7O +Y2iOs3XYzVX4FJxlcodj3idKrfRYF3IGekah4+NainFbMu24J08BYrc77vqj8qNv +tHaYcxEs4d0ggyWAnr4i8wDgl/aT63FIj+PPA7VHw9ytbEYkF7ZEBb0CAwEAAaNT +MFEwHQYDVR0OBBYEFFS7XKdj8vKLmXYl/adm467ECLwGMB8GA1UdIwQYMBaAFFS7 +XKdj8vKLmXYl/adm467ECLwGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggIBACm8QeUNhuAbwsOA7uImSFyatA7+kSC0heVQyV0B2AC4smca3yQQfnF7 +ttnloEfOQJ/HEKUw67jFPLjf+ZdrV4WGJJFlUpUcOgTBgtPze3Cc8JdJTAsA12cz +rxCKNf7d9Ob1xzXsGmWG0fjPqJpFMDTDdJcuWBdKOjKg8qP3L3anfQBPiVzc6Wyz +IIs7LUQRAYtN05JE8jzDecNKZIbDbGQ3qb4uqyfQOebaP4g63osNMugBPRQpcgLk +o2F0q3iC1GnJD8RCl1P0IpLHtVIC8GbamL0WVD5XWYk6esGHpqzeWZGUl+GVUCJ+ +QOlqnLD0UPnBo/o3d+lrzeRUeGVu+k8u3TeJZyzOyuh7ZPZtNQ7h1Rzxa5LD4tGX +SeFtyS8dYiVC27Vyu2LAFcbZUO3VTOpusXy3iq5jz7MzuTHaV8MiYPDuQ3xhrUo9 +kGWXKiTd+Vr1V6iBig7wWDSwMyFbbDzv3N86TpHjO2ynXNHXPg6VEDOP+zOcI7KO +cgQWqhR8Zr58Yo1tRI8ync9zeUF5cD1EnkP0QRelnmhR0IEPAIxW2YCIO4+jAZOE +5bKPyJwjWzfJR0U2fFi73qpXoMXubcrPFMdiYTMnRjwO+WVLNWCQbe6zE9xh/ZKx +JCYjqvyKIrbtrS4exkRkXDX+gknrdYcfSw/7i9DKkzfowKYVrTQd -----END CERTIFICATE----- diff --git a/mysql-test/std_data/galera-upgrade-server-cert.pem b/mysql-test/std_data/galera-upgrade-server-cert.pem index 3af8b1ae7dd..deee3c9f682 100644 --- a/mysql-test/std_data/galera-upgrade-server-cert.pem +++ b/mysql-test/std_data/galera-upgrade-server-cert.pem @@ -1,20 +1,87 @@ +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 4097 (0x1001) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=Galera CA + Validity + Not Before: May 20 01:32:38 2025 GMT + Not After : May 20 01:32:38 2125 GMT + Subject: + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:c9:0e:e9:9d:eb:8f:8d:7f:79:aa:55:7f:2d:c0: + be:92:10:77:46:78:31:63:38:82:01:91:91:4c:c1: + 49:85:04:d3:28:0a:49:80:81:1f:3c:3c:00:6f:aa: + e1:ad:d1:44:0a:72:2a:82:39:72:12:5e:3d:0e:be: + 43:f8:11:98:6a:cb:35:a8:f5:05:e1:1b:b1:9f:14: + ee:59:9d:4a:34:cc:92:0d:9b:cf:23:db:ba:5e:68: + b3:de:2f:37:04:41:c7:84:b0:62:fb:5d:7a:b9:6e: + 0d:f8:f9:82:23:24:8c:0e:f6:34:b7:93:fe:82:f6: + fc:56:45:46:67:63:b1:a7:18:2d:2b:7a:90:92:9c: + a0:cc:11:18:68:f1:9d:24:a5:77:40:cc:c3:ae:df: + ed:c9:1c:cb:e1:66:0c:04:3e:93:2b:4f:ad:31:c1: + 33:64:a4:27:7d:27:da:40:bb:bb:d9:a1:f1:b0:bc: + 43:de:52:22:78:0d:21:ac:20:e0:62:15:4b:60:a4: + 60:77:34:44:75:76:1f:57:00:23:15:dd:51:29:b2: + 5e:75:99:b0:72:0b:49:21:31:1f:5f:a4:b9:ef:c4: + f1:1e:4c:0d:1f:4b:2d:f1:71:f9:b1:df:3f:9c:01: + 7e:cd:66:ef:07:e6:e7:9a:95:eb:86:ba:44:05:84: + 42:2b + Exponent: 65537 (0x10001) + Signature Algorithm: sha256WithRSAEncryption + Signature Value: + 90:67:64:33:70:bd:c8:15:10:8d:8c:f3:09:48:c8:12:8d:58: + 25:b6:a7:a5:2f:54:4e:a3:8e:4c:8d:e7:bb:60:2e:1c:1d:0f: + c1:62:78:d3:47:18:a0:c6:55:4c:69:38:07:e4:86:7a:c6:35: + f3:bd:05:1b:a4:67:ea:d9:ed:72:e5:37:df:7f:97:2f:76:4e: + d8:7a:df:de:7f:35:15:de:cd:e0:e3:c2:e1:96:15:79:3f:88: + 5f:d1:f1:b4:f1:41:21:f1:6a:cd:92:3d:4c:14:fc:5b:17:d0: + ec:7d:12:88:18:74:ec:5c:2a:d3:e7:7b:c4:69:53:51:37:71: + d1:f8:2a:70:80:e3:b7:b5:00:a6:df:d4:9b:d4:65:5e:e2:53: + 6e:98:6d:76:26:cd:19:cd:08:ec:81:8b:54:50:53:9b:06:f3: + 65:83:a9:1b:9c:f0:ed:12:88:c5:0c:f2:02:d4:3f:09:fb:43: + f9:1e:13:12:05:c4:e7:47:e7:9e:bf:c0:6a:70:17:3e:f4:29: + 92:77:a8:1b:d9:1c:3c:e3:ae:5d:c8:98:a6:4b:3d:22:a8:cd: + 46:8e:8b:4e:b2:0c:a3:3e:9e:fe:98:a1:2c:36:10:f9:b6:63: + d4:ae:bb:a8:f3:e8:cd:2f:0e:06:a2:e9:e1:41:3f:25:8b:ec: + a1:65:56:ec:d6:98:4b:b3:fc:d1:8f:21:1e:55:3d:28:10:c3: + 55:30:54:0a:92:f5:33:7e:c6:68:fb:7d:b3:5f:5a:a2:65:4f: + 25:53:93:3a:11:4a:23:5b:26:59:8e:5d:c5:56:c9:35:f5:55: + 45:f1:0c:f0:b3:98:62:3f:42:f3:44:17:81:fd:41:80:e5:6e: + 45:76:19:f0:34:f6:9a:13:76:5e:2e:08:66:71:e0:5d:f8:aa: + f9:ef:4b:1d:23:bc:c7:a7:e4:09:61:df:e6:b7:9a:7f:d2:8c: + 25:f3:26:e2:38:36:1a:1e:23:a9:10:60:08:59:22:52:cf:64: + 47:68:a0:04:31:33:f7:14:ec:33:87:76:f2:84:d1:37:07:fc: + 1a:fa:23:94:2a:7e:72:f8:bb:45:17:49:d7:57:46:c1:aa:4c: + d2:04:dc:82:7b:33:b9:44:ee:d2:bb:4c:60:f0:93:7b:68:19: + 77:65:7b:ce:65:d2:16:2d:0b:3d:0b:7d:62:96:86:29:c2:01: + 57:26:02:15:67:cb:97:5b:2e:a6:65:60:b9:4f:53:ce:3a:6a: + 35:06:50:d9:1b:be:5b:a0:0e:0a:b4:66:40:a5:6a:40:d1:37: + fd:f9:0a:63:22:b4:08:7d:5f:1a:ed:cb:6f:74:17:b6:a3:56: + 54:24:38:8f:c4:6a:cf:46 -----BEGIN CERTIFICATE----- -MIIDVzCCAj+gAwIBAgIJALBO5bqmtlYkMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwHhcNMTUwNjI2MDcxMjQ1WhcNMjUwNTA0MDcxMjQ1WjBCMQsw -CQYDVQQGEwJGSTEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZh -dWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -1DlcztIzSngGeTUFibj9GZ4ZO78ASpgYySZv/DRIVn/3hbF41ZRD/6uJlb5rf1R7 -fpFsurbXNDDxeap7b/Gz2XSQy96Dbm0SbsFSZttV/R2WtlT1Wf5n9ix6RLqhKSbg -nPyL2fsDaxtZh2uywGJEXhwXFtdx3deIo/tYivDfl5Tcsv0NnZY8Vg0boBRP+FEn -ReJOdSa5LLn+QJN2Xa+wutbLHe0hI6huKUXU2YUeBfgyk1nWol5241ZUDCgDsoaW -8r2YeJNHmNInd3wERbqFgFHsR4N1+Atcyrfn/uQSj9zrTPO/Pp51KpjWf/gjxjXP -biu5De50qZ4+U4no20EIOwIDAQABo1AwTjAdBgNVHQ4EFgQU3kSPGchrOoQJ5gq1 -mmV2HEra6GswHwYDVR0jBBgwFoAU3kSPGchrOoQJ5gq1mmV2HEra6GswDAYDVR0T -BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAfoBD64FJ9fAR19+vwueFGmpWNIqF -PzN7QmEpCMduV3DXuxYO73q2ikXgrVO5HWFz9IjNvzXbSRmWNzJGaZ3QYZ+Xx1JJ -8MrAOUr6djWuyD659f64dh/2jMxiQNoEHrknXm9HSqR5oJVwndFyr/zvSkYSRexE -KFciIprb9LOba9G3ZMBYBdqK+f3Ky16BMjaD6XfaTx+xjHk/8peSueXIQl+v2biz -zSfpEUa0dKCIxckrzD4JknDHFimTsrzlRftcg8t8piOXwZomFcnVunyGs2bJ/Npj -25c2e6sx7XSc5bUgPGuQcSGflZPLg9zWyJ69sVYUNAz+gqfvWfOOJuzPNg== +MIID0DCCAbgCAhABMA0GCSqGSIb3DQEBCwUAMFkxCzAJBgNVBAYTAkZJMREwDwYD +VQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kxEDAOBgNVBAoMB01hcmlh +REIxEjAQBgNVBAMMCUdhbGVyYSBDQTAgFw0yNTA1MjAwMTMyMzhaGA8yMTI1MDUy +MDAxMzIzOFowADCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMkO6Z3r +j41/eapVfy3AvpIQd0Z4MWM4ggGRkUzBSYUE0ygKSYCBHzw8AG+q4a3RRApyKoI5 +chJePQ6+Q/gRmGrLNaj1BeEbsZ8U7lmdSjTMkg2bzyPbul5os94vNwRBx4SwYvtd +erluDfj5giMkjA72NLeT/oL2/FZFRmdjsacYLSt6kJKcoMwRGGjxnSSld0DMw67f +7ckcy+FmDAQ+kytPrTHBM2SkJ30n2kC7u9mh8bC8Q95SIngNIawg4GIVS2CkYHc0 +RHV2H1cAIxXdUSmyXnWZsHILSSExH1+kue/E8R5MDR9LLfFx+bHfP5wBfs1m7wfm +55qV64a6RAWEQisCAwEAATANBgkqhkiG9w0BAQsFAAOCAgEAkGdkM3C9yBUQjYzz +CUjIEo1YJbanpS9UTqOOTI3nu2AuHB0PwWJ400cYoMZVTGk4B+SGesY1870FG6Rn +6tntcuU333+XL3ZO2Hrf3n81Fd7N4OPC4ZYVeT+IX9HxtPFBIfFqzZI9TBT8WxfQ +7H0SiBh07Fwq0+d7xGlTUTdx0fgqcIDjt7UApt/Um9RlXuJTbphtdibNGc0I7IGL +VFBTmwbzZYOpG5zw7RKIxQzyAtQ/CftD+R4TEgXE50fnnr/AanAXPvQpkneoG9kc +POOuXciYpks9IqjNRo6LTrIMoz6e/pihLDYQ+bZj1K67qPPozS8OBqLp4UE/JYvs +oWVW7NaYS7P80Y8hHlU9KBDDVTBUCpL1M37GaPt9s19aomVPJVOTOhFKI1smWY5d +xVbJNfVVRfEM8LOYYj9C80QXgf1BgOVuRXYZ8DT2mhN2Xi4IZnHgXfiq+e9LHSO8 +x6fkCWHf5reaf9KMJfMm4jg2Gh4jqRBgCFkiUs9kR2igBDEz9xTsM4d28oTRNwf8 +GvojlCp+cvi7RRdJ11dGwapM0gTcgnszuUTu0rtMYPCTe2gZd2V7zmXSFi0LPQt9 +YpaGKcIBVyYCFWfLl1supmVguU9TzjpqNQZQ2Ru+W6AOCrRmQKVqQNE3/fkKYyK0 +CH1fGu3Lb3QXtqNWVCQ4j8Rqz0Y= -----END CERTIFICATE----- diff --git a/mysql-test/std_data/galera-upgrade-server-key.pem b/mysql-test/std_data/galera-upgrade-server-key.pem index d243c9e0381..872f3187cd9 100644 --- a/mysql-test/std_data/galera-upgrade-server-key.pem +++ b/mysql-test/std_data/galera-upgrade-server-key.pem @@ -1,28 +1,28 @@ -----BEGIN PRIVATE KEY----- -MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDUOVzO0jNKeAZ5 -NQWJuP0Znhk7vwBKmBjJJm/8NEhWf/eFsXjVlEP/q4mVvmt/VHt+kWy6ttc0MPF5 -qntv8bPZdJDL3oNubRJuwVJm21X9HZa2VPVZ/mf2LHpEuqEpJuCc/IvZ+wNrG1mH -a7LAYkReHBcW13Hd14ij+1iK8N+XlNyy/Q2dljxWDRugFE/4USdF4k51Jrksuf5A -k3Zdr7C61ssd7SEjqG4pRdTZhR4F+DKTWdaiXnbjVlQMKAOyhpbyvZh4k0eY0id3 -fARFuoWAUexHg3X4C1zKt+f+5BKP3OtM878+nnUqmNZ/+CPGNc9uK7kN7nSpnj5T -iejbQQg7AgMBAAECggEBAJ4m7VG3db+uOGzFJY5fzEX1+qn6ibYNKJNmUJfrQmkr -zgLUoc7QQehbJhnwoN1v0OQebZ+rOC7NtnZLpNdkkPmhk3JKLTnykIT3DnhWRftt -vG2+XGUnYMQkmy1ywz0Omt6CmZnlJMQByrNPgBM8Z+SWHGLKRTHkOBCz82T/YjDr -wqug1Yv6W0wMNM/cikgoBldVG7hABCJuShjffIbUgVysK3dEPNywNAC78neoGECm -evPZOaIkWEr86SpAlwA6Yh+zTQZ03CXATcGonJdWJ015DvlKRv6QyRR0Q/Y1ONwb -f115kll15MJBEspFdSyhlMcVJlwO8WMaZ2qIzlQZmdECgYEA//P469QzX00L/urK -7IRvtSVu5CP/A/Wui90U4KoP7XgXIeExnEtzLVs1K7vjuzdpTyq+68XuC40gPcJW -RvoX229m6gRV8nC53UiV71jM8IvkyEqFYT/gfZC9KQCMSRJLtVnDMpZ3gMxAY6/5 -p20o616Au8DKFFetQV0aD4Hj1/MCgYEA1ENV1WkgvN6yItB77E9kN/vbKLRh0hrg -9xj0SmMXGYyDM9NpjbgbgJIZo3ukkBtp3kEY8P9JQZRcd1EcnnSrwTB7ChdInWkR -m/LpIZBEMqNQbeu4QSzZYYS6z4tcGGx43aHqzzNBZdnQnqhYL1CvlLwhkgX6oQCo -woXqyfMNKJkCgYEA63gD1NGPwWkcVBSlQxpDup8JeZE0Fux6++kUP+u0Y39LqLuH -7IXtHBkAvY9JXv8HPvHQWw/og2/97VNQFFQYhqPiRgBfIX9bPpx8c4l6YQISI8GL -G4CsglgZ7hK2/LJ8PAascWnD3xYJVqyaPNFMB90VCaW/Qx+2IKAKTaHtfskCgYBu -1f5C4pMqrCpeTXj4Cvis1wE4PwB5QnnH7SrakOVl/N4huLn8O2948lEa8Zwbd4UP -ffR1Gwh4iuzBjQQhpZBt30/QFBphv5RnVy7uzLMfsfF0hEqBFdcoubMGXqGnSzTN -nhfLO9thQJxTzFnH0xzr0FTDOAYH/h0g/eZ8r0JmuQKBgQDjhXM+hJ3Pkwua+Fnl -nZfY5MeSzkJki/9iwVo8rSDwmZS9Nsc83oZnddM7c2x63t+zYOAcMxsVCiByMDzo -5IB781HWRBGcU8TnW1b0bAnZimjKp/qsZ/Szr38rvImqG8TjzbcSD7w0SpyRQ/Ot -A7SZFkWYfem8/q/VImjU/CNbOQ== +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDJDumd64+Nf3mq +VX8twL6SEHdGeDFjOIIBkZFMwUmFBNMoCkmAgR88PABvquGt0UQKciqCOXISXj0O +vkP4EZhqyzWo9QXhG7GfFO5ZnUo0zJINm88j27peaLPeLzcEQceEsGL7XXq5bg34 ++YIjJIwO9jS3k/6C9vxWRUZnY7GnGC0repCSnKDMERho8Z0kpXdAzMOu3+3JHMvh +ZgwEPpMrT60xwTNkpCd9J9pAu7vZofGwvEPeUiJ4DSGsIOBiFUtgpGB3NER1dh9X +ACMV3VEpsl51mbByC0khMR9fpLnvxPEeTA0fSy3xcfmx3z+cAX7NZu8H5uealeuG +ukQFhEIrAgMBAAECggEALOBrPJhrfkXJvj8/F9NBthB+zvfc7iyauAbpy5wI8OvW +xcUmCszHUAaEgmg93zIqYbqByndQAtGOB1Bok2I6Bvw8ie3G1iv8RWnCmbYF7isL +HoZ8gaB1xMTSAPHA8e5Mvk0wirKexezOqZfneDicGmrR8XfTAyBlykvEHyeda5IQ +O5P5OIseevBSOYujV/pYohLIlIJmaxtlyLktIos2TvNxcomULhQ+b+xLc2YZespE +9Tvolin3czzS8UUACFIVDkmWRzEyEH+PXOBFiwbI3SeL1V+iJx+YcEkrNZpLkV45 +DxvNqDMfgi7iZ5Re9/QIuoz79drokiC6yHW/V5EWoQKBgQD3RcvbaaWkCpC0mHer +K3+5I9OtBxFenG3h5v8jXVC4LwKoqeN5CpMBnltohiRWOxfjuJ15MHkIywuDYslU +ySEA2GvZZZIJxa9dNiQiCPlEH5GN0+9U9FDTYj3bvcjKkxrYBsdF3Yt3kkmlkdiZ +ANpo4iWHWkWC0EDXLqlM1dc8vQKBgQDQJ40pkMXczHFjklnwOtm1ftjXPtIUA2t8 +Wgs+IVua0z+j5G1BiHisRct5pQDgLbMCtRzMvi8a/BrH+LMn9eGBnifJfOMZi7JR +6AYIjYzUVqJNgBLPTCLFjRSGOfLgG3XnS++E5OleftOvXZRuhzgng7ED8dU5KRfh +kjqwz3wNBwKBgAUleryyUjQ71A8uLS9u1FWyHTG4t+/UKaVN/Xlq88chk1iXUJiw +U6bw+M4QHKl+yVx/9ycSjzJTp4WwhKgzF3DBEF2R85wodSHngpECxs1YKttc0dpe +y1/a55avOIKe1Swx1+voVILElKvRgUSN8/3C1y0d/9xdITxZSETFHpmxAoGAK+qc +Us+znzEXHz3qcc/IzQ0VLNyZMBXEoLjStGoPTKwTOj3gezoS063qDyEr/SBHK2QQ +znW1tIjKEbS7/8tVp6Y5mL4bn/EkTzmXxEgxFT+uAJHr5gaXM3zffq5NOtEwX/ta +bnxpbEFv4gjpXyRySYv0VfO429V6r2HNti4gaxMCgYEA0EYdaBjLb+eHsT4aBFa4 +uQg7N/F4JPNFpb7L6u0gCxkPGkmolCJyPMBS26ciDIiGIx9VBxvWsuzLU96nphG9 +xgczWAzbYXeHN6UZw2ASWMyW+ffYqgLlE3it5qj0JiCkWxsjSiStLKm675WkqkxM +LBW22SFBcrXvQLb6CEC5mQQ= -----END PRIVATE KEY----- diff --git a/mysql-test/suite/galera/t/galera_ssl_cipher.cnf b/mysql-test/suite/galera/t/galera_ssl_cipher.cnf index 776c321d800..92380428b83 100644 --- a/mysql-test/suite/galera/t/galera_ssl_cipher.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_cipher.cnf @@ -5,7 +5,7 @@ loose-galera-ssl-cipher=1 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index ee8c6e590f4..1635c898d27 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -5,7 +5,7 @@ loose-galera-ssl-upgrade=1 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf index 84500819cee..a1264c09894 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf @@ -5,7 +5,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep_node_name='node.1' -wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] wsrep_node_name='node.2' @@ -13,4 +13,4 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#gale [mysqld.3] wsrep_node_name='node.3' -wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test index b4536762560..d06d7d27a46 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test @@ -50,7 +50,7 @@ SELECT COUNT(*) = 1 FROM t1; # Restart node with SSL enabled --source include/shutdown_mysqld.inc --let $restart_noprint = 1 ---let $restart_parameters = --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1 --wsrep_provider_options=base_port=$NODE_GALERAPORT_2;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem +--let $restart_parameters = --wsrep_cluster_address=gcomm://127.0.0.1:$NODE_GALERAPORT_1 --wsrep_provider_options=base_port=$NODE_GALERAPORT_2;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem --source include/start_mysqld.inc --source include/galera_wait_ready.inc From 8868737b5adbf6c5b937d6c41486a1bdb7103135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 9 Apr 2025 13:53:59 +0300 Subject: [PATCH 22/89] MDEV-36527 : Selecting mysql.wsrep_streaming_log incorrectly not allowed when detached In the get_table_category function, the check for whether a table is a WSREP system table was incorrectly placed. As a result, TABLE_CATEGORY_MYSQL was returned, but user access to tables in this category is not allowed when the server is detached. Fixed by moving the check for whether a table is a WSREP system table inside the section with checks for MySQL schema tables. Its category is now correctly set to TABLE_CATEGORY_INFORMATION, and tables in this category are accessible when detached. Signed-off-by: Julius Goryavsky --- sql/table.cc | 9 +++------ sql/wsrep_schema.cc | 1 - sql/wsrep_schema.h | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/sql/table.cc b/sql/table.cc index a0516fafa0a..300e02f7ced 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -316,12 +316,7 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db, name.streq(TRANSACTION_REG_NAME)) return TABLE_CATEGORY_LOG; - return TABLE_CATEGORY_MYSQL; - } - #ifdef WITH_WSREP - if (db.streq(WSREP_LEX_SCHEMA)) - { if(name.streq(WSREP_LEX_STREAMING)) return TABLE_CATEGORY_INFORMATION; if (name.streq(WSREP_LEX_CLUSTER)) @@ -330,9 +325,11 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db, return TABLE_CATEGORY_INFORMATION; if (name.streq(WSREP_LEX_ALLOWLIST)) return TABLE_CATEGORY_INFORMATION; - } #endif /* WITH_WSREP */ + return TABLE_CATEGORY_MYSQL; + } + return TABLE_CATEGORY_USER; } diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index f8acd876a5f..00bfa38b499 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -43,7 +43,6 @@ #define WSREP_MEMBERS_TABLE "wsrep_cluster_members" #define WSREP_ALLOWLIST_TABLE "wsrep_allowlist" -LEX_CSTRING WSREP_LEX_SCHEMA= {STRING_WITH_LEN(WSREP_SCHEMA)}; LEX_CSTRING WSREP_LEX_STREAMING= {STRING_WITH_LEN(WSREP_STREAMING_TABLE)}; LEX_CSTRING WSREP_LEX_CLUSTER= {STRING_WITH_LEN(WSREP_CLUSTER_TABLE)}; LEX_CSTRING WSREP_LEX_MEMBERS= {STRING_WITH_LEN(WSREP_MEMBERS_TABLE)}; diff --git a/sql/wsrep_schema.h b/sql/wsrep_schema.h index 0a2e37ba1b3..f9b5dff1be0 100644 --- a/sql/wsrep_schema.h +++ b/sql/wsrep_schema.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2024 Codership Oy +/* Copyright (C) 2015-2025 Codership Oy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -172,7 +172,6 @@ class Wsrep_schema extern Wsrep_schema* wsrep_schema; -extern LEX_CSTRING WSREP_LEX_SCHEMA; extern LEX_CSTRING WSREP_LEX_STREAMING; extern LEX_CSTRING WSREP_LEX_CLUSTER; extern LEX_CSTRING WSREP_LEX_MEMBERS; From 82d7419e0600a70b1a1c993d33ed6cf79fbd6129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 20 May 2025 17:27:05 +0300 Subject: [PATCH 23/89] MDEV-34388: Stack overflow on Alpine Linux page_is_corrupted(): Do not allocate the buffers from stack, but from the heap, in xb_fil_cur_open(). row_quiesce_write_cfg(): Issue one type of message when we fail to create the .cfg file. update_statistics_for_table(), read_statistics_for_table(), delete_statistics_for_table(), rename_table_in_stat_tables(): Use a common stack buffer for Index_stat, Column_stat, Table_stat. ha_connect::FileExists(): Invoke push_warning_printf() so that we can avoid allocating a buffer for snprintf(). translog_init_with_table(): Do not duplicate TRANSLOG_PAGE_SIZE_BUFF. Let us also globally enable the GCC 4.4 and clang 3.0 option -Wframe-larger-than=16384 to reduce the possibility of introducing such stack overflow in the future. For RocksDB and Mroonga we relax these limits. Reviewed by: Vladislav Lesin --- client/mysqlcheck.c | 6 +- client/mysqlslap.c | 5 ++ cmake/maintainer.cmake | 1 + extra/mariabackup/fil_cur.cc | 31 +++++----- extra/mariabackup/fil_cur.h | 4 +- include/my_attribute.h | 8 +-- .../suite/innodb/r/innodb-wl5522-debug.result | 36 ++++------- sql/sql_statistics.cc | 61 ++++++++++--------- sql/threadpool_generic.cc | 9 +++ sql/tztime.cc | 3 + storage/connect/ha_connect.cc | 10 +-- storage/innobase/row/row0quiesce.cc | 33 +++------- storage/maria/ma_loghandler.c | 7 +-- storage/maria/ma_open.c | 2 +- storage/maria/ma_pagecache.c | 2 + storage/maria/ma_recovery.c | 2 + storage/mroonga/CMakeLists.txt | 8 +++ storage/mroonga/vendor/groonga/lib/expr.c | 7 +++ storage/perfschema/unittest/pfs_instr-t.cc | 5 +- storage/rocksdb/CMakeLists.txt | 7 +++ storage/spider/spd_db_conn.cc | 2 + 21 files changed, 130 insertions(+), 119 deletions(-) diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index b5e59e64bd5..0aea15712c3 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -897,6 +897,9 @@ static int disable_binlog() } +/* Ok as mysqlcheck is not multi threaded */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + static int handle_request_for_tables(char *tables, size_t length, my_bool view, my_bool dont_quote) { @@ -1028,9 +1031,6 @@ static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen) insert_dynamic(arr, (uchar*) buf); } -/* Ok as mysqlcheck is not multi threaded */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - static void __attribute__((noinline)) print_result() { MYSQL_RES *res; diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 035a7f0d7ae..17ca5101f6d 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -430,6 +430,8 @@ int main(int argc, char **argv) return 0; } +PRAGMA_DISABLE_CHECK_STACK_FRAME + void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr) { unsigned int x; @@ -525,6 +527,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr) my_free(head_sptr); } +PRAGMA_REENABLE_CHECK_STACK_FRAME static struct my_option my_long_options[] = @@ -2295,6 +2298,7 @@ statement_cleanup(statement *stmt) } } +PRAGMA_DISABLE_CHECK_STACK_FRAME int slap_connect(MYSQL *mysql) @@ -2328,3 +2332,4 @@ slap_connect(MYSQL *mysql) return 0; } +PRAGMA_REENABLE_CHECK_STACK_FRAME diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index f97513cce60..5ca870b771c 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -41,6 +41,7 @@ SET(MY_WARNING_FLAGS -Wvla -Wwrite-strings -Wcast-function-type-strict + -Wframe-larger-than=16384 ) # Warning flags that are in testing before moving diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index ca0619db371..f5033deaf40 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -217,7 +217,10 @@ xb_fil_cur_open( cursor->buf_size = XB_FIL_CUR_PAGES * cursor->page_size; cursor->buf = static_cast(aligned_malloc(cursor->buf_size, srv_page_size)); - + cursor->tmp_page = static_cast(aligned_malloc(srv_page_size, + srv_page_size)); + cursor->tmp_frame = static_cast(aligned_malloc(srv_page_size, + srv_page_size)); cursor->buf_read = 0; cursor->buf_npages = 0; cursor->buf_offset = 0; @@ -245,15 +248,10 @@ xb_fil_cur_open( return(XB_FIL_CUR_SUCCESS); } -/* Stack usage 131224 with clang */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - static bool page_is_corrupted(const byte *page, ulint page_no, const xb_fil_cur_t *cursor, const fil_space_t *space) { - byte tmp_frame[UNIV_PAGE_SIZE_MAX]; - byte tmp_page[UNIV_PAGE_SIZE_MAX]; const ulint page_size = cursor->page_size; uint16_t page_type = fil_page_get_type(page); @@ -316,42 +314,43 @@ static bool page_is_corrupted(const byte *page, ulint page_no, && !opt_extended_validation) return false; - memcpy(tmp_page, page, page_size); + memcpy(cursor->tmp_page, page, page_size); if (!space->crypt_data || space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED - || !fil_space_decrypt(space, tmp_frame, tmp_page)) { + || !fil_space_decrypt(space, cursor->tmp_frame, + cursor->tmp_page)) { return true; } if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { - return buf_page_is_corrupted(false, tmp_page, + return buf_page_is_corrupted(false, cursor->tmp_page, space->flags); } } if (page_type == FIL_PAGE_PAGE_COMPRESSED) { - memcpy(tmp_page, page, page_size); + memcpy(cursor->tmp_page, page, page_size); } if (page_type == FIL_PAGE_PAGE_COMPRESSED || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { - ulint decomp = fil_page_decompress(tmp_frame, tmp_page, + ulint decomp = fil_page_decompress(cursor->tmp_frame, + cursor->tmp_page, space->flags); - page_type = fil_page_get_type(tmp_page); + page_type = fil_page_get_type(cursor->tmp_page); return (!decomp || (decomp != srv_page_size && cursor->zip_size) || page_type == FIL_PAGE_PAGE_COMPRESSED || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED - || buf_page_is_corrupted(false, tmp_page, + || buf_page_is_corrupted(false, cursor->tmp_page, space->flags)); } return buf_page_is_corrupted(false, page, space->flags); } -PRAGMA_REENABLE_CHECK_STACK_FRAME /** Reads and verifies the next block of pages from the source file. Positions the cursor after the last read non-corrupted page. @@ -514,7 +513,11 @@ xb_fil_cur_close( xb_fil_cur_t *cursor) /*!< in/out: source file cursor */ { aligned_free(cursor->buf); + aligned_free(cursor->tmp_page); + aligned_free(cursor->tmp_frame); cursor->buf = NULL; + cursor->tmp_page = NULL; + cursor->tmp_frame = NULL; if (cursor->node != NULL) { xb_fil_node_close_file(cursor->node); diff --git a/extra/mariabackup/fil_cur.h b/extra/mariabackup/fil_cur.h index ac561f71060..641b90fa14e 100644 --- a/extra/mariabackup/fil_cur.h +++ b/extra/mariabackup/fil_cur.h @@ -45,7 +45,9 @@ struct xb_fil_cur_t { xb_read_filt_t* read_filter; /*!< read filter */ xb_read_filt_ctxt_t read_filter_ctxt; /*!< read filter context */ - byte* buf; /*!< read buffer */ + byte* buf; /*!< read buffer of XB_FIL_CUR_PAGES */ + byte* tmp_page; /*!< buffer for decrypting a page */ + byte* tmp_frame; /*!< buffer for decompressing a page */ size_t buf_size; /*!< buffer size in bytes */ size_t buf_read; /*!< number of read bytes in buffer after the last cursor read */ diff --git a/include/my_attribute.h b/include/my_attribute.h index 44b677de66e..2ffd65fae3d 100644 --- a/include/my_attribute.h +++ b/include/my_attribute.h @@ -83,13 +83,13 @@ /* Define pragmas to disable warnings for stack frame checking */ -#if defined(__clang__) +#ifdef __GNUC__ #define PRAGMA_DISABLE_CHECK_STACK_FRAME \ -_Pragma("clang diagnostic push") \ -_Pragma("clang diagnostic ignored \"-Wframe-larger-than=\"") +_Pragma("GCC diagnostic push") \ +_Pragma("GCC diagnostic ignored \"-Wframe-larger-than=\"") #define PRAGMA_REENABLE_CHECK_STACK_FRAME \ -_Pragma("clang diagnostic pop") +_Pragma("GCC diagnostic pop") #else #define PRAGMA_DISABLE_CHECK_STACK_FRAME diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index aa8a683620f..11debaca7d7 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -81,8 +81,7 @@ SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_export_io_write_failure_1"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -91,8 +90,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_2"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -101,8 +99,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_3"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -111,8 +108,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_4"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -121,8 +117,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_5"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -131,8 +126,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_6"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -141,8 +135,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_7"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -151,8 +144,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_8"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -161,8 +153,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_9"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -171,8 +162,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_10"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -181,8 +171,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_11"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; @@ -191,8 +180,7 @@ INSERT INTO t1 VALUES (1); SET SESSION debug_dbug="+d,ib_export_io_write_failure_12"; FLUSH TABLES t1 FOR EXPORT; Warnings: -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed -Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed +Warning 1004 Can't create file './test/t1.cfg' (errno: 9 "Bad file descriptor") UNLOCK TABLES; SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t1; diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index dd7920c1e45..2abc2efa92a 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -2785,9 +2785,6 @@ int collect_statistics_for_table(THD *thd, TABLE *table) After having been updated the statistical system tables are closed. */ -/* Stack usage 20248 from clang */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - int update_statistics_for_table(THD *thd, TABLE *table) { TABLE_LIST tables[STATISTICS_TABLES]; @@ -2816,9 +2813,13 @@ int update_statistics_for_table(THD *thd, TABLE *table) save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); + char statbuf[sizeof(Index_stat)]; + static_assert(sizeof(statbuf) >= sizeof(Table_stat), ""); + static_assert(sizeof(statbuf) >= sizeof(Column_stat), ""); + /* Update the statistical table table_stats */ stat_table= tables[TABLE_STAT].table; - Table_stat table_stat(stat_table, table); + Table_stat &table_stat= *new(statbuf) Table_stat(stat_table, table); restore_record(stat_table, s->default_values); table_stat.set_key_fields(); err= table_stat.update_stat(); @@ -2827,7 +2828,7 @@ int update_statistics_for_table(THD *thd, TABLE *table) /* Update the statistical table colum_stats */ stat_table= tables[COLUMN_STAT].table; - Column_stat column_stat(stat_table, table); + Column_stat &column_stat= *new(statbuf) Column_stat(stat_table, table); for (Field **field_ptr= table->field; *field_ptr; field_ptr++) { Field *table_field= *field_ptr; @@ -2844,7 +2845,7 @@ int update_statistics_for_table(THD *thd, TABLE *table) stat_table= tables[INDEX_STAT].table; uint key; key_map::Iterator it(table->keys_in_use_for_query); - Index_stat index_stat(stat_table, table); + Index_stat &index_stat= *new(statbuf) Index_stat(stat_table, table); while ((key= it++) != key_map::Iterator::BITMAP_END) { @@ -2872,7 +2873,6 @@ int update_statistics_for_table(THD *thd, TABLE *table) new_trans.restore_old_transaction(); DBUG_RETURN(rc); } -PRAGMA_REENABLE_CHECK_STACK_FRAME /** @@ -2957,7 +2957,10 @@ read_statistics_for_table(THD *thd, TABLE *table, /* Read statistics from the statistical table table_stats */ Table_statistics *read_stats= new_stats_cb->table_stats; stat_table= stat_tables[TABLE_STAT].table; - Table_stat table_stat(stat_table, table); + char statbuf[sizeof(Index_stat)]; + static_assert(sizeof(statbuf) >= sizeof(Table_stat), ""); + static_assert(sizeof(statbuf) >= sizeof(Column_stat), ""); + Table_stat &table_stat= *new(statbuf) Table_stat(stat_table, table); table_stat.set_key_fields(); if (table_stat.get_stat_values(new_stats_cb->table_stats)) new_stats_cb->stats_available|= TABLE_STAT_TABLE; @@ -2965,7 +2968,7 @@ read_statistics_for_table(THD *thd, TABLE *table, /* Read statistics from the statistical table column_stats */ stat_table= stat_tables[COLUMN_STAT].table; ulong total_hist_size= 0; - Column_stat column_stat(stat_table, table); + Column_stat &column_stat= *new(statbuf) Column_stat(stat_table, table); Column_statistics *column_statistics= new_stats_cb->table_stats->column_stats; found= 0; for (field_ptr= table_share->field; @@ -2990,7 +2993,7 @@ read_statistics_for_table(THD *thd, TABLE *table, /* Read statistics from the statistical table index_stats */ stat_table= stat_tables[INDEX_STAT].table; - Index_stat index_stat(stat_table, table); + Index_stat &index_stat= *new(statbuf) Index_stat(stat_table, table); Index_statistics *index_statistics= new_stats_cb->table_stats->index_stats; for (key_info= table_share->key_info, key_info_end= key_info + table_share->keys; @@ -3285,9 +3288,6 @@ end: The function is called when executing the statement DROP TABLE 'tab'. */ -/* Stack size 20248 with clang */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab) { @@ -3311,7 +3311,10 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, /* Delete statistics on table from the statistical table index_stats */ stat_table= tables[INDEX_STAT].table; - Index_stat index_stat(stat_table, db, tab); + char statbuf[sizeof(Index_stat)]; + static_assert(sizeof(statbuf) >= sizeof(Table_stat), ""); + static_assert(sizeof(statbuf) >= sizeof(Column_stat), ""); + Index_stat &index_stat= *new(statbuf) Index_stat(stat_table, db, tab); index_stat.set_full_table_name(); while (index_stat.find_next_stat_for_prefix(2)) { @@ -3322,7 +3325,7 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, /* Delete statistics on table from the statistical table column_stats */ stat_table= tables[COLUMN_STAT].table; - Column_stat column_stat(stat_table, db, tab); + Column_stat &column_stat= *new(statbuf) Column_stat(stat_table, db, tab); column_stat.set_full_table_name(); while (column_stat.find_next_stat_for_prefix(2)) { @@ -3333,7 +3336,7 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, /* Delete statistics on table from the statistical table table_stats */ stat_table= tables[TABLE_STAT].table; - Table_stat table_stat(stat_table, db, tab); + Table_stat &table_stat= *new(statbuf) Table_stat(stat_table, db, tab); table_stat.set_key_fields(); if (table_stat.find_stat()) { @@ -3356,7 +3359,6 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db, new_trans.restore_old_transaction(); DBUG_RETURN(rc); } -PRAGMA_REENABLE_CHECK_STACK_FRAME /** @@ -3725,7 +3727,6 @@ int rename_indexes_in_stat_table(THD *thd, TABLE *tab, int rc= 0; uint duplicate_counter= 0; List_iterator it(*indexes); - Alter_info::RENAME_INDEX_STAT_PARAMS *index; char tmp_name_buffer[32]; LEX_CSTRING tmp_name= {tmp_name_buffer, 0}; DBUG_ENTER("rename_indexes_in_stat_tables"); @@ -3746,15 +3747,16 @@ int rename_indexes_in_stat_table(THD *thd, TABLE *tab, /* Rename index in the statistical table index_stat */ stat_table= tables.table; + char statbuf[sizeof(Index_stat)]; /* Loop over all indexes and rename to new name or temp name in case of conflicts */ - while ((index= it++)) + while (Alter_info::RENAME_INDEX_STAT_PARAMS *index= it++) { - Index_stat index_stat(stat_table, tab); + Index_stat &index_stat= *new(statbuf) Index_stat(stat_table, tab); uint found= 0; /* We have to make a loop as one index may have many entries */ @@ -3822,12 +3824,11 @@ int rename_indexes_in_stat_table(THD *thd, TABLE *tab, the final name. */ - Alter_info::RENAME_INDEX_STAT_PARAMS *index; it.rewind(); - Index_stat index_stat(stat_table, tab); + Index_stat &index_stat= *new(statbuf) Index_stat(stat_table, tab); stat_table->file->ha_index_init(index_stat.stat_key_idx, 0); - while ((index= it++)) + while (Alter_info::RENAME_INDEX_STAT_PARAMS *index= it++) { int err __attribute__((unused)); @@ -3901,9 +3902,6 @@ int rename_indexes_in_stat_table(THD *thd, TABLE *tab, The function is called when executing any statement that renames a table */ -/* Stack size 20968 with clang */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *tab, const LEX_CSTRING *new_db, @@ -3928,7 +3926,11 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, /* Rename table in the statistical table index_stats */ stat_table= tables[INDEX_STAT].table; - Index_stat index_stat(stat_table, db, tab); + char statbuf[sizeof(Index_stat)]; + static_assert(sizeof(statbuf) >= sizeof(Table_stat), ""); + static_assert(sizeof(statbuf) >= sizeof(Column_stat), ""); + + Index_stat &index_stat= *new(statbuf) Index_stat(stat_table, db, tab); index_stat.set_full_table_name(); Stat_table_write_iter index_iter(&index_stat); @@ -3945,7 +3947,7 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, /* Rename table in the statistical table column_stats */ stat_table= tables[COLUMN_STAT].table; - Column_stat column_stat(stat_table, db, tab); + Column_stat &column_stat= *new(statbuf) Column_stat(stat_table, db, tab); column_stat.set_full_table_name(); Stat_table_write_iter column_iter(&column_stat); if (column_iter.init(2)) @@ -3961,7 +3963,7 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, /* Rename table in the statistical table table_stats */ stat_table= tables[TABLE_STAT].table; - Table_stat table_stat(stat_table, db, tab); + Table_stat &table_stat= *new(statbuf) Table_stat(stat_table, db, tab); table_stat.set_key_fields(); if (table_stat.find_stat()) { @@ -3981,7 +3983,6 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, new_trans.restore_old_transaction(); DBUG_RETURN(rc); } -PRAGMA_REENABLE_CHECK_STACK_FRAME /** diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index 0a653474ffa..89d2a26d16a 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -715,6 +715,10 @@ static void stop_timer(pool_timer_t *timer) @return a ready connection, or NULL on shutdown */ + +/* ev[MAX_EVENTS] may bloat the stack frame beyond 16 KiB */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + static TP_connection_generic * listener(worker_thread_t *current_thread, thread_group_t *thread_group) { @@ -830,6 +834,7 @@ static TP_connection_generic * listener(worker_thread_t *current_thread, DBUG_RETURN(retval); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** Adjust thread counters in group or global @@ -1157,6 +1162,9 @@ static bool too_many_threads(thread_group_t *thread_group) NULL is returned if timeout has expired,or on shutdown. */ +/* ev[MAX_EVENTS] may bloat the stack frame beyond 16 KiB */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + TP_connection_generic *get_event(worker_thread_t *current_thread, thread_group_t *thread_group, struct timespec *abstime) { @@ -1262,6 +1270,7 @@ TP_connection_generic *get_event(worker_thread_t *current_thread, DBUG_RETURN(connection); } +PRAGMA_REENABLE_CHECK_STACK_FRAME diff --git a/sql/tztime.cc b/sql/tztime.cc index 68d63ca7beb..d690ba8c505 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2287,6 +2287,8 @@ str_to_offset(const char *str, uint length, long *offset) specification or other error. */ +PRAGMA_DISABLE_CHECK_STACK_FRAME + Time_zone * my_tz_find(THD *thd, const String *name) { @@ -2355,6 +2357,7 @@ my_tz_find(THD *thd, const String *name) DBUG_RETURN(result_tz); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /** diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index f91e7ee5f94..64d1ece8150 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -7010,9 +7010,6 @@ PRAGMA_REENABLE_CHECK_STACK_FRAME - user has file privilege */ -/* Stack size 16664 in clang */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - bool ha_connect::FileExists(const char *fn, bool bf) { if (!fn || !*fn) @@ -7048,10 +7045,8 @@ bool ha_connect::FileExists(const char *fn, bool bf) if (n < 0) { if (errno != ENOENT) { - char buf[_MAX_PATH + 20]; - - snprintf(buf, sizeof(buf), "Error %d for file %s", errno, filename); - push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, 0, buf); + push_warning_printf(table->in_use, Sql_condition::WARN_LEVEL_WARN, 0, + "Error %d for file %s", errno, filename); return true; } else return false; @@ -7063,7 +7058,6 @@ bool ha_connect::FileExists(const char *fn, bool bf) return true; } // end of FileExists -PRAGMA_REENABLE_CHECK_STACK_FRAME // Called by SameString and NoFieldOptionChange bool ha_connect::CheckString(PCSZ str1, PCSZ str2) diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index 057b20c77bd..1f3234546a4 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -432,9 +432,6 @@ row_quiesce_write_header( Write the table meta data after quiesce. @return DB_SUCCESS or error code */ -/* Stack size 20904 with clang */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_quiesce_write_cfg( @@ -452,9 +449,10 @@ row_quiesce_write_cfg( FILE* file = fopen(name, "w+b"); - if (file == NULL) { - ib_errf(thd, IB_LOG_LEVEL_WARN, ER_CANT_CREATE_FILE, - name, errno, strerror(errno)); + if (!file) { +fail: + ib_senderrf(thd, IB_LOG_LEVEL_WARN, ER_CANT_CREATE_FILE, + name, errno, strerror(errno)); err = DB_IO_ERROR; } else { @@ -468,31 +466,18 @@ row_quiesce_write_cfg( err = row_quiesce_write_indexes(table, file, thd); } - if (fflush(file) != 0) { - - char msg[BUFSIZ]; - - snprintf(msg, sizeof(msg), "%s flush() failed", name); - - ib_senderrf( - thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR, - (ulong) errno, strerror(errno), msg); + if (fflush(file)) { + std::ignore = fclose(file); + goto fail; } - if (fclose(file) != 0) { - char msg[BUFSIZ]; - - snprintf(msg, sizeof(msg), "%s flose() failed", name); - - ib_senderrf( - thd, IB_LOG_LEVEL_WARN, ER_IO_WRITE_ERROR, - (ulong) errno, strerror(errno), msg); + if (fclose(file)) { + goto fail; } } return(err); } -PRAGMA_REENABLE_CHECK_STACK_FRAME /*********************************************************************//** Check whether a table has an FTS index defined on it. diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 786b397ef6c..3681a59a0e6 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -3605,9 +3605,6 @@ static my_bool translog_is_LSN_chunk(uchar type) @retval 1 Error */ -/* Stack size 26120 from clang */ -PRAGMA_DISABLE_CHECK_STACK_FRAME - my_bool translog_init_with_table(const char *directory, uint32 log_file_max_size, uint32 server_version, @@ -3861,6 +3858,7 @@ my_bool translog_init_with_table(const char *directory, if (logs_found) { + TRANSLOG_PAGE_SIZE_BUFF psize_buff; TRANSLOG_ADDRESS current_page= sure_page; my_bool pageok; @@ -3901,7 +3899,6 @@ my_bool translog_init_with_table(const char *directory, do { TRANSLOG_VALIDATOR_DATA data; - TRANSLOG_PAGE_SIZE_BUFF psize_buff; uchar *page; data.addr= ¤t_page; if ((page= translog_get_page(&data, psize_buff.buffer, NULL)) == NULL) @@ -3950,7 +3947,6 @@ my_bool translog_init_with_table(const char *directory, if (logs_found && !old_log_was_recovered && old_flags == flags) { TRANSLOG_VALIDATOR_DATA data; - TRANSLOG_PAGE_SIZE_BUFF psize_buff; uchar *page; uint16 chunk_offset; data.addr= &last_valid_page; @@ -4241,7 +4237,6 @@ err: ma_message_no_user(0, "log initialization failed"); DBUG_RETURN(1); } -PRAGMA_REENABLE_CHECK_STACK_FRAME /* diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index 39a16ea5df4..71d8d3eac10 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -1558,7 +1558,7 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite) @retval 1 Error */ -/* Stack size 26376 from clang */ +/* MARIA_STATE_INFO_SIZE + MARIA_STATE_EXTRA_SIZE == 25559 */ PRAGMA_DISABLE_CHECK_STACK_FRAME uint _ma_state_info_write_sub(File file, MARIA_STATE_INFO *state, uint pWrite) diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 1682bd42893..1e151bc250b 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -4913,6 +4913,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache, @retval PCFLUSH_PINNED Pinned blocks was met and skipped. @retval PCFLUSH_PINNED_AND_ERROR PCFLUSH_ERROR and PCFLUSH_PINNED. */ +PRAGMA_DISABLE_CHECK_STACK_FRAME static int flush_pagecache_blocks_int(PAGECACHE *pagecache, PAGECACHE_FILE *file, @@ -5242,6 +5243,7 @@ int flush_pagecache_blocks_with_filter(PAGECACHE *pagecache, pagecache_pthread_mutex_unlock(&pagecache->cache_lock); DBUG_RETURN(res); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /* diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index df9b2024086..3a7e2f39a30 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -277,6 +277,7 @@ int maria_recovery_from_log(void) @retval 0 OK @retval !=0 Error */ +PRAGMA_DISABLE_CHECK_STACK_FRAME int maria_apply_log(LSN from_lsn, LSN end_redo_lsn, LSN end_undo_lsn, enum maria_apply_log_way apply, @@ -562,6 +563,7 @@ end: */ DBUG_RETURN(error); } +PRAGMA_REENABLE_CHECK_STACK_FRAME /* very basic info about the record's header */ diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt index e53568bc591..04935529e02 100644 --- a/storage/mroonga/CMakeLists.txt +++ b/storage/mroonga/CMakeLists.txt @@ -49,6 +49,14 @@ if(MSVC) message(FATAL_ERROR ${MRN_OLD_MSVC_MESSAGE}) endif() endif() +else() + STRING(REGEX REPLACE "-Wframe-larger-than=[0-9]*" "" + CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + STRING(REGEX REPLACE "-Wframe-larger-than=[0-9]*" "" + CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + STRING(REGEX REPLACE "-Wframe-larger-than=[0-9]*" "" + CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + MY_CHECK_AND_SET_COMPILER_FLAG(-Wframe-larger-than=49152) endif() if(MRN_BUNDLED) diff --git a/storage/mroonga/vendor/groonga/lib/expr.c b/storage/mroonga/vendor/groonga/lib/expr.c index b4de00b2406..f3e59abf5eb 100644 --- a/storage/mroonga/vendor/groonga/lib/expr.c +++ b/storage/mroonga/vendor/groonga/lib/expr.c @@ -2459,6 +2459,10 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller) } \ } while (0) +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wframe-larger-than=" +#endif inline static void grn_expr_exec_get_member_vector(grn_ctx *ctx, grn_obj *expr, @@ -3834,6 +3838,9 @@ exit : } GRN_API_RETURN(val); } +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif grn_obj * grn_expr_get_value(grn_ctx *ctx, grn_obj *expr, int offset) diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc index 55c4f61997b..90f1cb4bf99 100644 --- a/storage/perfschema/unittest/pfs_instr-t.cc +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -86,8 +86,6 @@ void test_no_instruments() cleanup_instruments(); } -PRAGMA_DISABLE_CHECK_STACK_FRAME - void test_no_instances() { int rc; @@ -218,7 +216,7 @@ void test_no_instances() ok(file == NULL, "no file"); ok(global_file_container.m_lost == 4, "lost 4"); - char long_file_name[10000]; + char long_file_name[5000]; int size= sizeof(long_file_name); memset(long_file_name, 'X', size); @@ -247,7 +245,6 @@ void test_no_instances() cleanup_file_hash(); cleanup_instruments(); } -PRAGMA_REENABLE_CHECK_STACK_FRAME void test_with_instances() { diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index 3ebeb66e8d0..630f445f065 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -9,6 +9,13 @@ SET(CPACK_RPM_rocksdb-engine_PACKAGE_SUMMARY "RocksDB storage engine for MariaDB SET(CPACK_RPM_rocksdb-engine_PACKAGE_DESCRIPTION "The RocksDB storage engine is a high performance storage engine, aimed at maximising storage efficiency while maintaining InnoDB-like performance." PARENT_SCOPE) +STRING(REGEX REPLACE "-Wframe-larger-than=[0-9]*" "" + CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +STRING(REGEX REPLACE "-Wframe-larger-than=[0-9]*" "" + CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +STRING(REGEX REPLACE "-Wframe-larger-than=[0-9]*" "" + CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") +MY_CHECK_AND_SET_COMPILER_FLAG(-Wframe-larger-than=32768) MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-range-loop-construct) MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-effc++ DEBUG RELWITHDEBINFO) diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 4252619617f..5e2dad0535e 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -10454,6 +10454,7 @@ error: } +PRAGMA_DISABLE_CHECK_STACK_FRAME bool spider_db_conn_is_network_error( int error_num ) { @@ -10470,3 +10471,4 @@ bool spider_db_conn_is_network_error( } DBUG_RETURN(FALSE); } +PRAGMA_REENABLE_CHECK_STACK_FRAME From a96367bc670a0cdf876a3662df6e1cff98cbb467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 8 May 2025 11:58:31 +0300 Subject: [PATCH 24/89] MDEV-36620 post-fix: galera_toi_ddl_nonconflicting test failure Add wait_condition to wait until all inserted rows are replicated so that show create table is deterministic. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test index 9836aaa57ef..cc65e6bda9d 100644 --- a/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test +++ b/mysql-test/suite/galera/t/galera_toi_ddl_nonconflicting.test @@ -61,6 +61,8 @@ SET SESSION wsrep_sync_wait=0; --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1001 FROM t1; +--source include/wait_condition.inc SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; @@ -72,6 +74,8 @@ SELECT COUNT(*) AS EXPECT_1001 FROM t1; --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1001 FROM t1; +--source include/wait_condition.inc SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1'; From d38558f99b2c140d1d02590774595350bebd6c29 Mon Sep 17 00:00:00 2001 From: Hemant Dangi Date: Tue, 29 Apr 2025 18:31:13 +0530 Subject: [PATCH 25/89] MDEV-36117: MDL BF-BF conflict on ALTER and UPDATE with multi-level foreign key parents Issue: Mariadb acquires additional MDL locks on UPDATE/INSERT/DELETE statements on table with foreign keys. For example, table t1 references t2, an UPDATE to t1 will MDL lock t2 in addition to t1. A replica may deliver an ALTER t1 and UPDATE t2 concurrently for applying. Then the UPDATE may acquire MDL lock for t1, followed by a conflict when the ALTER attempts to MDL lock on t1. Causing a BF-BF conflict. Solution: Additional keys for the referenced/foreign table needs to be added to avoid potential MDL conflicts with concurrent update and DDLs. Signed-off-by: Julius Goryavsky --- .../r/galera_multi_level_fk_ddl_delete.result | 362 ++++++++++++++ .../r/galera_multi_level_fk_ddl_update.result | 358 ++++++++++++++ .../t/galera_multi_level_fk_ddl_delete.test | 452 ++++++++++++++++++ .../t/galera_multi_level_fk_ddl_update.test | 451 +++++++++++++++++ .../t/galera_multi_level_foreign_key.inc | 60 +++ sql/sql_base.cc | 17 +- sql/sql_prepare.cc | 28 +- sql/wsrep_mysqld.cc | 33 ++ sql/wsrep_mysqld.h | 10 + 9 files changed, 1758 insertions(+), 13 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_multi_level_fk_ddl_delete.result create mode 100644 mysql-test/suite/galera/r/galera_multi_level_fk_ddl_update.result create mode 100644 mysql-test/suite/galera/t/galera_multi_level_fk_ddl_delete.test create mode 100644 mysql-test/suite/galera/t/galera_multi_level_fk_ddl_update.test create mode 100644 mysql-test/suite/galera/t/galera_multi_level_foreign_key.inc diff --git a/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_delete.result b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_delete.result new file mode 100644 index 00000000000..4199fdcd011 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_delete.result @@ -0,0 +1,362 @@ +connection node_2; +connection node_1; +# +# 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and DELETE on t1 +# with foreign key references as below: +# - t1<-t2<-t3<-t4 +# - t3<-t5 +# - t2<-t6 +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +t5_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, +KEY key_t5_id(t5_id) +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id), +CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t4 ( +id INT PRIMARY KEY, +t3_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id(t3_id), +CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t5 ( +id INT PRIMARY KEY, +t3_id_1 INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id_1(t3_id_1), +CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t6 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id_1(t2_id), +CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_1; +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +DROP TABLE t6; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 4 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +include/assert_grep.inc [Foreign key referenced table found: test.t4] +include/assert_grep.inc [Foreign key referenced table found: test.t5] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; +# +# 2. BF-BF conflict on MDL locks between: +# ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# DELETE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id) +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 3. BF-BF conflict on MDL locks between: +# CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# DELETE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE); +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 4. BF-BF conflict on MDL locks between: +# OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +# DELETE on t1. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +DELETE FROM t1 WHERE id = 3; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 1 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +connection node_2; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +connection node_1; +select * from t1; +id f2 +1 0 +2 0 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_update.result b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_update.result new file mode 100644 index 00000000000..9c8a34e7dd7 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_multi_level_fk_ddl_update.result @@ -0,0 +1,358 @@ +connection node_2; +connection node_1; +# +# 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and UPDATE on t1 +# with foreign key references as below: +# - t1<-t2<-t3<-t4 +# - t3<-t5 +# - t2<-t6 +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +t5_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, +KEY key_t5_id(t5_id) +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id), +CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t4 ( +id INT PRIMARY KEY, +t3_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id(t3_id), +CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t5 ( +id INT PRIMARY KEY, +t3_id_1 INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t3_id_1(t3_id_1), +CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t6 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id_1(t2_id), +CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_1; +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +DROP TABLE t6; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 4 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +include/assert_grep.inc [Foreign key referenced table found: test.t4] +include/assert_grep.inc [Foreign key referenced table found: test.t5] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id t5_id f2 +1 1 1 1234 +2 2 2 1234 +select * from t3; +id t2_id f2 +1 1 1234 +2 2 1234 +select * from t4; +id t3_id f2 +1 1 1234 +2 2 1234 +select * from t5; +id t3_id_1 f2 +1 1 1234 +2 2 1234 +select * from t6; +ERROR 42S02: Table 'test.t6' doesn't exist +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; +# +# 2. BF-BF conflict on MDL locks between: +# ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +CREATE TABLE t3 ( +id INT PRIMARY KEY, +t2_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t2_id(t2_id) +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE; +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 3. BF-BF conflict on MDL locks between: +# CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +# UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE); +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 2 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +include/assert_grep.inc [Foreign key referenced table found: test.t3] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +select * from t3; +id t2_id f2 +DROP TABLE t3, t2, t1; +# +# 4. BF-BF conflict on MDL locks between: +# OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +# UPDATE on t1. +# +connection node_2; +SET GLOBAL wsrep_slave_threads=2; +CREATE TABLE t1 ( +id INTEGER PRIMARY KEY, +f2 INTEGER +); +CREATE TABLE t2 ( +id INT PRIMARY KEY, +t1_id INT NOT NULL, +f2 INTEGER NOT NULL, +KEY key_t1_id(t1_id), +CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); +connection node_2; +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; +connection node_1; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize note Table does not support optimize, doing recreate + analyze instead +test.t2 optimize status OK +connection node_2; +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +UPDATE t1 SET f2 = 1 WHERE id=2; +COMMIT; +connection node_2; +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; +connection node_1; +include/assert_grep.inc [Foreign key referenced table found: 1 tables] +include/assert_grep.inc [Foreign key referenced table found: test.t2] +connection node_2; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +connection node_1; +select * from t1; +id f2 +1 0 +2 1 +select * from t2; +id t1_id f2 +1 1 1234 +2 2 1234 +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_delete.test b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_delete.test new file mode 100644 index 00000000000..b1c3e6d5352 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_delete.test @@ -0,0 +1,452 @@ +# +# BF-BF conflict on MDL locks between DDL and delete query +# when multi-level foreign key like t3 -> t2 -> t1 +# are present. +# +# If bug is present, expect the wait condition +# to timeout and when the DELETE applies, it +# will be granted a MDL lock of type SHARED_READ +# for table t1. When resumed, the DROP TABLE will +# also try to MDL lock t1, causing a BF-BF conflict +# on that MDL lock. + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--echo # +--echo # 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and DELETE on t1 +--echo # with foreign key references as below: +--echo # - t1<-t2<-t3<-t4 +--echo # - t3<-t5 +--echo # - t2<-t6 +--echo # + + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + t5_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, + KEY key_t5_id(t5_id) +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id), + CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t4 ( + id INT PRIMARY KEY, + t3_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id(t3_id), + CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t5 ( + id INT PRIMARY KEY, + t3_id_1 INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id_1(t3_id_1), + CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t6 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id_1(t2_id), + CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); + +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); + +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); + +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); + +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = "t2" AND CONSTRAINT_TYPE = "FOREIGN KEY" AND CONSTRAINT_NAME="key_t5_id" +--source include/wait_condition.inc + + +--let $fk_parent_query = DROP TABLE t6 +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 5 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 4 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t4 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t4 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t5 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t5 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + + +# +# Cleanup +# +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; + + +--echo # +--echo # 2. BF-BF conflict on MDL locks between: +--echo # ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # DELETE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id) +); + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +# +# ALTER TABLE t3 and wait for it to reach node_2 +# +--let $fk_parent_query = ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +# +# Issue a DELETE to table that references t1 +# +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 6 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and alter table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 3. BF-BF conflict on MDL locks between: +--echo # CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # DELETE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE) +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 8 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and create table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 4. BF-BF conflict on MDL locks between: +--echo # OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +--echo # DELETE on t1. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); +INSERT INTO t1 VALUES (3,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = OPTIMIZE TABLE t2 +--let $fk_child_query = DELETE FROM t1 WHERE id = 3 +--let $fk_mdl_lock_num = 2 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 1 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 9 +--let assert_select= Foreign key referenced table found: +--let $assert_only_after = CURRENT_TEST: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_delete +--source include/assert_grep.inc + + +# +# Verify delete and create table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1 +--source include/wait_condition.inc + + +select * from t1; +select * from t2; + +--connection node_1 +select * from t1; +select * from t2; + + +# +# Cleanup +# +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_update.test b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_update.test new file mode 100644 index 00000000000..1dea0021901 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multi_level_fk_ddl_update.test @@ -0,0 +1,451 @@ +# +# BF-BF conflict on MDL locks between DDL and update query +# when multi-level foreign key like t3 -> t2 -> t1 +# are present. +# +# If bug is present, expect the wait condition +# to timeout and when the UPDATE applies, it +# will be granted a MDL lock of type SHARED_READ +# for table t1. When resumed, the DROP TABLE will +# also try to MDL lock t1, causing a BF-BF conflict +# on that MDL lock. + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +--echo # +--echo # 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and UPDATE on t1 +--echo # with foreign key references as below: +--echo # - t1<-t2<-t3<-t4 +--echo # - t3<-t5 +--echo # - t2<-t6 +--echo # + + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + t5_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE, + KEY key_t5_id(t5_id) +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id), + CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t4 ( + id INT PRIMARY KEY, + t3_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id(t3_id), + CONSTRAINT key_t3_id FOREIGN KEY (t3_id) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t5 ( + id INT PRIMARY KEY, + t3_id_1 INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t3_id_1(t3_id_1), + CONSTRAINT key_t3_id_1 FOREIGN KEY (t3_id_1) REFERENCES t3 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t6 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id_1(t2_id), + CONSTRAINT key_t2_id_1 FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1,1234); +INSERT INTO t2 VALUES (2,2,2,1234); + +INSERT INTO t3 VALUES (1,1,1234); +INSERT INTO t3 VALUES (2,2,1234); + +INSERT INTO t4 VALUES (1,1,1234); +INSERT INTO t4 VALUES (2,2,1234); + +INSERT INTO t5 VALUES (1,1,1234); +INSERT INTO t5 VALUES (2,2,1234); + +ALTER TABLE t2 ADD CONSTRAINT key_t5_id FOREIGN KEY (t5_id) +REFERENCES t5 (id) ON UPDATE CASCADE ON DELETE CASCADE; + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = "t2" AND CONSTRAINT_TYPE = "FOREIGN KEY" AND CONSTRAINT_NAME="key_t5_id" +--source include/wait_condition.inc + + +--let $fk_parent_query = DROP TABLE t6 +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 5 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 4 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t4 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t4 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t5 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 1 +--let assert_select= Foreign key referenced table found: test.t5 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; +select * from t4; +select * from t5; +--error ER_NO_SUCH_TABLE +select * from t6; + + +# +# Cleanup +# +ALTER TABLE t2 DROP FOREIGN KEY key_t5_id; +DROP TABLE t5, t4, t3, t2, t1; + + +--echo # +--echo # 2. BF-BF conflict on MDL locks between: +--echo # ALTER TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + +CREATE TABLE t3 ( + id INT PRIMARY KEY, + t2_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t2_id(t2_id) +); + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +# +# ALTER TABLE t3 and wait for it to reach node_2 +# +--let $fk_parent_query = ALTER TABLE t3 ADD CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE +# +# Issue a UPDATE to table that references t1 +# Notice that we update field f2, not the primary key, +# and not foreign key. Bug does not manifest if we update +# one of those fields (because FK keys appended in those cases). +# +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 6 +--let assert_select= Foreign key referenced table found: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 2 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 3. BF-BF conflict on MDL locks between: +--echo # CREATE TABLE t3 (whose parent table are t3 -> t2 -> t1), and +--echo # UPDATE on t1 with t2 referencing t1, and t3 referencing t2. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT NOT NULL, f2 INTEGER NOT NULL, KEY key_t2_id(t2_id), CONSTRAINT key_t2_id FOREIGN KEY (t2_id) REFERENCES t2 (id) ON UPDATE CASCADE ON DELETE CASCADE) +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 3 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 2 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 8 +--let assert_select= Foreign key referenced table found: +--let $assert_only_after = CURRENT_TEST: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t3 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 3 +--let assert_select= Foreign key referenced table found: test.t3 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update and drop table has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; +select * from t3; + +--connection node_1 +select * from t1; +select * from t2; +select * from t3; + + +# +# Cleanup +# +DROP TABLE t3, t2, t1; + + +--echo # +--echo # 4. BF-BF conflict on MDL locks between: +--echo # OPTIMIZE TABLE t2 (whose parent table are t2 -> t1), and +--echo # UPDATE on t1. +--echo # + +# +# Setup +# +--connection node_2 +SET GLOBAL wsrep_slave_threads=2; + +CREATE TABLE t1 ( + id INTEGER PRIMARY KEY, + f2 INTEGER +); + +CREATE TABLE t2 ( + id INT PRIMARY KEY, + t1_id INT NOT NULL, + f2 INTEGER NOT NULL, + KEY key_t1_id(t1_id), + CONSTRAINT key_t1_id FOREIGN KEY (t1_id) REFERENCES t1 (id) ON UPDATE CASCADE ON DELETE CASCADE +); + + +INSERT INTO t1 VALUES (1,0); +INSERT INTO t1 VALUES (2,0); + +INSERT INTO t2 VALUES (1,1,1234); +INSERT INTO t2 VALUES (2,2,1234); + + +--let $fk_parent_query = OPTIMIZE TABLE t2 +--let $fk_child_query = UPDATE t1 SET f2 = 1 WHERE id=2 +--let $fk_mdl_lock_num = 2 +--source galera_multi_level_foreign_key.inc + + +# +# Verify Foreign key for referenced table added. +# +--connection node_1 +--let assert_text= Foreign key referenced table found: 1 tables +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 9 +--let assert_select= Foreign key referenced table found: +--let $assert_only_after = CURRENT_TEST: +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + +--let assert_text= Foreign key referenced table found: test.t2 +--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let assert_count= 4 +--let assert_select= Foreign key referenced table found: test.t2 +--let assert_only_after= CURRENT_TEST: galera.galera_multi_level_fk_ddl_update +--source include/assert_grep.inc + + +# +# Verify update has succeded. +# +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1 where id=2 and f2=1; +--source include/wait_condition.inc + +select * from t1; +select * from t2; + +--connection node_1 +select * from t1; +select * from t2; + + +# +# Cleanup +# +DROP TABLE t2, t1; diff --git a/mysql-test/suite/galera/t/galera_multi_level_foreign_key.inc b/mysql-test/suite/galera/t/galera_multi_level_foreign_key.inc new file mode 100644 index 00000000000..598019b0a43 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_multi_level_foreign_key.inc @@ -0,0 +1,60 @@ +# +# Execute parent query on node_1 and wait for it to reach node_2 +# +--connection node_2 +SET GLOBAL DEBUG_DBUG = '+d,sync.wsrep_apply_toi'; + +--connection node_1 +--eval $fk_parent_query + +--connection node_2 +SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_toi_reached"; + +SET SESSION wsrep_sync_wait = 0; +--let $expected_apply_waits = query_get_value("SHOW STATUS LIKE 'wsrep_apply_waits'", Value, 1) +--let $expected_apply_waits = `select $expected_apply_waits + 1` + + +# +# Execute child query on node_1. +# If bug is present, expect the wait condition +# to timeout and when the child query applies, it +# will be granted a MDL lock on parent table. +# When resumed, the parent query will +# also try to acquire MDL lock on parent table, +# causing a BF-BF conflict on that MDL lock. +# +--connection node_1 +SET GLOBAL DEBUG_DBUG = '+d,wsrep_print_foreign_keys_table'; +START TRANSACTION; +--eval $fk_child_query +--let $wait_condition = SELECT COUNT(*) = $fk_mdl_lock_num FROM performance_schema.metadata_locks WHERE OBJECT_SCHEMA='test' AND LOCK_STATUS="GRANTED" +--source include/wait_condition.inc +COMMIT; + + +# +# Expect the child query to depend on the parent query, +# therefore it should wait for the parent query to +# finish before it can be applied. +# +--connection node_2 +--let $status_var = wsrep_apply_waits +--let $status_var_value = $expected_apply_waits +--source include/wait_for_status_var.inc + +SET GLOBAL DEBUG_DBUG = '-d,sync.wsrep_apply_toi'; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_toi"; + + +# +# Cleanup +# +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; + +--connection node_1 +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL DEBUG_DBUG = ""; +SET GLOBAL wsrep_slave_threads=DEFAULT; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 713a0b455e9..1a4fa315c3c 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4804,6 +4804,7 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx, FOREIGN_KEY_INFO *fk; Query_arena *arena, backup; TABLE *table= table_list->table; + bool error= FALSE; if (!table->file->referenced_by_foreign_key()) DBUG_RETURN(FALSE); @@ -4844,10 +4845,24 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx, table_list->belong_to_view, op, &prelocking_ctx->query_tables_last, table_list->for_insert_data); + +#ifdef WITH_WSREP + /* + Append table level shared key for the referenced/foreign table for: + - statement that updates existing rows (UPDATE, multi-update) + - statement that deletes existing rows (DELETE, DELETE_MULTI) + This is done to avoid potential MDL conflicts with concurrent DDLs. + */ + if (wsrep_foreign_key_append(thd, fk)) + { + error= TRUE; + break; + } +#endif // WITH_WSREP } if (arena) thd->restore_active_arena(arena, &backup); - DBUG_RETURN(FALSE); + DBUG_RETURN(error); } /** diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index f39b0e23e58..059e3d7c510 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2475,18 +2475,8 @@ static bool check_prepared_statement(Prepared_statement *stmt) } #ifdef WITH_WSREP - if (wsrep_sync_wait(thd, sql_command)) - goto error; - if (!stmt->is_sql_prepare()) - { - wsrep_after_command_before_result(thd); - if (wsrep_current_error(thd)) - { - wsrep_override_error(thd, wsrep_current_error(thd), - wsrep_current_error_status(thd)); - goto error; - } - } + if (wsrep_sync_wait(thd, sql_command)) + goto error; #endif switch (sql_command) { case SQLCOM_REPLACE: @@ -2710,6 +2700,20 @@ static bool check_prepared_statement(Prepared_statement *stmt) default: break; } + +#ifdef WITH_WSREP + if (!stmt->is_sql_prepare()) + { + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd)) + { + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + goto error; + } + } +#endif + if (res == 0) { if (!stmt->is_sql_prepare()) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index e2d61325847..469cbc9da2d 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -4052,3 +4052,36 @@ bool wsrep_table_list_has_non_temp_tables(THD *thd, TABLE_LIST *tables) } return false; } + +bool wsrep_foreign_key_append(THD *thd, FOREIGN_KEY_INFO *fk) +{ + if (WSREP(thd) && !thd->wsrep_applier && + wsrep_is_active(thd) && + (sql_command_flags[thd->lex->sql_command] & + (CF_UPDATES_DATA | CF_DELETES_DATA))) + { + wsrep::key key(wsrep::key::shared); + key.append_key_part(fk->foreign_db->str, fk->foreign_db->length); + key.append_key_part(fk->foreign_table->str, fk->foreign_table->length); + + if (thd->wsrep_cs().append_key(key)) + { + WSREP_ERROR("Appending table key failed: %s", + wsrep_thd_query(thd)); + sql_print_information("Failed Foreign key referenced table found: " + "%s.%s", + fk->foreign_db->str, + fk->foreign_table->str); + return true; + } + + DBUG_EXECUTE_IF( + "wsrep_print_foreign_keys_table", + sql_print_information("Foreign key referenced table found: %s.%s", + fk->foreign_db->str, + fk->foreign_table->str); + ); + } + + return false; +} diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 02df7bf5ed5..389bedda30a 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -599,6 +599,16 @@ void wsrep_ready_set(bool ready_value); */ bool wsrep_table_list_has_non_temp_tables(THD *thd, TABLE_LIST *tables); +/** + * Append foreign key to wsrep. + * + * @param thd Thread object + * @param fk Foreign Key Info + * + * @return true if error, otherwise false. + */ +bool wsrep_foreign_key_append(THD *thd, FOREIGN_KEY_INFO *fk); + #else /* !WITH_WSREP */ /* These macros are needed to compile MariaDB without WSREP support From 7fd5957d55697cdafda9df3298ed36f899469c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 6 May 2025 08:15:36 +0300 Subject: [PATCH 26/89] MDEV-36622 : Hang during galera_evs_suspect_timeout test Test changes only. Add wait_condition so that all nodes are in the expected state and add debug output if issue does reproduce. Signed-off-by: Julius Goryavsky --- .../r/galera_evs_suspect_timeout.result | 5 ++++- .../galera_3nodes/t/galera_evs_suspect_timeout.cnf | 4 ++++ .../t/galera_evs_suspect_timeout.test | 14 ++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.cnf diff --git a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result index 2ecd5edfa99..5faa862ddb6 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result +++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result @@ -12,10 +12,12 @@ connection node_3; Suspending node ... connection node_1; SET SESSION wsrep_sync_wait=0; +connection node_2; +SET SESSION wsrep_sync_wait=0; +connection node_1; CREATE TABLE t1 (f1 INTEGER) engine=InnoDB; INSERT INTO t1 VALUES (1); connection node_2; -SET SESSION wsrep_sync_wait=0; SET SESSION wsrep_sync_wait = 15; SELECT COUNT(*) FROM t1; COUNT(*) @@ -29,4 +31,5 @@ SELECT COUNT(*) FROM t1; COUNT(*) 1 connection node_1; +connection node_2; DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.cnf b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.cnf new file mode 100644 index 00000000000..bc8942624d2 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-debug=1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test index c36cce61f23..0b270385d24 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test +++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test @@ -43,6 +43,12 @@ SET SESSION wsrep_sync_wait=0; --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc +--connection node_2 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_1 --disable_query_log --eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node1'; --enable_query_log @@ -52,10 +58,6 @@ CREATE TABLE t1 (f1 INTEGER) engine=InnoDB; INSERT INTO t1 VALUES (1); --connection node_2 -SET SESSION wsrep_sync_wait=0; ---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' ---source include/wait_condition.inc - --disable_query_log --eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2'; --enable_query_log @@ -86,6 +88,10 @@ SELECT COUNT(*) FROM t1; --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + DROP TABLE t1; # Restore original auto_increment_offset values. From 7aed06887bc901afd84647cd8c3530b2e0a2ac80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 28 Apr 2025 10:27:19 +0300 Subject: [PATCH 27/89] MDEV-36512 : galera_3nodes.GCF-354: certification position less than last committed Test changes only. Both warnings are expected and should be suppressed because we intentionally inject different inconsistencies on two nodes and then join them back with membership change. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera_3nodes/r/GCF-354.result | 4 ++++ mysql-test/suite/galera_3nodes/t/GCF-354.test | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mysql-test/suite/galera_3nodes/r/GCF-354.result b/mysql-test/suite/galera_3nodes/r/GCF-354.result index 3fdd44fe9d3..cbf4e8fb147 100644 --- a/mysql-test/suite/galera_3nodes/r/GCF-354.result +++ b/mysql-test/suite/galera_3nodes/r/GCF-354.result @@ -47,9 +47,13 @@ CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query\\. CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); connection node_3; Node 3 synced CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\. Default database: 'test'\\. Query: 'CREATE TABLE test\\.t1 \\(f1 INTEGER\\)', Error_code: 1050"); CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.test b/mysql-test/suite/galera_3nodes/t/GCF-354.test index 44dfa3deeb7..db4f32fccf9 100644 --- a/mysql-test/suite/galera_3nodes/t/GCF-354.test +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.test @@ -92,6 +92,8 @@ CALL mtr.add_suppression("Slave SQL: Error 'Unknown database 'test'' on query\\. CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); --connection node_3 --let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' @@ -101,5 +103,7 @@ CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\ CALL mtr.add_suppression("Query apply failed"); CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on "); CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown"); +CALL mtr.add_suppression("WSREP: Cert position .* less than last committed"); +CALL mtr.add_suppression("WSREP: Sending JOIN failed: "); --source ../galera/include/auto_increment_offset_restore.inc From 497d6324bc5592c211cd5f2f995e12044c3ce772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 28 Apr 2025 07:35:06 +0300 Subject: [PATCH 28/89] MDEV-36627 : galera.MDEV-29142: certification position less than last commited After the membership change on a newly synced node, then this is just a warning and safe to suppress. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-29142.result | 4 ++++ mysql-test/suite/galera/t/MDEV-29142.test | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/mysql-test/suite/galera/r/MDEV-29142.result b/mysql-test/suite/galera/r/MDEV-29142.result index 370cbf5b074..ce214492b29 100644 --- a/mysql-test/suite/galera/r/MDEV-29142.result +++ b/mysql-test/suite/galera/r/MDEV-29142.result @@ -42,4 +42,8 @@ connection node_2; call mtr.add_suppression("WSREP: Failed to open table mysql\\.wsrep_streaming_log for writing"); call mtr.add_suppression("WSREP: Failed to open SR table for write"); call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0"); +connection node_1; +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); +connection node_2; +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/galera/t/MDEV-29142.test b/mysql-test/suite/galera/t/MDEV-29142.test index 2dc48a74a9d..d0d886ff490 100644 --- a/mysql-test/suite/galera/t/MDEV-29142.test +++ b/mysql-test/suite/galera/t/MDEV-29142.test @@ -53,16 +53,26 @@ SET SESSION wsrep_sync_wait = 0; --let $start_mysqld_params =--wsrep-new-cluster --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/start_mysqld.inc +--source include/wait_until_ready.inc --connection node_2 --let $start_mysqld_params = --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --source include/start_mysqld.inc +--source include/wait_until_ready.inc call mtr.add_suppression("WSREP: Failed to open table mysql\\.wsrep_streaming_log for writing"); call mtr.add_suppression("WSREP: Failed to open SR table for write"); call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0"); +--connection node_1 +# +# after the membership change on a newly synced node, then this is just a warning +# +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); +--connection node_2 +call mtr.add_suppression("WSREP: Cert position .* less than last committed"); + # # Cleanup # From c91c2e74ffb1bf1e4a542c435c8774548c57cff8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 20 Mar 2025 18:31:25 +1100 Subject: [PATCH 29/89] MDEV-36337: udf_example UDF pointers need unsigned is_null/error This is required to match the sql/sql_udf.h --- sql/udf_example.c | 99 ++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/sql/udf_example.c b/sql/udf_example.c index 14c793ee98a..d87abdc9f1b 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -156,33 +156,33 @@ static pthread_mutex_t LOCK_hostname; my_bool metaphon_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void metaphon_deinit(UDF_INIT *initid); char *metaphon(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error); + unsigned long *length, uchar *is_null, uchar *error); my_bool myfunc_double_init(UDF_INIT *, UDF_ARGS *args, char *message); -double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, char *is_null, - char *error); +double myfunc_double(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, + uchar *error); my_bool myfunc_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message); -longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null, - char *error); +longlong myfunc_int(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, + uchar *error); my_bool udf_sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void udf_sequence_deinit(UDF_INIT *initid); -longlong udf_sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null, - char *error); +longlong udf_sequence(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, + uchar *error); my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message ); void avgcost_deinit( UDF_INIT* initid ); -void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -void avgcost_clear( UDF_INIT* initid, char* is_null, char *error ); -void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); +void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); +void avgcost_clear( UDF_INIT* initid, uchar* is_null, uchar *error ); +void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); +double avgcost( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); my_bool avg2_init( UDF_INIT* initid, UDF_ARGS* args, char* message ); void avg2_deinit( UDF_INIT* initid ); -void avg2_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -void avg2_clear( UDF_INIT* initid, char* is_null, char *error ); -void avg2_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -void avg2_remove( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); -double avg2( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error ); +void avg2_reset( UDF_INIT* initid, UDF_ARGS* args, uchar *is_null, uchar *error ); +void avg2_clear( UDF_INIT* initid, uchar* is_null, uchar *error ); +void avg2_add( UDF_INIT* initid, UDF_ARGS* args, uchar *is_null, uchar *error ); +void avg2_remove( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); +double avg2( UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar *error ); my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message); char *is_const(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long - *length, char *is_null, char *error); + *length, uchar *is_null, uchar *error); /************************************************************************* @@ -292,7 +292,7 @@ static char codes[26] = { char *metaphon(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + uchar *is_null, uchar *error __attribute__((unused))) { const char *word=args->args[0]; const char *w_end; @@ -568,7 +568,7 @@ my_bool myfunc_double_init(UDF_INIT *initid, UDF_ARGS *args, char *message) double myfunc_double(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *is_null, char *error __attribute__((unused))) + uchar *is_null, uchar *error __attribute__((unused))) { unsigned long val = 0; unsigned long v = 0; @@ -607,8 +607,8 @@ double myfunc_double(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, /* This function returns the sum of all arguments */ longlong myfunc_int(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *is_null __attribute__((unused)), - char *error __attribute__((unused))) + uchar *is_null __attribute__((unused)), + uchar *error __attribute__((unused))) { longlong val = 0; uint i; @@ -681,8 +681,8 @@ void udf_sequence_deinit(UDF_INIT *initid) } longlong udf_sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *is_null __attribute__((unused)), - char *error __attribute__((unused))) + uchar *is_null __attribute__((unused)), + uchar *error __attribute__((unused))) { ulonglong val=0; if (args->arg_count) @@ -712,11 +712,11 @@ longlong udf_sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, my_bool lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void lookup_deinit(UDF_INIT *initid); char *lookup(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, char *error); + unsigned long *length, uchar *null_value, uchar *error); my_bool reverse_lookup_init(UDF_INIT *initid, UDF_ARGS *args, char *message); void reverse_lookup_deinit(UDF_INIT *initid); char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, char *error); + unsigned long *length, uchar *null_value, uchar *error); /**************************************************************************** @@ -750,8 +750,8 @@ void lookup_deinit(UDF_INIT *initid __attribute__((unused))) } char *lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, - char *result, unsigned long *res_length, char *null_value, - char *error __attribute__((unused))) + char *result, unsigned long *res_length, uchar *null_value, + uchar *error __attribute__((unused))) { uint length; char name_buff[256]; @@ -831,7 +831,7 @@ void reverse_lookup_deinit(UDF_INIT *initid __attribute__((unused))) char *reverse_lookup(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, unsigned long *res_length, - char *null_value, char *error __attribute__((unused))) + uchar *null_value, uchar *error __attribute__((unused))) { #if defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST) char name_buff[256]; @@ -974,7 +974,7 @@ avgcost_deinit( UDF_INIT* initid ) /* This is only for MySQL 4.0 compatibility */ void -avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) +avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, uchar* message) { avgcost_clear(initid, is_null, message); avgcost_add(initid, args, is_null, message); @@ -983,8 +983,8 @@ avgcost_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) /* This is needed to get things to work in MySQL 4.1.1 and above */ void -avgcost_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), - char* message __attribute__((unused))) +avgcost_clear(UDF_INIT* initid, uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { struct avgcost_data* data = (struct avgcost_data*)initid->ptr; data->totalprice= 0.0; @@ -995,8 +995,8 @@ avgcost_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), void avgcost_add(UDF_INIT* initid, UDF_ARGS* args, - char* is_null __attribute__((unused)), - char* message __attribute__((unused))) + uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { if (args->args[0] && args->args[1]) { @@ -1043,7 +1043,7 @@ avgcost_add(UDF_INIT* initid, UDF_ARGS* args, double avgcost( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), - char* is_null, char* error __attribute__((unused))) + uchar* is_null, uchar* error __attribute__((unused))) { struct avgcost_data* data = (struct avgcost_data*)initid->ptr; if (!data->count || !data->totalquantity) @@ -1121,7 +1121,8 @@ avg2_deinit( UDF_INIT* initid ) /* This is only for MySQL 4.0 compatibility */ void -avg2_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) +avg2_reset(UDF_INIT* initid, UDF_ARGS* args, uchar* is_null, + uchar* message) { avgcost_clear(initid, is_null, message); avgcost_add(initid, args, is_null, message); @@ -1130,8 +1131,8 @@ avg2_reset(UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* message) /* This is needed to get things to work in MySQL 4.1.1 and above */ void -avg2_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), - char* message __attribute__((unused))) +avg2_clear(UDF_INIT* initid, uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { struct avg2_data* data = (struct avg2_data*)initid->ptr; data->sum= 0.0; @@ -1141,8 +1142,8 @@ avg2_clear(UDF_INIT* initid, char* is_null __attribute__((unused)), void avg2_add(UDF_INIT* initid, UDF_ARGS* args, - char* is_null __attribute__((unused)), - char* message __attribute__((unused))) + uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { if (args->args[0] && args->args[1]) { @@ -1158,8 +1159,8 @@ avg2_add(UDF_INIT* initid, UDF_ARGS* args, void avg2_remove(UDF_INIT* initid, UDF_ARGS* args, - char* is_null __attribute__((unused)), - char* message __attribute__((unused))) + uchar* is_null __attribute__((unused)), + uchar* message __attribute__((unused))) { if (args->args[0] && args->args[1]) { @@ -1174,8 +1175,8 @@ avg2_remove(UDF_INIT* initid, UDF_ARGS* args, double -avg2( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), - char* is_null, char* error __attribute__((unused))) +avg2(UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), + uchar* is_null, uchar* error __attribute__((unused))) { struct avg2_data* data = (struct avg2_data*)initid->ptr; if (!data->count) @@ -1191,8 +1192,8 @@ avg2( UDF_INIT* initid, UDF_ARGS* args __attribute__((unused)), my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args, char *message); char *myfunc_argument_name(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, - char *error); + unsigned long *length, uchar *null_value, + uchar *error); my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args, char *message) @@ -1210,8 +1211,8 @@ my_bool myfunc_argument_name_init(UDF_INIT *initid, UDF_ARGS *args, char *myfunc_argument_name(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, - unsigned long *length, char *null_value, - char *error __attribute__((unused))) + unsigned long *length, uchar *null_value, + uchar *error __attribute__((unused))) { if (!args->attributes[0]) { @@ -1241,7 +1242,7 @@ my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message) char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + uchar *is_null,uchar *error __attribute__((unused))) { if (initid->ptr != 0) { sprintf(result, "const"); @@ -1280,7 +1281,7 @@ my_bool check_const_len_init(UDF_INIT *initid, UDF_ARGS *args, char *message) char * check_const_len(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + uchar *is_null,uchar *error __attribute__((unused))) { strmov(result, initid->ptr); *length= (uint) strlen(result); From 0b5a084e27fb1abe5a1d1d57d56763477165ac0b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 20 Mar 2025 19:21:56 +1100 Subject: [PATCH 30/89] MDEV-36337: connect UDF pointers need unsigned char* for is_null/error This is required to match the sql/sql_udf.h --- storage/connect/bsonudf.cpp | 139 ++++++++++++++++++------------------ storage/connect/bsonudf.h | 35 +++++---- storage/connect/jsonudf.cpp | 130 ++++++++++++++++----------------- storage/connect/jsonudf.h | 30 ++++---- 4 files changed, 167 insertions(+), 167 deletions(-) diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 68d08bdd085..33a462944b5 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -1972,7 +1972,7 @@ my_bool bsonvalue_init(UDF_INIT* initid, UDF_ARGS* args, char* message) } // end of bsonvalue_init char* bsonvalue(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char*, char*) + unsigned long* res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2014,7 +2014,7 @@ my_bool bson_make_array_init(UDF_INIT* initid, UDF_ARGS* args, char* message) } // end of bson_make_array_init char* bson_make_array(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char*, char*) + unsigned long* res_length, uchar *, uchar *) { char* str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2081,7 +2081,7 @@ my_bool bson_array_add_values_init(UDF_INIT* initid, UDF_ARGS* args, char* messa } // end of bson_array_add_values_init char* bson_array_add_values(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char*) { + unsigned long* res_length, uchar * is_null, uchar *) { char* str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2159,7 +2159,7 @@ my_bool bson_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_array_add_init char *bson_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2263,7 +2263,7 @@ my_bool bson_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_array_delete_init char *bson_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2332,7 +2332,7 @@ my_bool bson_make_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_make_object_init char *bson_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2381,7 +2381,7 @@ my_bool bson_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, } // end of bson_object_nonull_init char *bson_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2435,7 +2435,7 @@ my_bool bson_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_key_init char *bson_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2504,7 +2504,7 @@ my_bool bson_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_add_init char *bson_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PSZ key; char *str = NULL; @@ -2599,7 +2599,7 @@ my_bool bson_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_delete_init char *bson_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2678,7 +2678,7 @@ my_bool bson_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_list_init char *bson_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2745,7 +2745,7 @@ my_bool bson_object_values_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_object_values_init char *bson_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2815,7 +2815,7 @@ my_bool bsonset_def_prec_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonset_def_prec_init -long long bsonset_def_prec(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonset_def_prec(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { long long n = *(long long*)args->args[0]; @@ -2836,7 +2836,7 @@ my_bool bsonget_def_prec_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_def_prec_init -long long bsonget_def_prec(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonget_def_prec(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { return (long long)GetJsonDefPrec(); } // end of bsonget_def_prec @@ -2854,7 +2854,7 @@ my_bool bsonset_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonset_grp_size_init -long long bsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { long long n = *(long long*)args->args[0]; @@ -2875,7 +2875,7 @@ my_bool bsonget_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_grp_size_init -long long bsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long bsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { return (long long)GetJsonGroupSize(); } // end of bsonget_grp_size @@ -2909,7 +2909,7 @@ my_bool bson_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of bson_array_grp_init -void bson_array_grp_clear(UDF_INIT *initid, char*, char*) +void bson_array_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -2919,7 +2919,7 @@ void bson_array_grp_clear(UDF_INIT *initid, char*, char*) g->N = GetJsonGroupSize(); } // end of bson_array_grp_clear -void bson_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void bson_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -2931,7 +2931,7 @@ void bson_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of bson_array_grp_add char *bson_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2982,7 +2982,7 @@ my_bool bson_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of bson_object_grp_init -void bson_object_grp_clear(UDF_INIT *initid, char*, char*) +void bson_object_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -2992,7 +2992,7 @@ void bson_object_grp_clear(UDF_INIT *initid, char*, char*) g->N = GetJsonGroupSize(); } // end of bson_object_grp_clear -void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PBJNX bxp = (PBJNX)((char*)g->Sarea + sizeof(POOLHEADER)); @@ -3004,7 +3004,7 @@ void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of bson_object_grp_add char *bson_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3045,7 +3045,7 @@ my_bool bson_test_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bson_test_init char* bson_test(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char* str = NULL, *fn = NULL; int pretty = 1; PBVAL bvp; @@ -3149,7 +3149,7 @@ my_bool bsonlocate_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bsonlocate_init char* bsonlocate(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char *path = NULL; int k; PBVAL bvp, bvp2; @@ -3270,7 +3270,7 @@ my_bool bson_locate_all_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bson_locate_all_init char* bson_locate_all(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char* path = NULL; int mx = 10; PBVAL bvp, bvp2; @@ -3395,9 +3395,10 @@ my_bool bson_contains_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, false, reslen, memlen, more); } // end of bson contains_init -long long bson_contains(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long bson_contains(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { - char isn, res[256]; + unsigned char isn; + char res[256]; unsigned long reslen; isn = 0; @@ -3444,7 +3445,7 @@ my_bool bsoncontains_path_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of bsoncontains_path_init -long long bsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long bsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { char *p, *path; long long n; @@ -3559,7 +3560,7 @@ my_bool bson_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_item_merge_init char *bson_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3669,7 +3670,7 @@ my_bool bson_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_get_item_init char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *path, *str = NULL; PBVAL jvp; @@ -3775,7 +3776,7 @@ my_bool bsonget_string_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_string_init char *bsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *path, *str = NULL; PBVAL jsp, jvp; @@ -3886,7 +3887,7 @@ my_bool bsonget_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_int_init long long bsonget_int(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; long long n; @@ -4008,7 +4009,7 @@ my_bool bsonget_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bsonget_real_init double bsonget_real(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; double d; @@ -4130,7 +4131,7 @@ my_bool bson_delete_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_delete_item_init char *bson_delete_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path, *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4213,7 +4214,7 @@ void bson_delete_item_deinit(UDF_INIT* initid) /* This function is used by the json_set/insert/update_item functions. */ /*********************************************************************************/ static char *bson_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path, *str = NULL; int w; @@ -4360,7 +4361,7 @@ my_bool bson_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_set_item_init char *bson_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return bson_handle_item(initid, args, result, res_length, is_null, p); @@ -4380,7 +4381,7 @@ my_bool bson_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_insert_item_init char *bson_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return bson_handle_item(initid, args, result, res_length, is_null, p); @@ -4400,7 +4401,7 @@ my_bool bson_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_update_item_init char *bson_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return bson_handle_item(initid, args, result, res_length, is_null, p); @@ -4459,7 +4460,7 @@ my_bool bson_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_file_init char *bson_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *fn, *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4552,7 +4553,7 @@ my_bool bfile_make_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bfile_make_init char *bfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *str = NULL, *fn = NULL; int n, pretty = 2; @@ -4673,7 +4674,7 @@ my_bool bfile_convert_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bfile_convert_init char *bfile_convert(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long *res_length, char *is_null, char *error) { + unsigned long *res_length, uchar *is_null, uchar *error) { char *str, *fn, *ofn; int lrecl = (int)*(longlong*)args->args[2]; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4732,7 +4733,7 @@ my_bool bfile_bjson_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bfile_bjson_init char *bfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char*, char *error) { + unsigned long *res_length, uchar *, uchar *error) { char *buf, *str = NULL, fn[_MAX_PATH], ofn[_MAX_PATH]; bool loop; ssize_t len, newloc; @@ -4846,7 +4847,7 @@ my_bool bson_serialize_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bson_serialize_init char *bson_serialize(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *error) + unsigned long *res_length, uchar *, uchar *error) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4893,7 +4894,7 @@ my_bool bbin_make_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_make_array_init char *bbin_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -4966,7 +4967,7 @@ my_bool bbin_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_array_add_init char *bbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5035,7 +5036,7 @@ my_bool bbin_array_add_values_init(UDF_INIT* initid, UDF_ARGS* args, char* messa } // end of bbin_array_add_values_init char* bbin_array_add_values(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) + unsigned long* res_length, uchar * is_null, uchar * error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5087,18 +5088,18 @@ my_bool bbin_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return bson_array_grp_init(initid, args, message); } // end of bbin_array_grp_init -void bbin_array_grp_clear(UDF_INIT *initid, char *a, char *b) +void bbin_array_grp_clear(UDF_INIT *initid, uchar *a, uchar *b) { bson_array_grp_clear(initid, a, b); } // end of bbin_array_grp_clear -void bbin_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char *a, char *b) +void bbin_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *a, uchar *b) { bson_array_grp_add(initid, args, a, b); } // end of bbin_array_grp_add char *bbin_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5135,18 +5136,18 @@ my_bool bbin_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return bson_object_grp_init(initid, args, message); } // end of bbin_object_grp_init -void bbin_object_grp_clear(UDF_INIT *initid, char *a, char *b) +void bbin_object_grp_clear(UDF_INIT *initid, uchar *a, uchar *b) { bson_object_grp_clear(initid, a, b); } // end of bbin_object_grp_clear -void bbin_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char *a, char *b) +void bbin_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *a, uchar *b) { bson_object_grp_add(initid, args, a, b); } // end of bbin_object_grp_add char *bbin_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5187,7 +5188,7 @@ my_bool bbin_make_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_make_object_init char *bbin_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5241,7 +5242,7 @@ my_bool bbin_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_nonull_init char *bbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5301,7 +5302,7 @@ my_bool bbin_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_key_init char *bbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5363,7 +5364,7 @@ my_bool bbin_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_add_init char *bbin_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5425,7 +5426,7 @@ my_bool bbin_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_array_delete_init char *bbin_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5496,7 +5497,7 @@ my_bool bbin_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_delete_init char *bbin_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = NULL; @@ -5555,7 +5556,7 @@ my_bool bbin_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_list_init char *bbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5607,7 +5608,7 @@ my_bool bbin_object_values_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_object_values_init char *bbin_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5662,7 +5663,7 @@ my_bool bbin_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_get_item_init char *bbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5712,7 +5713,7 @@ my_bool bbin_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_item_merge_init char *bbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5785,7 +5786,7 @@ void bbin_item_merge_deinit(UDF_INIT* initid) /* This function is used by the jbin_set/insert/update_item functions. */ /*********************************************************************************/ static char *bbin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path; int w; @@ -5891,7 +5892,7 @@ my_bool bbin_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_set_item_init char *bbin_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return bbin_handle_item(initid, args, result, res_length, is_null, p); @@ -5911,7 +5912,7 @@ my_bool bbin_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_insert_item_init char *bbin_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return bbin_handle_item(initid, args, result, res_length, is_null, p); @@ -5931,7 +5932,7 @@ my_bool bbin_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_update_item_init char *bbin_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return bbin_handle_item(initid, args, result, res_length, is_null, p); @@ -5951,7 +5952,7 @@ my_bool bbin_delete_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_delete_item_init char *bbin_delete_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path; PBSON bsp = NULL; @@ -6045,7 +6046,7 @@ my_bool bbin_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of bbin_file_init char *bbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *fn; int pretty = 3; @@ -6122,7 +6123,7 @@ my_bool bbin_locate_all_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of bbin_locate_all_init char* bbin_locate_all(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long* res_length, char* is_null, char* error) { + unsigned long* res_length, uchar * is_null, uchar * error) { char *path = NULL; int mx = 10; PBVAL bvp, bvp2; diff --git a/storage/connect/bsonudf.h b/storage/connect/bsonudf.h index e355fe7b48e..90cabf72e21 100644 --- a/storage/connect/bsonudf.h +++ b/storage/connect/bsonudf.h @@ -10,9 +10,6 @@ #include "bson.h" #if 0 -#define UDF_EXEC_ARGS \ - UDF_INIT*, UDF_ARGS*, char*, unsigned long*, char*, char* - // BSON size should be equal on Linux and Windows #define BMX 255 typedef struct BSON* PBSON; @@ -205,11 +202,11 @@ extern "C" { DllExport void bson_locate_all_deinit(UDF_INIT*); DllExport my_bool bson_contains_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bson_contains(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bson_contains(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bson_contains_deinit(UDF_INIT*); DllExport my_bool bsoncontains_path_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsoncontains_path(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsoncontains_path(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bsoncontains_path_deinit(UDF_INIT*); DllExport my_bool bson_make_object_init(UDF_INIT*, UDF_ARGS*, char*); @@ -253,34 +250,34 @@ extern "C" { DllExport void bsonget_string_deinit(UDF_INIT*); DllExport my_bool bsonget_int_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonget_int(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonget_int(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bsonget_int_deinit(UDF_INIT*); DllExport my_bool bsonget_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double bsonget_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double bsonget_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void bsonget_real_deinit(UDF_INIT*); DllExport my_bool bsonset_def_prec_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonset_def_prec(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonset_def_prec(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bsonget_def_prec_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonget_def_prec(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonget_def_prec(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonset_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bsonget_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long bsonget_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long bsonget_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool bson_array_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bson_array_grp_clear(UDF_INIT *, char *, char *); - DllExport void bson_array_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bson_array_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bson_array_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bson_array_grp(UDF_EXEC_ARGS); DllExport void bson_array_grp_deinit(UDF_INIT*); DllExport my_bool bson_object_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bson_object_grp_clear(UDF_INIT *, char *, char *); - DllExport void bson_object_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bson_object_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bson_object_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bson_object_grp(UDF_EXEC_ARGS); DllExport void bson_object_grp_deinit(UDF_INIT*); @@ -337,14 +334,14 @@ extern "C" { DllExport void bbin_array_delete_deinit(UDF_INIT*); DllExport my_bool bbin_array_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bbin_array_grp_clear(UDF_INIT *, char *, char *); - DllExport void bbin_array_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bbin_array_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bbin_array_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bbin_array_grp(UDF_EXEC_ARGS); DllExport void bbin_array_grp_deinit(UDF_INIT*); DllExport my_bool bbin_object_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void bbin_object_grp_clear(UDF_INIT *, char *, char *); - DllExport void bbin_object_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void bbin_object_grp_clear(UDF_INIT *, uchar *, uchar *); + DllExport void bbin_object_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *bbin_object_grp(UDF_EXEC_ARGS); DllExport void bbin_object_grp_deinit(UDF_INIT*); diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 66f2e2b65b9..60870dc3618 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -28,9 +28,9 @@ #define M 9 static char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error); + unsigned long *res_length, uchar *is_null, uchar *error); static char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error); + unsigned long *res_length, uchar *is_null, uchar *error); static PJSON JsonNew(PGLOBAL g, JTYP type); static PJVAL JvalNew(PGLOBAL g, JTYP type, void *vp = NULL); static PJSNX JsnxNew(PGLOBAL g, PJSON jsp, int type, int len = 64); @@ -2065,7 +2065,7 @@ my_bool jsonvalue_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonvalue_init char *jsonvalue(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2106,7 +2106,7 @@ my_bool json_make_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_make_array_init char *json_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2173,7 +2173,7 @@ my_bool json_array_add_values_init(UDF_INIT *initid, UDF_ARGS *args, char *messa } // end of json_array_add_values_init char *json_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2255,7 +2255,7 @@ my_bool json_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_array_add_init char *json_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2363,7 +2363,7 @@ my_bool json_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_array_delete_init char *json_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2443,7 +2443,7 @@ my_bool jsonsum_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of jsonsum_int_init -long long jsonsum_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) +long long jsonsum_int(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *error) { long long n = 0LL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2518,7 +2518,7 @@ my_bool jsonsum_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of jsonsum_real_init -double jsonsum_real(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) +double jsonsum_real(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *error) { double n = 0.0; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2582,7 +2582,7 @@ my_bool jsonavg_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return jsonsum_real_init(initid, args, message); } // end of jsonavg_real_init -double jsonavg_real(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error) +double jsonavg_real(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *error) { double n = 0.0; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2653,7 +2653,7 @@ my_bool json_make_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_make_object_init char *json_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2701,7 +2701,7 @@ my_bool json_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, } // end of json_object_nonull_init char *json_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2755,7 +2755,7 @@ my_bool json_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_key_init char *json_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2823,7 +2823,8 @@ my_bool json_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_add_init char *json_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, + uchar *error) { PCSZ key; char *str = NULL; @@ -2919,7 +2920,7 @@ my_bool json_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_delete_init char *json_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -2996,7 +2997,7 @@ my_bool json_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_list_init char *json_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3072,7 +3073,7 @@ my_bool json_object_values_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_object_list_init char *json_object_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3141,7 +3142,7 @@ my_bool jsonset_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonset_grp_size_init -long long jsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long jsonset_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { long long n = *(long long*)args->args[0]; @@ -3162,7 +3163,7 @@ my_bool jsonget_grp_size_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_grp_size_init -long long jsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +long long jsonget_grp_size(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { return (long long)GetJsonGroupSize(); } // end of jsonget_grp_size @@ -3197,7 +3198,7 @@ my_bool json_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of json_array_grp_init -void json_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void json_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PJAR arp = (PJAR)g->Activityp; @@ -3208,7 +3209,7 @@ void json_array_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of json_array_grp_add char *json_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3230,7 +3231,7 @@ char *json_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, return str; } // end of json_array_grp -void json_array_grp_clear(UDF_INIT *initid, char*, char*) +void json_array_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3274,7 +3275,7 @@ my_bool json_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of json_object_grp_init -void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) +void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; PJOB objp = (PJOB)g->Activityp; @@ -3285,7 +3286,7 @@ void json_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) } // end of json_object_grp_add char *json_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, - unsigned long *res_length, char *, char *) + unsigned long *res_length, uchar *, uchar *) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3301,7 +3302,7 @@ char *json_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, return str; } // end of json_object_grp -void json_object_grp_clear(UDF_INIT *initid, char*, char*) +void json_object_grp_clear(UDF_INIT *initid, uchar *, uchar *) { PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3351,7 +3352,7 @@ my_bool json_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_item_merge_init char *json_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -3450,7 +3451,7 @@ my_bool json_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_get_item_init char *json_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *path, *str = NULL; PJSON jsp; @@ -3557,7 +3558,7 @@ my_bool jsonget_string_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_string_init char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *path, *str = NULL; PJSON jsp; @@ -3666,7 +3667,7 @@ my_bool jsonget_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_int_init long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; long long n; @@ -3786,7 +3787,7 @@ my_bool jsonget_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonget_real_init double jsonget_real(UDF_INIT *initid, UDF_ARGS *args, - char *is_null, char *error) + uchar *is_null, uchar *error) { char *p, *path; double d; @@ -3907,7 +3908,7 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jsonlocate_init char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path = NULL; int k; @@ -4035,7 +4036,7 @@ my_bool json_locate_all_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_locate_all_init char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *p, *path = NULL; int mx = 10; @@ -4161,9 +4162,10 @@ my_bool jsoncontains_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, false, reslen, memlen, more); } // end of jsoncontains_init -long long jsoncontains(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long jsoncontains(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { - char isn, res[256]; + unsigned char isn; + char res[256]; unsigned long reslen; isn = 0; @@ -4210,7 +4212,7 @@ my_bool jsoncontains_path_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return JsonInit(initid, args, message, true, reslen, memlen, more); } // end of jsoncontains_path_init -long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *, char *error) +long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, uchar *, uchar *error) { char *p, *path; long long n; @@ -4290,7 +4292,7 @@ void jsoncontains_path_deinit(UDF_INIT* initid) /* This function is used by the json_set/insert/update_item functions. */ /*********************************************************************************/ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *p, *path, *str = NULL; int w; @@ -4440,7 +4442,7 @@ my_bool json_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_set_item_init char *json_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return handle_item(initid, args, result, res_length, is_null, p); @@ -4460,7 +4462,7 @@ my_bool json_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_insert_item_init char *json_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return handle_item(initid, args, result, res_length, is_null, p); @@ -4480,7 +4482,7 @@ my_bool json_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_update_item_init char *json_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return handle_item(initid, args, result, res_length, is_null, p); @@ -4539,7 +4541,7 @@ my_bool json_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_file_init char *json_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *str, *fn; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -4636,7 +4638,7 @@ my_bool jfile_make_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jfile_make_init char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *p, *str = NULL, *fn = NULL; int n, pretty = 2; @@ -4744,7 +4746,7 @@ my_bool jbin_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_array_init char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -4805,7 +4807,7 @@ my_bool jbin_array_add_values_init(UDF_INIT *initid, UDF_ARGS *args, char *messa } // end of jbin_array_add_values_init char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -4879,7 +4881,7 @@ my_bool jbin_array_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_array_add_init char *jbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { int n = 2; PJSON top = NULL; @@ -4969,7 +4971,7 @@ my_bool jbin_array_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_array_delete_init char *jbin_array_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5038,7 +5040,7 @@ my_bool jbin_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_init char *jbin_object(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5093,7 +5095,7 @@ my_bool jbin_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_nonull_init char *jbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5154,7 +5156,7 @@ my_bool jbin_object_key_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_key_init char *jbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PGLOBAL g = (PGLOBAL)initid->ptr; PBSON bsp = (PBSON)g->Xchk; @@ -5216,7 +5218,7 @@ my_bool jbin_object_add_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_add_init char *jbin_object_add(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5296,7 +5298,7 @@ my_bool jbin_object_delete_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_delete_init char *jbin_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5359,7 +5361,7 @@ my_bool jbin_object_list_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_object_list_init char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJAR jarp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5420,7 +5422,7 @@ my_bool jbin_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_get_item_init char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *path; PJSON jsp; @@ -5513,7 +5515,7 @@ my_bool jbin_item_merge_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_item_merge_init char *jbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { PJSON top = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5573,7 +5575,7 @@ void jbin_item_merge_deinit(UDF_INIT* initid) /* This function is used by the jbin_set/insert/update functions. */ /*********************************************************************************/ char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *p, *path; int w; @@ -5697,7 +5699,7 @@ my_bool jbin_set_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_set_item_init char *jbin_set_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$set"); return bin_handle_item(initid, args, result, res_length, is_null, p); @@ -5717,7 +5719,7 @@ my_bool jbin_insert_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_insert_item_init char *jbin_insert_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$insert"); return bin_handle_item(initid, args, result, res_length, is_null, p); @@ -5737,7 +5739,7 @@ my_bool jbin_update_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_update_item_init char *jbin_update_item(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *p) + unsigned long *res_length, uchar *is_null, uchar *p) { strcpy(result, "$update"); return bin_handle_item(initid, args, result, res_length, is_null, p); @@ -5785,7 +5787,7 @@ my_bool jbin_file_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of jbin_file_init char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *error) + unsigned long *res_length, uchar *is_null, uchar *error) { char *fn; int pretty = 3, pty = 3; @@ -5880,7 +5882,7 @@ my_bool json_serialize_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of json_serialize_init char *json_serialize(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *, char *error) + unsigned long *res_length, uchar *, uchar *error) { char *str; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5936,7 +5938,7 @@ my_bool jfile_convert_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of jfile_convert_init char *jfile_convert(UDF_INIT* initid, UDF_ARGS* args, char* result, - unsigned long *res_length, char *is_null, char *error) { + unsigned long *res_length, uchar *is_null, uchar *error) { char *str, *fn, *ofn; int lrecl = (int)*(longlong*)args->args[2]; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -5995,7 +5997,7 @@ my_bool jfile_bjson_init(UDF_INIT* initid, UDF_ARGS* args, char* message) { } // end of jfile_bjson_init char *jfile_bjson(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char*, char *error) { + unsigned long *res_length, uchar *, uchar *error) { char *fn, *ofn, *buf, *str = NULL; bool loop; ssize_t len, newloc; @@ -6535,7 +6537,7 @@ my_bool envar_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of envar_init char *envar(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *str, name[256]; int n = MY_MIN(args->lengths[0], sizeof(name) - 1); @@ -6573,7 +6575,7 @@ my_bool uvar_init(UDF_INIT *initid, UDF_ARGS *args, char *message) } // end of uvar_init char *uvar(UDF_INIT *initid, UDF_ARGS *args, char *result, - unsigned long *res_length, char *is_null, char *) + unsigned long *res_length, uchar *is_null, uchar *) { char *str, varname[256]; PGLOBAL g = (PGLOBAL)initid->ptr; @@ -6617,7 +6619,7 @@ my_bool countin_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return false; } // end of countin_init -long long countin(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *) +long long countin(UDF_INIT *initid, UDF_ARGS *args, uchar *is_null, uchar *) { PSZ str1, str2; char *s; diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h index 4378bddf9ba..782d17acb12 100644 --- a/storage/connect/jsonudf.h +++ b/storage/connect/jsonudf.h @@ -14,7 +14,7 @@ #include "json.h" #define UDF_EXEC_ARGS \ - UDF_INIT*, UDF_ARGS*, char*, unsigned long*, char*, char* + UDF_INIT*, UDF_ARGS*, char*, unsigned long*, uchar *, uchar * // BSON size should be equal on Linux and Windows #define BMX 255 @@ -95,15 +95,15 @@ extern "C" { DllExport void json_array_delete_deinit(UDF_INIT*); DllExport my_bool jsonsum_int_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonsum_int(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonsum_int(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonsum_int_deinit(UDF_INIT*); DllExport my_bool jsonsum_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double jsonsum_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double jsonsum_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonsum_real_deinit(UDF_INIT*); DllExport my_bool jsonavg_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double jsonavg_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double jsonavg_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonavg_real_deinit(UDF_INIT*); DllExport my_bool json_make_object_init(UDF_INIT*, UDF_ARGS*, char*); @@ -135,21 +135,21 @@ extern "C" { DllExport void json_object_values_deinit(UDF_INIT*); DllExport my_bool jsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonset_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool jsonget_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonget_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonget_grp_size(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport my_bool json_array_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void json_array_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void json_array_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *json_array_grp(UDF_EXEC_ARGS); - DllExport void json_array_grp_clear(UDF_INIT *, char *, char *); + DllExport void json_array_grp_clear(UDF_INIT *, uchar *, uchar *); DllExport void json_array_grp_deinit(UDF_INIT*); DllExport my_bool json_object_grp_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport void json_object_grp_add(UDF_INIT *, UDF_ARGS *, char *, char *); + DllExport void json_object_grp_add(UDF_INIT *, UDF_ARGS *, uchar *, uchar *); DllExport char *json_object_grp(UDF_EXEC_ARGS); - DllExport void json_object_grp_clear(UDF_INIT *, char *, char *); + DllExport void json_object_grp_clear(UDF_INIT *, uchar *, uchar *); DllExport void json_object_grp_deinit(UDF_INIT*); DllExport my_bool json_item_merge_init(UDF_INIT*, UDF_ARGS*, char*); @@ -165,15 +165,15 @@ extern "C" { DllExport void jsonget_string_deinit(UDF_INIT*); DllExport my_bool jsonget_int_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsonget_int(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsonget_int(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonget_int_deinit(UDF_INIT*); DllExport my_bool jsonget_real_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport double jsonget_real(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport double jsonget_real(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsonget_real_deinit(UDF_INIT*); DllExport my_bool jsoncontains_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsoncontains(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsoncontains(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsoncontains_deinit(UDF_INIT*); DllExport my_bool jsonlocate_init(UDF_INIT*, UDF_ARGS*, char*); @@ -185,7 +185,7 @@ extern "C" { DllExport void json_locate_all_deinit(UDF_INIT*); DllExport my_bool jsoncontains_path_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long jsoncontains_path(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long jsoncontains_path(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); DllExport void jsoncontains_path_deinit(UDF_INIT*); DllExport my_bool json_set_item_init(UDF_INIT*, UDF_ARGS*, char*); @@ -293,7 +293,7 @@ extern "C" { #endif // DEVELOPMENT DllExport my_bool countin_init(UDF_INIT*, UDF_ARGS*, char*); - DllExport long long countin(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport long long countin(UDF_INIT*, UDF_ARGS*, uchar *, uchar *); } // extern "C" From b9a20752a9b80df7b5431e271ef4d677fea0fb46 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 21 Mar 2025 16:37:44 +1100 Subject: [PATCH 31/89] MDEV-36337 auth_ed25519 correct UDF pointers for is_null/error Shows up on test plugins.auth_ed25519. There isn't the import to define uchar so left as unsigned char. --- plugin/auth_ed25519/server_ed25519.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/auth_ed25519/server_ed25519.c b/plugin/auth_ed25519/server_ed25519.c index b789bd34ca4..11e2fb7c03f 100644 --- a/plugin/auth_ed25519/server_ed25519.c +++ b/plugin/auth_ed25519/server_ed25519.c @@ -135,7 +135,7 @@ maria_declare_plugin_end; MYSQL_PLUGIN_EXPORT char *ed25519_password(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, char *error __attribute__((unused))) + unsigned char *is_null, unsigned char *error __attribute__((unused))) { unsigned char pk[CRYPTO_PUBLICKEYBYTES]; From 2c4fe3557ace378a763869ef9c97a7cd2f69c78c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 28 Mar 2025 17:58:06 +1100 Subject: [PATCH 32/89] MDEV-36337: mroonga_* udf correct ptr types for is_null/error Shows up in mroonga UDF tests under clang with UBSAN: UndefinedBehaviorSanitizer: function-type-mismatch Accepted upstream: https://github.com/mroonga/mroonga/pull/902 --- storage/mroonga/udf/mrn_udf_command.cpp | 2 +- storage/mroonga/udf/mrn_udf_escape.cpp | 2 +- storage/mroonga/udf/mrn_udf_highlight_html.cpp | 4 ++-- storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp | 2 +- storage/mroonga/udf/mrn_udf_normalize.cpp | 2 +- storage/mroonga/udf/mrn_udf_query_expand.cpp | 4 ++-- storage/mroonga/udf/mrn_udf_snippet.cpp | 2 +- storage/mroonga/udf/mrn_udf_snippet_html.cpp | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/storage/mroonga/udf/mrn_udf_command.cpp b/storage/mroonga/udf/mrn_udf_command.cpp index 46911c56e25..44d8c9ccdd0 100644 --- a/storage/mroonga/udf/mrn_udf_command.cpp +++ b/storage/mroonga/udf/mrn_udf_command.cpp @@ -220,7 +220,7 @@ static void mroonga_command_escape_value(grn_ctx *ctx, } MRN_API char *mroonga_command(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { CommandInfo *info = (CommandInfo *)init->ptr; grn_ctx *ctx = info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_escape.cpp b/storage/mroonga/udf/mrn_udf_escape.cpp index 55a3639565e..a03bf25cba2 100644 --- a/storage/mroonga/udf/mrn_udf_escape.cpp +++ b/storage/mroonga/udf/mrn_udf_escape.cpp @@ -214,7 +214,7 @@ static void escape(EscapeInfo *info, UDF_ARGS *args) } MRN_API char *mroonga_escape(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { EscapeInfo *info = reinterpret_cast(init->ptr); grn_ctx *ctx = info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_highlight_html.cpp b/storage/mroonga/udf/mrn_udf_highlight_html.cpp index d986777caff..5085a885fe0 100644 --- a/storage/mroonga/udf/mrn_udf_highlight_html.cpp +++ b/storage/mroonga/udf/mrn_udf_highlight_html.cpp @@ -412,8 +412,8 @@ MRN_API char *mroonga_highlight_html(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, - char *error) + uchar *is_null, + uchar *error) { MRN_DBUG_ENTER_FUNCTION(); diff --git a/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp b/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp index f40dcf0055f..fb948a72ea9 100644 --- a/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp +++ b/storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp @@ -45,7 +45,7 @@ MRN_API my_bool last_insert_grn_id_init(UDF_INIT *init, UDF_ARGS *args, char *me return 0; } -MRN_API longlong last_insert_grn_id(UDF_INIT *init, UDF_ARGS *args, char *is_null, char *error) +MRN_API longlong last_insert_grn_id(UDF_INIT *init, UDF_ARGS *args, uchar *is_null, uchar *error) { THD *thd = current_thd; st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); diff --git a/storage/mroonga/udf/mrn_udf_normalize.cpp b/storage/mroonga/udf/mrn_udf_normalize.cpp index 0ebee2ff608..5c34e9b0ec7 100644 --- a/storage/mroonga/udf/mrn_udf_normalize.cpp +++ b/storage/mroonga/udf/mrn_udf_normalize.cpp @@ -151,7 +151,7 @@ error: } MRN_API char *mroonga_normalize(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { st_mrn_normalize_info *info = (st_mrn_normalize_info *)init->ptr; grn_ctx *ctx = info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_query_expand.cpp b/storage/mroonga/udf/mrn_udf_query_expand.cpp index 76a5dad53b4..4ecafe1812b 100644 --- a/storage/mroonga/udf/mrn_udf_query_expand.cpp +++ b/storage/mroonga/udf/mrn_udf_query_expand.cpp @@ -244,8 +244,8 @@ MRN_API char *mroonga_query_expand(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, - char *error) + uchar *is_null, + uchar *error) { MRN_DBUG_ENTER_FUNCTION(); diff --git a/storage/mroonga/udf/mrn_udf_snippet.cpp b/storage/mroonga/udf/mrn_udf_snippet.cpp index 1bd6cb7d722..53058bf02f5 100644 --- a/storage/mroonga/udf/mrn_udf_snippet.cpp +++ b/storage/mroonga/udf/mrn_udf_snippet.cpp @@ -248,7 +248,7 @@ error: } MRN_API char *mroonga_snippet(UDF_INIT *init, UDF_ARGS *args, char *result, - unsigned long *length, char *is_null, char *error) + unsigned long *length, uchar *is_null, uchar *error) { st_mrn_snip_info *snip_info = (st_mrn_snip_info *) init->ptr; grn_ctx *ctx = snip_info->ctx; diff --git a/storage/mroonga/udf/mrn_udf_snippet_html.cpp b/storage/mroonga/udf/mrn_udf_snippet_html.cpp index ba0cdadda99..3acdef03f54 100644 --- a/storage/mroonga/udf/mrn_udf_snippet_html.cpp +++ b/storage/mroonga/udf/mrn_udf_snippet_html.cpp @@ -323,8 +323,8 @@ MRN_API char *mroonga_snippet_html(UDF_INIT *init, UDF_ARGS *args, char *result, unsigned long *length, - char *is_null, - char *error) + uchar *is_null, + uchar *error) { MRN_DBUG_ENTER_FUNCTION(); From d5247592c53953a051596b411437fea4f6eb4676 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Wed, 21 May 2025 11:10:09 +0300 Subject: [PATCH 33/89] Test sysvars_server failure fix --- mysql-test/suite/sys_vars/inc/sysvars_server.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc index 8fca98e0383..61b46f5a26a 100644 --- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc +++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc @@ -1,4 +1,5 @@ --source include/have_perfschema.inc +--source include/have_profiling.inc --source include/word_size.inc --source include/platform.inc --vertical_results From fbd736c87232a6ab39b89176cdd909d4230ecd46 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Wed, 21 May 2025 11:10:09 +0300 Subject: [PATCH 34/89] mysqltest: result_format fix --result_format 2 command fails with assertion: DbugExit (why=0x7fffffff49e0 "missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"do_result_format_version\"\n") at ../src/dbug/dbug.c:2045 --- client/mysqltest.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 6262a46ad95..110f7167ac8 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -2852,6 +2852,7 @@ do_result_format_version(struct st_command *command) dynstr_append_mem(&ds_res, ds_version.str, ds_version.length); dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n")); dynstr_free(&ds_version); + DBUG_VOID_RETURN; } From 69af638a0cff5b2185a6af45e399a4fd74796260 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Thu, 22 May 2025 10:23:36 -0400 Subject: [PATCH 35/89] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a46cc7020c5..9488c7b0e57 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=11 -MYSQL_VERSION_PATCH=13 +MYSQL_VERSION_PATCH=14 SERVER_MATURITY=stable From 6c6941c9bad725f16311c9870822d26466eee885 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Thu, 22 May 2025 10:25:29 -0400 Subject: [PATCH 36/89] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f046bd823a0..5376961772c 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=11 MYSQL_VERSION_MINOR=4 -MYSQL_VERSION_PATCH=7 +MYSQL_VERSION_PATCH=8 SERVER_MATURITY=stable From 9e1c1d429f51042cf98fe78e33e0570d6fff7cd1 Mon Sep 17 00:00:00 2001 From: chengya Date: Fri, 23 May 2025 10:34:21 +0800 Subject: [PATCH 37/89] crc32 compatibility on Windows on ARM64 --- mysys/crc32/crc32_arm64.c | 70 ++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/mysys/crc32/crc32_arm64.c b/mysys/crc32/crc32_arm64.c index c39f7b5f6f6..1f2f023e6ca 100644 --- a/mysys/crc32/crc32_arm64.c +++ b/mysys/crc32/crc32_arm64.c @@ -4,31 +4,38 @@ #include typedef unsigned (*my_crc32_t)(unsigned, const void *, size_t); +unsigned crc32_aarch64(unsigned, const void *, size_t); #ifdef HAVE_ARMV8_CRC -#ifdef _WIN32 -#include +# ifdef HAVE_ARMV8_CRYPTO +static unsigned crc32c_aarch64_pmull(unsigned, const void *, size_t); +# endif + +# ifdef _WIN32 +# include +# ifdef __clang__ +# include +# include +# endif int crc32_aarch64_available(void) { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE); } -const char *crc32c_aarch64_available(void) +unsigned crc32c_aarch64(unsigned, const void *, size_t); + +my_crc32_t crc32c_aarch64_available(void) { if (crc32_aarch64_available() == 0) return NULL; /* TODO : pmull seems supported, but does not compile*/ - return "Using ARMv8 crc32 instructions"; + return crc32c_aarch64; } -#endif /* _WIN32 */ -#ifdef HAVE_ARMV8_CRYPTO -static unsigned crc32c_aarch64_pmull(unsigned, const void *, size_t); -# endif - -# ifdef __APPLE__ -# include +# else /* _WIN32 */ +# ifdef __APPLE__ +# include int crc32_aarch64_available(void) { @@ -41,16 +48,16 @@ int crc32_aarch64_available(void) my_crc32_t crc32c_aarch64_available(void) { -# ifdef HAVE_ARMV8_CRYPTO +# ifdef HAVE_ARMV8_CRYPTO if (crc32_aarch64_available()) return crc32c_aarch64_pmull; -# endif +# endif return NULL; } -# else /* __APPLE__ */ -# include -# ifdef __FreeBSD__ +# else /* __APPLE__ */ +# include +# ifdef __FreeBSD__ static unsigned long getauxval(unsigned int key) { unsigned long val; @@ -58,17 +65,17 @@ static unsigned long getauxval(unsigned int key) return 0ul; return val; } -# else -# include -# endif +# else +# include +# endif -# ifndef HWCAP_CRC32 -# define HWCAP_CRC32 (1 << 7) -# endif +# ifndef HWCAP_CRC32 +# define HWCAP_CRC32 (1 << 7) +# endif -# ifndef HWCAP_PMULL -# define HWCAP_PMULL (1 << 4) -# endif +# ifndef HWCAP_PMULL +# define HWCAP_PMULL (1 << 4) +# endif /* ARM made crc32 default from ARMv8.1 but optional in ARMv8A * Runtime check API. @@ -78,9 +85,9 @@ int crc32_aarch64_available(void) unsigned long auxv= getauxval(AT_HWCAP); return (auxv & HWCAP_CRC32) != 0; } -# endif /* __APPLE__ */ +# endif /* __APPLE__ */ -# ifndef __APPLE__ +# ifndef __APPLE__ static unsigned crc32c_aarch64(unsigned, const void *, size_t); my_crc32_t crc32c_aarch64_available(void) @@ -88,14 +95,15 @@ my_crc32_t crc32c_aarch64_available(void) unsigned long auxv= getauxval(AT_HWCAP); if (!(auxv & HWCAP_CRC32)) return NULL; -# ifdef HAVE_ARMV8_CRYPTO +# ifdef HAVE_ARMV8_CRYPTO /* Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030). */ if (auxv & HWCAP_PMULL) return crc32c_aarch64_pmull; -# endif +# endif return crc32c_aarch64; } -# endif /* __APPLE__ */ +# endif /* __APPLE__ */ +# endif /* _WIN32 */ const char *crc32c_aarch64_impl(my_crc32_t c) { @@ -370,7 +378,7 @@ static unsigned crc32c_aarch64_pmull(unsigned crc, const void *buf, size_t len) /* There are multiple approaches to calculate crc. Approach-1: Process 8 bytes then 4 bytes then 2 bytes and then 1 bytes Approach-2: Process 8 bytes and remaining workload using 1 bytes -Apporach-3: Process 64 bytes at once by issuing 8 crc call and remaining +Approach-3: Process 64 bytes at once by issuing 8 crc call and remaining using 8/1 combination. Based on micro-benchmark testing we found that Approach-2 works best especially From 1a95c2a4b2028d3808febdbd15c2ab48f0242414 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Wed, 21 May 2025 11:10:09 +0300 Subject: [PATCH 38/89] MDEV-36817 Server crashes in do_mark_index_columns instead of ER_DUP_ENTRY on partitioned table Now as c1492f3d077 (MDEV-36115) restores m_last_part table->file points to partition p0 while the error happens in p1, so error index does not match ib_table in innobase_get_mysql_key_number_for_index(). This case is handled by separate code block in innobase_get_mysql_key_number_for_index() which was wrong on using secondary index for dict_index_is_auto_gen_clust() and it was not covered by the tests. --- mysql-test/suite/versioning/r/partition.result | 9 +++++++++ mysql-test/suite/versioning/t/partition.test | 10 ++++++++++ storage/innobase/handler/ha_innodb.cc | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index bda04f6f0f6..580ced253a8 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -1805,6 +1805,15 @@ insert into t values (1),(2); DELETE from t; drop table t; # +# MDEV-36817 Server crashes in do_mark_index_columns instead of +# ER_DUP_ENTRY on partitioned table +# +create table t (f int, unique(f)) engine=innodb partition by key (f) partitions 2; +insert into t (f) values (1), (3); +update t set f = 0; +ERROR 23000: Duplicate entry '0' for key 'f' +drop table t; +# # End of 10.5 tests # set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index d3af1d25dd3..b3eceb7184a 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1583,6 +1583,16 @@ insert into t values (1),(2); DELETE from t; drop table t; +--echo # +--echo # MDEV-36817 Server crashes in do_mark_index_columns instead of +--echo # ER_DUP_ENTRY on partitioned table +--echo # +create table t (f int, unique(f)) engine=innodb partition by key (f) partitions 2; +insert into t (f) values (1), (3); +--error ER_DUP_ENTRY +update t set f = 0; +drop table t; + --echo # --echo # End of 10.5 tests --echo # diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 562362db16e..7e8eef467cf 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14554,13 +14554,14 @@ innobase_get_mysql_key_number_for_index( if (index->table != ib_table) { i = 0; ind = dict_table_get_first_index(index->table); + const bool auto_gen_clust = dict_index_is_auto_gen_clust(ind); while (index != ind) { ind = dict_table_get_next_index(ind); i++; } - if (dict_index_is_auto_gen_clust(index)) { + if (auto_gen_clust) { ut_a(i > 0); i--; } From 1037f9594178deac433c026c51930619cf6ee440 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Wed, 21 May 2025 11:10:09 +0300 Subject: [PATCH 39/89] MDEV-33675 Assertion(reclength < vreclength) in setup_vcols_for_repair() When table2myisam() prepares recinfo structures BIT field was skipped because pack_length_in_rec() returns 0. Instead of BIT field DB_ROW_HASH_1 field was taken into recinfo structure and its length was added to reclength. This is wrong because not stored fields must not be prepared as record columns (MI_COLUMNDEF) in storage layer. 0-length fields are prepared in "reserve space for null bits" branch. The problem only occurs with tables where there is no data for the main record outside of the null bits. The fix updates minpos condition so we avoid fields after stored_rec_length and these are not stored by definition. share->reclength already includes not stored lengths from CREATE TABLE so we cannot use it as minpos starting point. In Aria there is no "reserve space for null bits" and it does not create column definition for BIT. Also there is no setup_vcols_for_repair() to reproduce the issue. But nonetheless it creates column definition for not stored fields redundantly, so we patch table2maria() as well. The test case for Aria tries to demonstrate BIT field works, it does not reproduce any issues (as redundant column definition for not stored field seem to not cause any problems). --- mysql-test/main/long_unique_bugs.result | 38 +++++++++++++++++++++++++ mysql-test/main/long_unique_bugs.test | 26 +++++++++++++++++ storage/maria/ha_maria.cc | 4 +-- storage/myisam/ha_myisam.cc | 4 +-- 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index a5b0f67c0aa..6bf3a7dcc44 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -770,4 +770,42 @@ alter table t1 add constraint constraint_1 unique (a); Warnings: Note 1831 Duplicate index `constraint_1`. This is deprecated and will be disallowed in a future release drop table t1; +# +# MDEV-33675 assertion(reclength < vreclength) in setup_vcols_for_repair() +# +create table t (c1 bit, unique key(c1) using hash) engine=myisam; +insert into t values (0); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +insert into t values(); +select cast(c1 as unsigned) c1 from t; +c1 +0 +NULL +drop table t; +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), +c4 long as (c1) stored) engine=myisam; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +hex(c1) hex(c2) c3 hex(c4) +1 01 a 01 +NULL NULL NULL NULL +drop table t1; +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), +c4 long as (c1) stored) engine=aria; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +hex(c1) hex(c2) c3 hex(c4) +1 01 a 01 +NULL NULL NULL NULL +drop table t1; # End of 10.5 tests diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index ea662a832f2..b1daf97d194 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -745,4 +745,30 @@ create table t1 (a blob unique); alter table t1 add constraint constraint_1 unique (a); drop table t1; +--echo # +--echo # MDEV-33675 assertion(reclength < vreclength) in setup_vcols_for_repair() +--echo # +create table t (c1 bit, unique key(c1) using hash) engine=myisam; +insert into t values (0); +check table t; +insert into t values(); +select cast(c1 as unsigned) c1 from t; +drop table t; + +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), + c4 long as (c1) stored) engine=myisam; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +drop table t1; + +create table t1 (c1 bit, c2 long as (c1) virtual, c3 char(10), + c4 long as (c1) stored) engine=aria; +insert into t1 (c1, c3) values (1, "a"); +check table t1; +insert into t1 values(); +select hex(c1), hex(c2), c3, hex(c4) from t1; +drop table t1; + --echo # End of 10.5 tests diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index edc8a8b52a6..28e5fd970db 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -616,13 +616,13 @@ static int table2maria(TABLE *table_arg, data_file_type row_type, while (recpos < (uint) share->stored_rec_length) { Field **field, *found= 0; - minpos= share->reclength; + minpos= share->stored_rec_length; length= 0; for (field= table_arg->field; *field; field++) { if ((fieldpos= (*field)->offset(record)) >= recpos && - fieldpos <= minpos) + fieldpos < minpos) { /* skip null fields */ if (!(temp_length= (*field)->pack_length_in_rec())) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index d564daf656f..ed35783d394 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -367,13 +367,13 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, while (recpos < (uint) share->stored_rec_length) { Field **field, *found= 0; - minpos= share->reclength; + minpos= share->stored_rec_length; length= 0; for (field= table_arg->field; *field; field++) { if ((fieldpos= (*field)->offset(record)) >= recpos && - fieldpos <= minpos) + fieldpos < minpos) { /* skip null fields */ if (!(temp_length= (*field)->pack_length_in_rec())) From 96b7671b056034b465c7ae7b66b315bd524d4b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 23 May 2025 14:51:38 +0300 Subject: [PATCH 40/89] MDEV-34388 fixup: Stack usage in rename_table_in_stat_tables() rename_table_in_stat_tables(): Allocate TABLE_LIST[STATISTICS_TABLES] from the heap instead of the stack, to pass -Wframe-larger-than=16384 in an optimized CMAKE_BUILD_TYPE=RelWithDebInfo build. --- sql/sql_statistics.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 306f9768dc2..8e12fe7362f 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -4023,16 +4023,24 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, int err; enum_binlog_format save_binlog_format; TABLE *stat_table; - TABLE_LIST tables[STATISTICS_TABLES]; int rc= 0; DBUG_ENTER("rename_table_in_stat_tables"); - + + TABLE_LIST *tables= + static_cast(my_malloc(PSI_NOT_INSTRUMENTED, + STATISTICS_TABLES * sizeof *tables, + MYF(MY_WME))); + if (!tables) + DBUG_RETURN(1); + start_new_trans new_trans(thd); if (open_stat_tables(thd, tables, TRUE)) { + func_exit: + my_free(tables); new_trans.restore_old_transaction(); - DBUG_RETURN(0); + DBUG_RETURN(rc); } save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); @@ -4093,9 +4101,7 @@ int rename_table_in_stat_tables(THD *thd, const LEX_CSTRING *db, thd->restore_stmt_binlog_format(save_binlog_format); if (thd->commit_whole_transaction_and_close_tables()) rc= 1; - - new_trans.restore_old_transaction(); - DBUG_RETURN(rc); + goto func_exit; } From 4c8143b4510eac64869cefe258f1399ab7874780 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 23 May 2025 14:18:07 +0200 Subject: [PATCH 41/89] Make it compiling with last gcc --- strings/json_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/json_lib.c b/strings/json_lib.c index 29aa010761b..a04cee573c6 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -1612,7 +1612,7 @@ static enum json_esc_char_classes json_escape_chr_map[0x60] = { }; -static const char hexconv[16] = "0123456789ABCDEF"; +static const char hexconv[17] = "0123456789ABCDEF"; int json_escape(CHARSET_INFO *str_cs, From 49f351f583fd0846cbe74bfc2fdd30a6be3ff1ff Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Sat, 24 May 2025 21:24:29 +0400 Subject: [PATCH 42/89] MDEV-36835 - main.aborted_clients fails after various tests Some tests like main.ssl_timeout and main.wait_timeout may abort connections. If main.aborted_clients follows such tests it may observe unstable value of aborted_clients status variable. FLUSH STATUS was issued to make aborted_clients value reproducible. However after 775cba4d0f0 FLUSH STATUS doesn't reset global status. Fixed by using FLUSH GLOBAL STATUS. Regression after "MDEV-33145 - Add FLUSH GLOBAL STATUS". --- mysql-test/main/aborted_clients.result | 2 +- mysql-test/main/aborted_clients.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/aborted_clients.result b/mysql-test/main/aborted_clients.result index 8eb6df59653..b01db586b9b 100644 --- a/mysql-test/main/aborted_clients.result +++ b/mysql-test/main/aborted_clients.result @@ -1,4 +1,4 @@ -FLUSH STATUS; +FLUSH GLOBAL STATUS; connect con1,localhost,root,,; disconnect con1; connection default; diff --git a/mysql-test/main/aborted_clients.test b/mysql-test/main/aborted_clients.test index 20ddc9991e6..200bac03133 100644 --- a/mysql-test/main/aborted_clients.test +++ b/mysql-test/main/aborted_clients.test @@ -5,7 +5,7 @@ -- source include/not_embedded.inc -- source include/count_sessions.inc -FLUSH STATUS; +FLUSH GLOBAL STATUS; # Connect/Disconnect look that aborted_clients stays 0 connect (con1,localhost,root,,); disconnect con1; From 8a4d3a044f9de992eabe725522bceea49fdd0e61 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Sun, 25 May 2025 09:11:41 +0530 Subject: [PATCH 43/89] MDEV-36017 Alter table aborts when temporary directory is full Problem: ======= - During inplace algorithm, concurrent DML fails to write the log operation into the temporary file. InnoDB fail to mark the error for the online log. - ddl_log_write() releases the global ddl lock prematurely before release the log memory entry Fix: === row_log_online_op(): Mark the error in online log when InnoDB ran out of temporary space fil_space_extend_must_retry(): Mark the os_has_said_disk_full as true if os_file_set_size() fails btr_cur_pessimistic_update(): Return error code when btr_cur_pessimistic_insert() fails ddl_log_write(): Release the global ddl lock after releasing the log memory entry when error was encountered btr_cur_optimistic_update(): Relax the assertion that blob pointer can be null during rollback because InnoDB can ran out of space while allocating the external page row_undo_mod_upd_exist_sec(): Remove the assertion which says that InnoDB should fail to build index entry when rollbacking an incomplete transaction after crash recovery. This scenario can happen when InnoDB ran out of space. row_upd_changes_ord_field_binary_func(): Relax the assertion to make that externally stored field can be null when InnoDB ran out of space. --- .../suite/innodb/r/alter_temp_fail.result | 25 ++++++++++++++++ mysql-test/suite/innodb/t/alter_temp_fail.opt | 1 + .../suite/innodb/t/alter_temp_fail.test | 30 +++++++++++++++++++ sql/ddl_log.cc | 4 ++- storage/innobase/btr/btr0cur.cc | 11 +++++-- storage/innobase/fil/fil0fil.cc | 2 +- storage/innobase/row/row0log.cc | 5 ++++ storage/innobase/row/row0umod.cc | 18 ++--------- storage/innobase/row/row0upd.cc | 15 ++++------ 9 files changed, 81 insertions(+), 30 deletions(-) create mode 100644 mysql-test/suite/innodb/r/alter_temp_fail.result create mode 100644 mysql-test/suite/innodb/t/alter_temp_fail.opt create mode 100644 mysql-test/suite/innodb/t/alter_temp_fail.test diff --git a/mysql-test/suite/innodb/r/alter_temp_fail.result b/mysql-test/suite/innodb/r/alter_temp_fail.result new file mode 100644 index 00000000000..f6e62328bbe --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_temp_fail.result @@ -0,0 +1,25 @@ +# +# MDEV-36017 Alter table aborts when temporary +# directory is full +# +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), +f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10)); +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 SELECT * FROM t1; +SET STATEMENT DEBUG_DBUG="+d,os_file_write_fail" FOR COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR HY000: Temporary file write failure +disconnect con1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET STATEMENT DEBUG_DBUG="+d,ddl_log_write_fail" FOR +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alter_temp_fail.opt b/mysql-test/suite/innodb/t/alter_temp_fail.opt new file mode 100644 index 00000000000..c3f4a891cca --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_temp_fail.opt @@ -0,0 +1 @@ +--innodb_sort_buffer_size=64k diff --git a/mysql-test/suite/innodb/t/alter_temp_fail.test b/mysql-test/suite/innodb/t/alter_temp_fail.test new file mode 100644 index 00000000000..938a3165aaa --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_temp_fail.test @@ -0,0 +1,30 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/have_debug.inc +--echo # +--echo # MDEV-36017 Alter table aborts when temporary +--echo # directory is full +--echo # +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), + f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +SEND ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10)); + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 SELECT * FROM t1; +SET STATEMENT DEBUG_DBUG="+d,os_file_write_fail" FOR COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_TEMP_FILE_WRITE_FAILURE +reap; +disconnect con1; +CHECK TABLE t1; +DROP TABLE t1; + +SET STATEMENT DEBUG_DBUG="+d,ddl_log_write_fail" FOR +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +DROP TABLE t1; diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index b210f68a203..b50456755eb 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -3029,13 +3029,15 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state, error= ((ddl_log_write_entry(ddl_log_entry, &log_entry)) || ddl_log_write_execute_entry(log_entry->entry_pos, &ddl_state->execute_entry)); - mysql_mutex_unlock(&LOCK_gdl); + DBUG_EXECUTE_IF("ddl_log_write_fail", error= true;); if (error) { if (log_entry) ddl_log_release_memory_entry(log_entry); + mysql_mutex_unlock(&LOCK_gdl); DBUG_RETURN(1); } + mysql_mutex_unlock(&LOCK_gdl); add_log_entry(ddl_state, log_entry); ddl_state->flags|= ddl_log_entry->flags; // Update cache DBUG_RETURN(0); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 6a57f2dc307..9a97651eb36 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3696,8 +3696,10 @@ btr_cur_optimistic_update( *offsets = rec_get_offsets(rec, index, *offsets, index->n_core_fields, ULINT_UNDEFINED, heap); #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG + /* Blob pointer can be null if InnoDB was killed or + ran out of space while allocating a page. */ ut_a(!rec_offs_any_null_extern(rec, *offsets) - || thr_get_trx(thr) == trx_roll_crash_recv_trx); + || thr_get_trx(thr)->in_rollback); #endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */ if (UNIV_LIKELY(!update->is_metadata()) @@ -4370,7 +4372,12 @@ btr_cur_pessimistic_update( cursor, offsets, offsets_heap, new_entry, &rec, &dummy_big_rec, n_ext, NULL, mtr); - ut_a(err == DB_SUCCESS); + if (err) { + /* This should happen when InnoDB tries to extend the + tablespace */ + ut_ad(err == DB_OUT_OF_FILE_SPACE); + return err; + } ut_a(rec); ut_a(dummy_big_rec == NULL); ut_ad(rec_offs_validate(rec, cursor->index(), *offsets)); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 37bc74233de..63b0c3414c5 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -591,7 +591,7 @@ fil_space_extend_must_retry( *success = os_file_set_size(node->name, node->handle, new_size, node->punch_hole == 1); - os_has_said_disk_full = *success; + os_has_said_disk_full = !*success; if (*success) { os_file_flush(node->handle); last_page_no = size; diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 702e7098839..ab049a11018 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -398,12 +398,17 @@ start_log: } log->tail.blocks++; + DBUG_EXECUTE_IF("os_file_write_fail", + log->error = DB_TEMP_FILE_WRITE_FAIL; + goto write_failed;); + if (os_file_write( IORequestWrite, "(modification log)", log->fd, buf, byte_offset, srv_sort_buf_size) != DB_SUCCESS) { + log->error = DB_TEMP_FILE_WRITE_FAIL; write_failed: index->type |= DICT_CORRUPT; } diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index fe766b8313e..7f677d1c2f7 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -1128,9 +1128,8 @@ row_undo_mod_upd_exist_sec( dtuple_t* entry = row_build_index_entry( node->row, node->ext, index, heap); if (UNIV_UNLIKELY(!entry)) { - /* The server must have crashed in - row_upd_clust_rec_by_insert() before - the updated externally stored columns (BLOBs) + /* InnoDB must have run of space or been killed + before the updated externally stored columns (BLOBs) of the new clustered index entry were written. */ /* The table must be in DYNAMIC or COMPRESSED @@ -1138,19 +1137,6 @@ row_undo_mod_upd_exist_sec( store a local 768-byte prefix of each externally stored column. */ ut_a(dict_table_has_atomic_blobs(index->table)); - - /* This is only legitimate when - rolling back an incomplete transaction - after crash recovery. */ - ut_a(thr_get_trx(thr)->is_recovered); - - /* The server must have crashed before - completing the insert of the new - clustered index entry and before - inserting to the secondary indexes. - Because node->row was not yet written - to this index, we can ignore it. But - we must restore node->undo_row. */ } else { /* NOTE that if we updated the fields of a delete-marked secondary index record so that diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 03118fb25f2..e7fa4aa71a4 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1414,16 +1414,11 @@ row_upd_changes_ord_field_binary_func( if (UNIV_LIKELY_NULL(buf)) { if (UNIV_UNLIKELY(buf == field_ref_zero)) { /* The externally stored field - was not written yet. This - record should only be seen by - trx_rollback_recovered() - when the server had crashed before - storing the field. */ - ut_ad(!thr - || thr->graph->trx->is_recovered); - ut_ad(!thr - || thr->graph->trx - == trx_roll_crash_recv_trx); + was not written yet. InnoDB must + have ran out of space or been killed + before storing the page */ + ut_ad(thr); + ut_ad(thr->graph->trx->in_rollback); return(TRUE); } From 8bc1643148f561e9f805225eaf335747441fbb25 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 25 May 2025 16:38:21 +0300 Subject: [PATCH 44/89] MDEV-36860 exec_REDO_LOGREC_REDO_REPAIR_TABLE: Assertion `maria_tmpdir' failed The problem was that aria_backup_client code did not intialize maria_tmpdir, which is used during recovery if repair table is needed to reconstruct indexes. --- extra/mariabackup/aria_backup_client.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/mariabackup/aria_backup_client.cc b/extra/mariabackup/aria_backup_client.cc index 25468148fe4..73fe7cb334d 100644 --- a/extra/mariabackup/aria_backup_client.cc +++ b/extra/mariabackup/aria_backup_client.cc @@ -955,6 +955,7 @@ void Backup::set_post_copy_table_hook(const post_copy_table_hook_t &hook) { bool prepare(const char *target_dir) { maria_data_root= (char *)target_dir; + maria_tmpdir= &mysql_tmpdir_list; if (maria_init()) die("Can't init Aria engine (%d)", errno); From d8962d138f73d37f219b6c1721e4bde37c398066 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Sun, 25 May 2025 09:12:00 +0530 Subject: [PATCH 45/89] MDEV-36017 Alter table aborts when temporary directory is full Problem: ======= - In 10.11, During Copy algorithm, InnoDB does use bulk insert for row by row insert operation. When temporary directory ran out of memory, row_mysql_handle_errors() fails to handle DB_TEMP_FILE_WRITE_FAIL. - During inplace algorithm, concurrent DML fails to write the log operation into the temporary file. InnoDB fail to mark the error for the online log. - ddl_log_write() releases the global ddl lock prematurely before release the log memory entry Fix: === row_mysql_handle_errors(): Rollback the transaction when InnoDB encounters DB_TEMP_FILE_WRITE_FAIL convert_error_code_to_mysql(): Report an aborted transaction when InnoDB encounters DB_TEMP_FILE_WRITE_FAIL during alter table algorithm=copy or innodb bulk insert operation row_log_online_op(): Mark the error in online log when InnoDB ran out of temporary space fil_space_extend_must_retry(): Mark the os_has_said_disk_full as true if os_file_set_size() fails btr_cur_pessimistic_update(): Return error code when btr_cur_pessimistic_insert() fails ddl_log_write(): Release the global ddl lock after releasing the log memory entry when error was encountered btr_cur_optimistic_update(): Relax the assertion that blob pointer can be null during rollback because InnoDB can ran out of space while allocating the external page ha_innobase::extra(): Rollback the transaction during DDL before calling convert_error_code_to_mysql(). row_undo_mod_upd_exist_sec(): Remove the assertion which says that InnoDB should fail to build index entry when rollbacking an incomplete transaction after crash recovery. This scenario can happen when InnoDB ran out of space. row_upd_changes_ord_field_binary_func(): Relax the assertion to make that externally stored field can be null when InnoDB ran out of space. --- mysql-test/suite/innodb/r/alloc_fail.result | 47 ++++++++++++++++++ mysql-test/suite/innodb/t/alloc_fail.opt | 2 + mysql-test/suite/innodb/t/alloc_fail.test | 55 +++++++++++++++++++++ sql/ddl_log.cc | 4 +- storage/innobase/btr/btr0cur.cc | 14 +++++- storage/innobase/fil/fil0fil.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 7 ++- storage/innobase/row/row0log.cc | 5 ++ storage/innobase/row/row0merge.cc | 3 ++ storage/innobase/row/row0mysql.cc | 1 + storage/innobase/row/row0umod.cc | 18 +------ storage/innobase/row/row0upd.cc | 15 ++---- 12 files changed, 142 insertions(+), 31 deletions(-) create mode 100644 mysql-test/suite/innodb/r/alloc_fail.result create mode 100644 mysql-test/suite/innodb/t/alloc_fail.opt create mode 100644 mysql-test/suite/innodb/t/alloc_fail.test diff --git a/mysql-test/suite/innodb/r/alloc_fail.result b/mysql-test/suite/innodb/r/alloc_fail.result new file mode 100644 index 00000000000..7bdd0d7ce72 --- /dev/null +++ b/mysql-test/suite/innodb/r/alloc_fail.result @@ -0,0 +1,47 @@ +# +# MDEV-36017 Alter table aborts when temporary +# directory is full +# +SET SESSION DEFAULT_STORAGE_ENGINE=InnoDB; +CREATE TABLE t1(f1 CHAR(100) NOT NULL, f2 CHAR(100) NOT NULL, +f3 CHAR(100) NOT NULL, f4 CHAR(100) NOT NULL, +f5 CHAR(100) NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 SELECT 'a', 'b', 'c', 'd', 'e' FROM seq_1_to_65536; +SET STATEMENT DEBUG_DBUG="+d,write_to_tmp_file_fail" FOR +CREATE TABLE t2 as SELECT * FROM t1; +ERROR HY000: Got error 59 'Temp file write failure' from InnoDB +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), +f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_1024; +SET STATEMENT DEBUG_DBUG="+d,write_to_tmp_file_fail" FOR +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +ERROR HY000: Got error 59 'Temp file write failure' from InnoDB +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), +f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10)); +connect con1,localhost,root,,,; +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 SELECT * FROM t1; +SET STATEMENT DEBUG_DBUG="+d,os_file_write_fail" FOR COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; +connection default; +ERROR HY000: Temporary file write failure +disconnect con1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET STATEMENT DEBUG_DBUG="+d,ddl_log_write_fail" FOR +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +DROP TABLE t1; +CREATE TABLE t1(f1 TEXT, index(f1(2)))ENGINE=InnoDB; +INSERT INTO t1 VALUES('a'); +set statement DEBUG_DBUG="+d,btr_page_alloc_fail" for +UPDATE t1 set f1= REPEAT('b', 12000); +ERROR HY000: The table 't1' is full +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alloc_fail.opt b/mysql-test/suite/innodb/t/alloc_fail.opt new file mode 100644 index 00000000000..7a3969d2a37 --- /dev/null +++ b/mysql-test/suite/innodb/t/alloc_fail.opt @@ -0,0 +1,2 @@ +--innodb_sort_buffer_size=64k +--innodb_rollback_on_timeout=1 diff --git a/mysql-test/suite/innodb/t/alloc_fail.test b/mysql-test/suite/innodb/t/alloc_fail.test new file mode 100644 index 00000000000..62350872e5e --- /dev/null +++ b/mysql-test/suite/innodb/t/alloc_fail.test @@ -0,0 +1,55 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/have_debug.inc +--echo # +--echo # MDEV-36017 Alter table aborts when temporary +--echo # directory is full +--echo # +SET SESSION DEFAULT_STORAGE_ENGINE=InnoDB; +CREATE TABLE t1(f1 CHAR(100) NOT NULL, f2 CHAR(100) NOT NULL, + f3 CHAR(100) NOT NULL, f4 CHAR(100) NOT NULL, + f5 CHAR(100) NOT NULL)ENGINE=InnoDB; +INSERT INTO t1 SELECT 'a', 'b', 'c', 'd', 'e' FROM seq_1_to_65536; +--error ER_GET_ERRMSG +SET STATEMENT DEBUG_DBUG="+d,write_to_tmp_file_fail" FOR +CREATE TABLE t2 as SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), + f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_1024; +--error ER_GET_ERRMSG +SET STATEMENT DEBUG_DBUG="+d,write_to_tmp_file_fail" FOR +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100), + f3 CHAR(100))ENGINE=InnoDB; +INSERT INTO t1 SELECT seq, 'a', 'b' FROM seq_1_to_4096; +SET DEBUG_SYNC="inplace_after_index_build SIGNAL dml_start WAIT_FOR dml_commit"; +SEND ALTER TABLE t1 ADD KEY(f1), ADD INDEX(f3(10)); + +connect(con1,localhost,root,,,); +SET DEBUG_SYNC="now WAIT_FOR dml_start"; +BEGIN; +INSERT INTO t1 SELECT * FROM t1; +SET STATEMENT DEBUG_DBUG="+d,os_file_write_fail" FOR COMMIT; +SET DEBUG_SYNC="now SIGNAL dml_commit"; + +connection default; +--error ER_TEMP_FILE_WRITE_FAILURE +reap; +disconnect con1; +CHECK TABLE t1; +DROP TABLE t1; + +SET STATEMENT DEBUG_DBUG="+d,ddl_log_write_fail" FOR +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +DROP TABLE t1; + +CREATE TABLE t1(f1 TEXT, index(f1(2)))ENGINE=InnoDB; +INSERT INTO t1 VALUES('a'); +--error ER_RECORD_FILE_FULL +set statement DEBUG_DBUG="+d,btr_page_alloc_fail" for +UPDATE t1 set f1= REPEAT('b', 12000); +DROP TABLE t1; diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index 7c844ed5905..647e7852645 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -3051,13 +3051,15 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state, error= ((ddl_log_write_entry(ddl_log_entry, &log_entry)) || ddl_log_write_execute_entry(log_entry->entry_pos, 0, &ddl_state->execute_entry)); - mysql_mutex_unlock(&LOCK_gdl); + DBUG_EXECUTE_IF("ddl_log_write_fail", error= true;); if (error) { if (log_entry) ddl_log_release_memory_entry(log_entry); + mysql_mutex_unlock(&LOCK_gdl); DBUG_RETURN(1); } + mysql_mutex_unlock(&LOCK_gdl); ddl_log_add_entry(ddl_state, log_entry); ddl_state->flags|= ddl_log_entry->flags; // Update cache DBUG_RETURN(0); diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index c55f0aaf59e..5348a67e8c9 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3697,8 +3697,10 @@ btr_cur_optimistic_update( *offsets = rec_get_offsets(rec, index, *offsets, index->n_core_fields, ULINT_UNDEFINED, heap); #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG + /* Blob pointer can be null if InnoDB was killed or + ran out of space while allocating a page. */ ut_a(!rec_offs_any_null_extern(rec, *offsets) - || thr_get_trx(thr) == trx_roll_crash_recv_trx); + || thr_get_trx(thr)->in_rollback); #endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */ if (UNIV_LIKELY(!update->is_metadata()) @@ -4371,7 +4373,12 @@ btr_cur_pessimistic_update( cursor, offsets, offsets_heap, new_entry, &rec, &dummy_big_rec, n_ext, NULL, mtr); - ut_a(err == DB_SUCCESS); + if (err) { + /* This should happen when InnoDB tries to extend the + tablespace */ + ut_ad(err == DB_OUT_OF_FILE_SPACE); + return err; + } ut_a(rec); ut_a(dummy_big_rec == NULL); ut_ad(rec_offs_validate(rec, cursor->index(), *offsets)); @@ -6240,6 +6247,9 @@ btr_store_big_rec_extern_fields( FSP_NO_DIR, 0, &mtr, &mtr, &error); + DBUG_EXECUTE_IF("btr_page_alloc_fail", + block= nullptr; + error= DB_OUT_OF_FILE_SPACE;); if (!block) { alloc_fail: mtr.commit(); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 4ba3183e371..39d6096e9cd 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -605,7 +605,7 @@ fil_space_extend_must_retry( *success = os_file_set_size(node->name, node->handle, new_size, node->punch_hole == 1); - os_has_said_disk_full = *success; + os_has_said_disk_full = !*success; if (*success) { os_file_flush(node->handle); last_page_no = size; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d03ef08d1db..bf3511f6551 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2161,6 +2161,11 @@ convert_error_code_to_mysql( return(HA_ERR_RECORD_FILE_FULL); case DB_TEMP_FILE_WRITE_FAIL: + /* This error can happen during + copy_data_between_tables() or bulk insert operation */ + innodb_transaction_abort(thd, + innobase_rollback_on_timeout, + error); my_error(ER_GET_ERRMSG, MYF(0), DB_TEMP_FILE_WRITE_FAIL, ut_strerr(DB_TEMP_FILE_WRITE_FAIL), @@ -15931,7 +15936,7 @@ ha_innobase::extra( } m_prebuilt->table->skip_alter_undo = 0; if (dberr_t err= trx->bulk_insert_apply()) { - m_prebuilt->table->skip_alter_undo = 0; + trx->rollback(); return convert_error_code_to_mysql( err, m_prebuilt->table->flags, trx->mysql_thd); diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index a0135e4be03..8337d170e76 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -398,12 +398,17 @@ start_log: } log->tail.blocks++; + DBUG_EXECUTE_IF("os_file_write_fail", + log->error = DB_TEMP_FILE_WRITE_FAIL; + goto write_failed;); + if (os_file_write( IORequestWrite, "(modification log)", log->fd, buf, byte_offset, srv_sort_buf_size) != DB_SUCCESS) { + log->error = DB_TEMP_FILE_WRITE_FAIL; write_failed: index->type |= DICT_CORRUPT; } diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index fba8467f095..c180b8ac961 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -5177,6 +5177,9 @@ dberr_t row_merge_bulk_t::write_to_tmp_file(ulint index_no) m_block, m_crypt_block, buf->index->table->space->id)) return DB_TEMP_FILE_WRITE_FAIL; + + DBUG_EXECUTE_IF("write_to_tmp_file_fail", + return DB_TEMP_FILE_WRITE_FAIL;); MEM_UNDEFINED(&m_block[0], srv_sort_buf_size); return DB_SUCCESS; } diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index f93ad6eb3ee..7992866df67 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -708,6 +708,7 @@ handle_new_error: case DB_DEADLOCK: case DB_RECORD_CHANGED: case DB_LOCK_TABLE_FULL: + case DB_TEMP_FILE_WRITE_FAIL: rollback: /* Roll back the whole transaction; this resolution was added to version 3.23.43 */ diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index fa228cba93a..24d7283bfc0 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -1130,9 +1130,8 @@ row_undo_mod_upd_exist_sec( dtuple_t* entry = row_build_index_entry( node->row, node->ext, index, heap); if (UNIV_UNLIKELY(!entry)) { - /* The server must have crashed in - row_upd_clust_rec_by_insert() before - the updated externally stored columns (BLOBs) + /* InnoDB must have run of space or been killed + before the updated externally stored columns (BLOBs) of the new clustered index entry were written. */ /* The table must be in DYNAMIC or COMPRESSED @@ -1140,19 +1139,6 @@ row_undo_mod_upd_exist_sec( store a local 768-byte prefix of each externally stored column. */ ut_a(dict_table_has_atomic_blobs(index->table)); - - /* This is only legitimate when - rolling back an incomplete transaction - after crash recovery. */ - ut_a(thr_get_trx(thr)->is_recovered); - - /* The server must have crashed before - completing the insert of the new - clustered index entry and before - inserting to the secondary indexes. - Because node->row was not yet written - to this index, we can ignore it. But - we must restore node->undo_row. */ } else { /* NOTE that if we updated the fields of a delete-marked secondary index record so that diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 2c40fdf32d4..2b37045d222 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1414,16 +1414,11 @@ row_upd_changes_ord_field_binary_func( if (UNIV_LIKELY_NULL(buf)) { if (UNIV_UNLIKELY(buf == field_ref_zero)) { /* The externally stored field - was not written yet. This - record should only be seen by - trx_rollback_recovered() - when the server had crashed before - storing the field. */ - ut_ad(!thr - || thr->graph->trx->is_recovered); - ut_ad(!thr - || thr->graph->trx - == trx_roll_crash_recv_trx); + was not written yet. InnoDB must + have ran out of space or been killed + before storing the page */ + ut_ad(thr); + ut_ad(thr->graph->trx->in_rollback); return(TRUE); } From db188083c38a9aeba146c9d591e3ed12cce0b200 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 26 May 2025 11:48:07 +0530 Subject: [PATCH 46/89] MDEV-36771 Assertion 'bulk_insert == TRX_NO_BULK' failed in trx_t::assert_freed - InnoDB fails to reset bulk_insert of a transaction while freeing the transaction during shutting down of a server. --- .../suite/innodb/r/insert_into_empty.result | 16 ++++++++++++++++ mysql-test/suite/innodb/t/insert_into_empty.test | 15 +++++++++++++++ storage/innobase/trx/trx0trx.cc | 1 + 3 files changed, 32 insertions(+) diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index b9cfe965c13..19e5267a1b7 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -580,4 +580,20 @@ WHERE variable_name = 'innodb_bulk_operations'; bulk_operations 1 DROP TABLE t1; +call mtr.add_suppression("Found 1 prepared XA transactions"); +# +# MDEV-36771 Assertion `bulk_insert == TRX_NO_BULK' failed +# in trx_t::assert_freed from innodb_shutdown +# +CREATE TABLE t1(f1 INT)ENGINE=InnoDB; +XA START 'a'; +INSERT INTO t1 VALUES(1); +XA END 'a'; +XA PREPARE 'a'; +# restart +XA COMMIT 'a'; +SELECT * FROM t1; +f1 +1 +DROP TABLE t1; # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index de36ccdb85f..e31b680ebe8 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -638,4 +638,19 @@ SELECT variable_value-@old_bulk_op bulk_operations FROM information_schema.global_status WHERE variable_name = 'innodb_bulk_operations'; DROP TABLE t1; + +call mtr.add_suppression("Found 1 prepared XA transactions"); +--echo # +--echo # MDEV-36771 Assertion `bulk_insert == TRX_NO_BULK' failed +--echo # in trx_t::assert_freed from innodb_shutdown +--echo # +CREATE TABLE t1(f1 INT)ENGINE=InnoDB; +XA START 'a'; +INSERT INTO t1 VALUES(1); +XA END 'a'; +XA PREPARE 'a'; +--source include/restart_mysqld.inc +XA COMMIT 'a'; +SELECT * FROM t1; +DROP TABLE t1; --echo # End of 10.11 tests diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 28b7fed90cd..725a6d95a0f 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -515,6 +515,7 @@ TRANSACTIONAL_TARGET void trx_free_at_shutdown(trx_t *trx) ut_a(trx->magic_n == TRX_MAGIC_N); ut_d(trx->apply_online_log = false); + trx->bulk_insert = 0; trx->commit_state(); trx->release_locks(); trx->mod_tables.clear(); From 59ee33e14ec6e7e914bc7a473685db4827d09fd6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 21 May 2025 16:32:23 +0200 Subject: [PATCH 47/89] MDEV-32189 follow-up: Properly initialize UErrorCode for ucal_getDefaultTimeZone() Initialize UErrorCode to U_ZERO_ERROR before passing it to ucal_getDefaultTimeZone(), as required by the ICU conventions. Passing an uninitialized status variable leads to undefined behavior and non-deterministic failures. This issue was not observed on x64 builds, but appeared during Windows/ARM64 CI testing. The lack of initialization led to inconsistent fallback between ICU and native Windows time zone. mtr tests with restarts showed the alternation of system_time_zone, as reported by check_testcase after the test. -SYSTEM_TIME_ZONE Coordinated Universal Time +SYSTEM_TIME_ZONE Etc/UTC --- mysys/my_timezone.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_timezone.cc b/mysys/my_timezone.cc index d155f014e93..a0cf106a796 100644 --- a/mysys/my_timezone.cc +++ b/mysys/my_timezone.cc @@ -159,7 +159,7 @@ extern "C" void my_tzname(char* sys_timezone, size_t size) { /* TZ environment variable not set - return default timezone name*/ UChar default_tzname[MAX_TIMEZONE_LEN]; - UErrorCode ec; + UErrorCode ec= U_ZERO_ERROR; int32_t len= ucal_getDefaultTimeZone(default_tzname, MAX_TIMEZONE_LEN, &ec); if (U_SUCCESS(ec)) From 4af231b1d113a818481fdffc24001c6b19b3f250 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 21 May 2025 21:12:40 +0200 Subject: [PATCH 48/89] Windows/ARM64 - workaround compiler bug Follow-up 9e1c1d429f51042 Item_func_hybrid_field_type::val_real_from_int_op() might return wrong result. This makes mtr fail on Windows/ARM , at least in main.func_format and main.sp-vars Many to Chengya/coneco-cy for debugging the issue and finding the cause. --- sql/item_func.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sql/item_func.cc b/sql/item_func.cc index 01d46fa2a44..89fee193cea 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -843,12 +843,22 @@ String *Item_func_hybrid_field_type::val_str_from_int_op(String *str) return str; } +#ifdef _M_ARM64 +/* MSVC on ARM incorrectly optimizes the code in val_real_from_int_op() */ +#pragma optimize("", off) +#endif + double Item_func_hybrid_field_type::val_real_from_int_op() { longlong result= int_op(); return unsigned_flag ? (double) ((ulonglong) result) : (double) result; } +#ifdef _M_ARM64 +#pragma optimize("", on) +#endif + + my_decimal * Item_func_hybrid_field_type::val_decimal_from_int_op(my_decimal *dec) { From be48b3ee59a95fb4427fa56d0f250315e39bd802 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 22 May 2025 07:17:22 +0000 Subject: [PATCH 49/89] Fix mariadb-upgrade-service crash on Windows/ARM64 Properly align stack buffer struct alignment Fixes crash on Windows with clang/ARM64 --- sql/mysql_upgrade_service.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc index 5492bccd239..31366154c7f 100644 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@ -343,7 +343,7 @@ static void get_service_config() if (!service) die("OpenService failed with %u", GetLastError()); - BYTE config_buffer[8 * 1024]; + alignas(QUERY_SERVICE_CONFIGW) BYTE config_buffer[8 * 1024]; LPQUERY_SERVICE_CONFIGW config = (LPQUERY_SERVICE_CONFIGW)config_buffer; DWORD size = sizeof(config_buffer); DWORD needed; From d665810cf0ff816e17e866895d7d76ae6b16a1ed Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 23 May 2025 14:47:00 +0200 Subject: [PATCH 50/89] Windows/ARM64 - fix build with clang-cl --- cmake/os/Windows.cmake | 3 +-- mysys/CMakeLists.txt | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index cdb16cde468..16b3b9af733 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -174,10 +174,9 @@ if(MSVC) -Wno-unused-local-typedef -Wno-microsoft-static-assert -Wno-c++17-extensions - -msse4.2 ) if((CMAKE_SIZEOF_VOID_P MATCHES 8) AND MSVC_INTEL) - add_compile_options(-mpclmul) + add_compile_options(-mpclmul -msse4.2) endif() endif() diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 7e662e1046a..9e909758166 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -69,6 +69,13 @@ IF(MSVC_INTEL) ELSEIF(MSVC_ARM64) SET (MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_arm64.c) ADD_DEFINITIONS(-DHAVE_ARMV8_CRC -DHAVE_ARMV8_CRC_CRYPTO_INTRINSICS) + IF(CLANG_CL) + SET_SOURCE_FILES_PROPERTIES( + crc32/crc32_arm64.c + PROPERTIES + COMPILE_FLAGS "-march=armv8-a+crc" + ) + ENDIF() ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|i386|i686") SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c crc32/crc32c_x86.cc) IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5") From aba04c562bdda946392c04b10e253c3e35cfb946 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 26 May 2025 16:26:03 +0200 Subject: [PATCH 51/89] Compiling - fix warnings with MSVC 17.14 New warnings come from 3 places 1. Warning C5287: Warning comes from json_lib.c from code like compile_time_assert((int) JSON_VALUE_NULL == (int) JSV_NULL); 2. Warning C5287: Similar warning come from wc_static_assert() from code in wolfSSL's header file 3. Warning C5286 in WolfSSL code, -enum_value (i.e multiplying enum with -1)is used To fix: - Disable warnings in WolfSSL code, using /wd flag. - workaround warning for users of WolfSSL, disable wc_static_assert() with -DWC_NO_STATIC_ASSERT compile flag - Rewrite some compile_time_assert in json_lib.c to avoid warning. - add target_link_libraries(vio ${SSL_LIBRARIES}) so that vio picks up -DWC_NO_STATIC_ASSERT --- extra/wolfssl/CMakeLists.txt | 3 ++- strings/json_lib.c | 14 +++++++------- vio/CMakeLists.txt | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/extra/wolfssl/CMakeLists.txt b/extra/wolfssl/CMakeLists.txt index dc2f8092762..38203a07911 100644 --- a/extra/wolfssl/CMakeLists.txt +++ b/extra/wolfssl/CMakeLists.txt @@ -126,7 +126,8 @@ endif() # Silence some warnings if(MSVC) # truncation warnings - target_compile_options(wolfssl PRIVATE $<$:/wd4244>) + target_compile_options(wolfssl PRIVATE $<$:/wd4244 /wd5287 /wd5286>) + target_compile_definitions(wolfssl PUBLIC WC_NO_STATIC_ASSERT) if(CMAKE_C_COMPILER_ID MATCHES Clang) target_compile_options(wolfssl PRIVATE $<$:-Wno-incompatible-function-pointer-types>) endif() diff --git a/strings/json_lib.c b/strings/json_lib.c index a04cee573c6..5f55a83c9d4 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -1788,13 +1788,13 @@ static enum json_types smart_read_value(json_engine_t *je, *value_len= (int) ((char *) je->s.c_str - *value); } - compile_time_assert((int) JSON_VALUE_OBJECT == (int) JSV_OBJECT); - compile_time_assert((int) JSON_VALUE_ARRAY == (int) JSV_ARRAY); - compile_time_assert((int) JSON_VALUE_STRING == (int) JSV_STRING); - compile_time_assert((int) JSON_VALUE_NUMBER == (int) JSV_NUMBER); - compile_time_assert((int) JSON_VALUE_TRUE == (int) JSV_TRUE); - compile_time_assert((int) JSON_VALUE_FALSE == (int) JSV_FALSE); - compile_time_assert((int) JSON_VALUE_NULL == (int) JSV_NULL); + compile_time_assert((enum json_types)JSON_VALUE_OBJECT == JSV_OBJECT); + compile_time_assert((enum json_types)JSON_VALUE_ARRAY == JSV_ARRAY); + compile_time_assert((enum json_types)JSON_VALUE_STRING == JSV_STRING); + compile_time_assert((enum json_types)JSON_VALUE_NUMBER == JSV_NUMBER); + compile_time_assert((enum json_types)JSON_VALUE_TRUE == JSV_TRUE); + compile_time_assert((enum json_types)JSON_VALUE_FALSE == JSV_FALSE); + compile_time_assert((enum json_types)JSON_VALUE_NULL == JSV_NULL); return (enum json_types) je->value_type; diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt index 85810840273..e7987cb9c2f 100644 --- a/vio/CMakeLists.txt +++ b/vio/CMakeLists.txt @@ -20,3 +20,4 @@ ADD_DEFINITIONS(${SSL_DEFINES}) SET(VIO_SOURCES vio.c viosocket.c viossl.c viopipe.c viosslfactories.c) ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES}) TARGET_LINK_LIBRARIES(vio ${LIBSOCKET}) +TARGET_LINK_LIBRARIES(vio ${SSL_LIBRARIES}) From aaccf99fdbd3b547d96462a0700c53e63b5b9247 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 23 May 2025 09:19:08 +0200 Subject: [PATCH 52/89] MDEV-36885 Windows/ARM64 - build and test on CI Add corresponding workflow for Github Actions. --- .github/workflows/windows-arm64.yml | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/windows-arm64.yml diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml new file mode 100644 index 00000000000..26c9154a728 --- /dev/null +++ b/.github/workflows/windows-arm64.yml @@ -0,0 +1,51 @@ +name: Build on Windows ARM64 + +on: + push: + branches: + - 'main' + - 'bb-*' + - '[0-9]+.[0-9]+' + - '*wlad*' + pull_request: + +jobs: + build: + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + + runs-on: windows-11-arm + + steps: + - name: Configure git + run: | + # We won't be able to successfully run mtr + # unless we configure autocrlf. + git config --global core.autocrlf input + + - uses: actions/checkout@v4 + + - name: Install prerequisites + run: | + # Install bison to compile + choco install winflexbison3 + + - name: Build + run: | + # speedup checkout by excluding uninteresting modules + git config submodule.storage/columnstore/columnstore.update none + git config submodule.storage/maria/libmarias3.update none + git config submodule.storage/rocksdb/rocksdb.update none + git config submodule.wsrep-lib.update none + mkdir bld + cd bld + cmake .. -DWITH_SSL=bundled + cmake --build . --config RelWithDebinfo --verbose -- -m + + - name: Test MTR + run: | + $env:PATH = "C:\Strawberry\perl\bin;$env:PATH;C:\Program Files (x86)\Windows Kits\10\Debuggers\arm64" + #Calculate parallel as 4 * number of processors + $parallel = 4 * [int]$env:NUMBER_OF_PROCESSORS + perl bld\mysql-test\mysql-test-run.pl --force --parallel=$parallel --suite=main --mysqld=--loose-innodb-flush-log-at-trx-commit=2 From 507cbde68f337cc34bc1c95ce9c959247975dc80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 27 May 2025 08:05:19 +0300 Subject: [PATCH 53/89] MDEV-36882: Inconsistent DBUG_ASSERT trips GCC -Og my_time_fraction_remainder(): Remove a DBUG_ASSERT, because there is none in sec_part_shift() or sec_part_unshift() either. A buffer overflow should be caught by cmake -DWITH_ASAN=ON in all three. This fixes a build with GCC 14.2 and cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-Og. Reviewed by: Daniel Black --- include/my_time.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/my_time.h b/include/my_time.h index 9f3e61b944f..90a8885a293 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -230,7 +230,6 @@ static inline longlong sec_part_unshift(longlong second_part, uint digits) /* Date/time rounding and truncation functions */ static inline long my_time_fraction_remainder(long nr, uint decimals) { - DBUG_ASSERT(decimals <= TIME_SECOND_PART_DIGITS); return nr % (long) log_10_int[TIME_SECOND_PART_DIGITS - decimals]; } static inline void my_datetime_trunc(MYSQL_TIME *ltime, uint decimals) From fe10645eb73c8f57405658379aa34b3392081707 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 27 May 2025 10:20:31 +0200 Subject: [PATCH 54/89] MDEV-26713 post-fix: don't run charset_client_win_utf8mb4.test in parallel mtr chcp command affects console codepage, console is shared among all mtr processes. --- mysql-test/main/charset_client_win_utf8mb4.test | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mysql-test/main/charset_client_win_utf8mb4.test b/mysql-test/main/charset_client_win_utf8mb4.test index e08afa250bd..c2bb2464cd7 100644 --- a/mysql-test/main/charset_client_win_utf8mb4.test +++ b/mysql-test/main/charset_client_win_utf8mb4.test @@ -1,5 +1,11 @@ --source include/windows.inc --source include/check_utf8_cli.inc + +if(!`select $MTR_PARALLEL = 1`) +{ + skip race condition with parallel tests; +} + --exec $MYSQL --default-character-set=auto -e "select @@character_set_client" # Test that a user with old, non-UTF8 password can still connect From df414933f1962a0956931453fe3a8b93afd017cc Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 23 May 2025 20:02:45 +1000 Subject: [PATCH 55/89] MDEV-36316/MDEV-36327/MDEV-36328 Debug msan Clang ~16+ on MSAN became quite strict with uninitalized data being passed and returned from functions. Non-debug builds have a basic optimization that hides these from those builds Two innodb cases violate the assumptions, however once inlined with a basic optimization those that existed for uninitialized values are removed. (MDEV-36316) rec_set_bit_field_2 calling mach_read_from_2 hits a read of bits it wasn't actually changing. (MDEV-36327) The function dict_process_sys_columns_rec left nth_v_col uninitialized unless it was a virtual column. This was ok as the function i_s_sys_columns_fill_table also didn't read this value unless it was a virtual column. --- extra/CMakeLists.txt | 8 ++++++++ storage/innobase/CMakeLists.txt | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 06dc8900968..00fe76433ca 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -82,6 +82,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE) ) + # clang ~16+ with return values being undefined is resolved by basic optimization + # compiler flags for the function mach_read_from_2 (per MDEV-36316) + IF(WITH_MSAN AND CMAKE_BUILD_TYPE STREQUAL "Debug") + SET_SOURCE_FILES_PROPERTIES( + ${INNOBASE_SOURCES} + innochecksum.cc + PROPERTIES COMPILE_FLAGS -Og) + ENDIF() MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.cc ${INNOBASE_SOURCES}) TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl) ADD_DEPENDENCIES(innochecksum GenError) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 37b2703e171..122cdb73342 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -473,6 +473,42 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" ) ENDIF() +# clang ~16+ with return values being uninitialized is resolved by basic optimization +# compiler flags. The inlining of these function means the uninitalized paths are +# elimated from mach_read_from_2 (per MDEV-36316) and i_s_dict_fill_sys_columns MDEV-36327 +IF(WITH_MSAN AND CMAKE_BUILD_TYPE STREQUAL "Debug") + SET_SOURCE_FILES_PROPERTIES( + btr/btr0btr.cc + btr/btr0bulk.cc + data/data0data.cc + dict/dict0load.cc + dict/dict0mem.cc + fil/fil0crypt.cc + fil/fil0pagecompress.cc + fsp/fsp0fsp.cc + fut/fut0lst.cc + gis/gis0rtree.cc + handler/ha_innodb.cc + handler/i_s.cc + ibuf/ibuf0ibuf.cc + log/log0recv.cc + page/page0cur.cc + page/page0page.cc + page/page0zip.cc + rem/rem0rec.cc + row/row0import.cc + row/row0mysql.cc + row/row0purge.cc + row/row0uins.cc + row/row0undo.cc + row/row0upd.cc + trx/trx0purge.cc + trx/trx0rec.cc + trx/trx0trx.cc + trx/trx0undo.cc + PROPERTIES COMPILE_FLAGS -Og) +ENDIF() + # Older gcc version insist on -mhtm flag for including the # htmxlintrin.h header. This is also true for new gcc versions # like 11.2.0 in Debian Sid From 50124023301a1a094a07b7c5482e3000d3436482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 23 May 2025 19:55:20 +1000 Subject: [PATCH 56/89] MDEV-34388 Alpine Stack Overflow - reduce Grant_tables::open_and_lock The stacksize was still too large. Back port from the 10.11 merge commit 1c7209e828139236c4e8561a26cc88568e23e2f1 --- sql/sql_acl.cc | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index b783c562b74..b61f18c41cc 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2012,13 +2012,25 @@ class Grant_tables { DBUG_ENTER("Grant_tables::open_and_lock"); - TABLE_LIST tables[USER_TABLE+1], *first= NULL; + TABLE_LIST *first= nullptr, *tables= + static_cast(my_malloc(PSI_NOT_INSTRUMENTED, + (USER_TABLE + 1) * sizeof *tables, + MYF(MY_WME))); + int res= -1; + + if (!tables) + { + func_exit: + my_free(tables); + DBUG_RETURN(res); + } + if (build_table_list(thd, &first, which_tables, lock_type, tables)) - DBUG_RETURN(-1); + goto func_exit; uint counter; - int res= really_open(thd, first, &counter); + res= really_open(thd, first, &counter); /* if User_table_json wasn't found, let's try User_table_tabular */ if (!res && (which_tables & Table_user) && !tables[USER_TABLE].table) @@ -2044,12 +2056,15 @@ class Grant_tables } } if (res) - DBUG_RETURN(res); + goto func_exit; if (lock_tables(thd, first, counter, MYSQL_LOCK_IGNORE_TIMEOUT | MYSQL_OPEN_IGNORE_LOGGING_FORMAT)) - DBUG_RETURN(-1); + { + res= -1; + goto func_exit; + } p_user_table->set_table(tables[USER_TABLE].table); m_db_table.set_table(tables[DB_TABLE].table); @@ -2059,7 +2074,7 @@ class Grant_tables m_procs_priv_table.set_table(tables[PROCS_PRIV_TABLE].table); m_proxies_priv_table.set_table(tables[PROXIES_PRIV_TABLE].table); m_roles_mapping_table.set_table(tables[ROLES_MAPPING_TABLE].table); - DBUG_RETURN(0); + goto func_exit; } inline const User_table& user_table() const From 8490901307b062873d97f216160a3e479ba0463e Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 23 May 2025 19:59:58 +1000 Subject: [PATCH 57/89] MDEV-34388: Stack overflow on Alpine Linux (postfix - ASAN/MSAN+Debug) In original fix, commit 82d7419e0600a70b1a1c993d33ed6cf79fbd6129, a 16k stack frame limit was imposed. Under the stack usage is doubled due to MSAN. Debug builds without optimization can use more as well. ASAN Debug builds also exceeded the 16k stack frame limit. To keep some safety limit, a 64k limit is imposed to the compiler under MSAN or ASAN with CMAKE_BUILD_TYPE=Debug. --- cmake/maintainer.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 5ca870b771c..5debb42897a 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -19,6 +19,12 @@ IF(MSVC OR MYSQL_MAINTAINER_MODE STREQUAL "NO") RETURN() ENDIF() +IF((WITH_MSAN OR WITH_ASAN) AND CMAKE_BUILD_TYPE STREQUAL "Debug") + SET(STACK_FRAME_LIMIT 65536) +ELSE() + SET(STACK_FRAME_LIMIT 16384) +ENDIF() + # Common warning flags for GCC, G++, Clang and Clang++ SET(MY_WARNING_FLAGS -Wall @@ -41,7 +47,7 @@ SET(MY_WARNING_FLAGS -Wvla -Wwrite-strings -Wcast-function-type-strict - -Wframe-larger-than=16384 + -Wframe-larger-than=${STACK_FRAME_LIMIT} ) # Warning flags that are in testing before moving From 2811559337afc964b0d512fba3a303f541190a82 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 24 May 2025 15:55:29 +1000 Subject: [PATCH 58/89] version string - memory sanitizer isn't the same as valgrind Despite being included in the HAVE_valgrind define. As such it's best differenciated from valgrind in the server identifier as they have for the purposes a distinct and different set of behaviours. MSAN has its own set of test inclusions that that are different from valgrind and such including "valgrind" in a server string that gets tested for valgrind will incorrectly exclude some tests that are suitable for MSAN but not valgrind. There's a have_sanitizer system variable for exposing the sanitizer being used so there's no need for version verboseness. Correct have_sanitizer system variable description to include MSAN has been possible for a while. --- sql/mysqld.cc | 2 +- sql/sys_vars.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 138cc52db27..5707ce90349 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8778,7 +8778,7 @@ char *set_server_version(char *buf, size_t size) bool is_log= opt_log || global_system_variables.sql_log_slow || opt_bin_log; bool is_debug= IF_DBUG(!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug"), 0); const char *is_valgrind= -#ifdef HAVE_valgrind +#if defined(HAVE_valgrind) && !__has_feature(memory_sanitizer) !strstr(MYSQL_SERVER_SUFFIX_STR, "-valgrind") ? "-valgrind" : #endif ""; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 9477a26beec..5fe3eb4586b 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5231,7 +5231,8 @@ static Sys_var_charptr Sys_have_santitizer( "have_sanitizer", "If the server is compiled with sanitize (compiler option), this " "variable is set to the sanitizer mode used. Possible values are " - "ASAN (Address sanitizer) or UBSAN (The Undefined Behavior Sanitizer).", + "ASAN (Address sanitizer) and/or UBSAN (Undefined Behavior Sanitizer)," + " or MSAN (memory sanitizer).", READ_ONLY GLOBAL_VAR(have_sanitizer), NO_CMD_LINE, DEFAULT(SANITIZER_MODE)); #endif /* defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN) */ From 8d2665e56b1298bb0a4daed671b38be92258695c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 20 Mar 2025 09:24:37 +1100 Subject: [PATCH 59/89] MDEV-34388 default stack size under MSAN needs increasing Without this increase the mtr test case pre/post conditions will fail as the stack usage has increased under MSAN with clang-20.1. ASAN takes a 11M stack, however there was no obvious gain in MSAN test success after 2M. The resulting behaviour observed on smaller stack size was a SEGV normally. Hide the default stack size from the sysvar tests that expose thread-stack as a variable with its default value. --- include/my_pthread.h | 12 +++++++++++- mysql-test/main/mysqld--help.result | 1 - mysql-test/main/mysqld--help.test | 2 +- mysql-test/suite/sys_vars/t/thread_stack_basic.test | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/my_pthread.h b/include/my_pthread.h index 5dceacb6399..9157e8204bc 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -668,7 +668,17 @@ extern void my_mutex_end(void); We need to have at least 256K stack to handle calls to myisamchk_init() with the current number of keys and key parts. */ -# if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN) +#if !defined(__has_feature) +#define __has_feature(x) 0 +#endif +#if defined(__clang__) && __has_feature(memory_sanitizer) && !defined(DBUG_OFF) +/* + MSAN in Debug with clang-20.1 required more memory to complete + mtr begin/end checks. The result without increase was MSAN + errors triggered on a call instruction. +*/ +# define DEFAULT_THREAD_STACK (2L<<20) +# elif defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN) /* Optimized WITH_ASAN=ON executables produced by GCC 12.3.0, GCC 13.2.0, or clang 16.0.6 diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index abe7c10952b..7ce8ef6cd97 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1891,7 +1891,6 @@ thread-pool-oversubscribe 3 thread-pool-prio-kickup-timer 1000 thread-pool-priority auto thread-pool-stall-limit 500 -thread-stack 299008 time-format %H:%i:%s tmp-disk-table-size 18446744073709551615 tmp-memory-table-size 16777216 diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test index 44449cd3ad5..ce75924c757 100644 --- a/mysql-test/main/mysqld--help.test +++ b/mysql-test/main/mysqld--help.test @@ -27,7 +27,7 @@ perl; large-files-support lower-case-file-system system-time-zone collation-server character-set-server log-tc-size table-cache table-open-cache table-open-cache-instances max-connections - server-uid tls-version version.* analyze-max-length/; + server-uid tls-version version.* analyze-max-length thread-stack/; # Plugins which may or may not be there: @plugins=qw/innodb archive blackhole federated partition s3 diff --git a/mysql-test/suite/sys_vars/t/thread_stack_basic.test b/mysql-test/suite/sys_vars/t/thread_stack_basic.test index 39f120e0de1..a1f52576d15 100644 --- a/mysql-test/suite/sys_vars/t/thread_stack_basic.test +++ b/mysql-test/suite/sys_vars/t/thread_stack_basic.test @@ -3,6 +3,7 @@ # --source include/not_asan.inc --source include/not_ubsan.inc +--source include/not_msan.inc --replace_result 392192 299008 select @@global.thread_stack; --error ER_INCORRECT_GLOBAL_LOCAL_VAR From 495153feac652ba521dee603d1d05a45c8caa479 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 28 May 2025 11:48:04 +1000 Subject: [PATCH 60/89] MDEV-36893 THD::reset_sub_statement_state swaps with uninitialized structure THD::reset_sub_statement_state and THD::restore_sub_staement_state swap auto_inc_intervals_forced(Discrete_intervals_list) of a THD class with a local variable temporary to execute other things before restoring at the end of Table_triggers_list::process_triggers under a rpl_master_erroneous_autoinc(true) condition as exposed by the rpl.rpl_trigger test. The uninitialized data isn't used and the only required action is to copy the data in one direction. As the intent is for the auto_inc_intervals_forced value to be overwritten or unused, MEM_UNDEFINED is used on it to ensure the previous state is considered invalid. The other uses of reset_sub_statement_state in Item_sp::execute_impl also follow the same pattern of taking a copy to restore within the same function. --- sql/sql_class.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0effdbfcdb5..da8120abaab 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5913,7 +5913,8 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup, if (rpl_master_erroneous_autoinc(this)) { DBUG_ASSERT(backup->auto_inc_intervals_forced.nb_elements() == 0); - auto_inc_intervals_forced.swap(&backup->auto_inc_intervals_forced); + backup->auto_inc_intervals_forced.copy_shallow(&auto_inc_intervals_forced); + MEM_UNDEFINED(&auto_inc_intervals_forced, sizeof auto_inc_intervals_forced); } #endif @@ -5961,7 +5962,7 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) */ if (rpl_master_erroneous_autoinc(this)) { - backup->auto_inc_intervals_forced.swap(&auto_inc_intervals_forced); + auto_inc_intervals_forced.copy_shallow(&backup->auto_inc_intervals_forced); DBUG_ASSERT(backup->auto_inc_intervals_forced.nb_elements() == 0); } #endif From 5dbfb52d04d15d2d98db2ed6fd9fe3f73993c4b1 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 28 May 2025 14:03:40 +1000 Subject: [PATCH 61/89] MDEV-36894 JSNX::SetArrayOptions and BJNX::SetArrayOptions unused nm arg Calling SetArrayOptions with Nodes[i - 1].Key as its nm argument exposed a MemorySanitizer error when i=0 for the tests: * connect.bson_udf * connect.json_udf * connect.json_udf_bin Its assumed that a basic optimization would have eliminated these invalid expressions. As the nm argument was unused, it has been removed. --- storage/connect/bsonudf.cpp | 4 ++-- storage/connect/bsonudf.h | 2 +- storage/connect/jsonudf.cpp | 4 ++-- storage/connect/jsonudf.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 33a462944b5..bed40a05249 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -191,7 +191,7 @@ my_bool BJNX::SetJpath(PGLOBAL g, char* path, my_bool jb) /*********************************************************************************/ /* Analyse array processing options. */ /*********************************************************************************/ -my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) +my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i) { int n = (int)strlen(p); my_bool dg = true, b = false; @@ -339,7 +339,7 @@ my_bool BJNX::ParseJpath(PGLOBAL g) // Jpath must be explicit if (a || *p == 0 || *p == '[' || IsNum(p)) { // Analyse intermediate array processing - if (SetArrayOptions(g, p, i, Nodes[i - 1].Key)) + if (SetArrayOptions(g, p, i)) return true; } else if (*p == '*') { diff --git a/storage/connect/bsonudf.h b/storage/connect/bsonudf.h index 90cabf72e21..7d7598574c0 100644 --- a/storage/connect/bsonudf.h +++ b/storage/connect/bsonudf.h @@ -116,7 +116,7 @@ public: PBSON MakeBinResult(UDF_ARGS* args, PBVAL top, ulong len, int n = 2); protected: - my_bool SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm); + my_bool SetArrayOptions(PGLOBAL g, char* p, int i); PVAL GetColumnValue(PGLOBAL g, PBVAL row, int i); PVAL ExpandArray(PGLOBAL g, PBVAL arp, int n); PVAL CalculateArray(PGLOBAL g, PBVAL arp, int n); diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 60870dc3618..9ce1ff5e48b 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -112,7 +112,7 @@ my_bool JSNX::SetJpath(PGLOBAL g, char *path, my_bool jb) /*********************************************************************************/ /* Analyse array processing options. */ /*********************************************************************************/ -my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) +my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i) { int n = (int)strlen(p); my_bool dg = true, b = false; @@ -262,7 +262,7 @@ my_bool JSNX::ParseJpath(PGLOBAL g) // Jpath must be explicit if (a || *p == 0 || *p == '[' || IsNum(p)) { // Analyse intermediate array processing - if (SetArrayOptions(g, p, i, Nodes[i-1].Key)) + if (SetArrayOptions(g, p, i)) return true; } else if (*p == '*') { diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h index 782d17acb12..a7defed8e54 100644 --- a/storage/connect/jsonudf.h +++ b/storage/connect/jsonudf.h @@ -330,7 +330,7 @@ public: char *LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx = 10); protected: - my_bool SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm); + my_bool SetArrayOptions(PGLOBAL g, char *p, int i); PVAL GetColumnValue(PGLOBAL g, PJSON row, int i); PVAL ExpandArray(PGLOBAL g, PJAR arp, int n); PVAL GetCalcValue(PGLOBAL g, PJAR bap, int n); From 676aea8cad14562c8237e17c99a9821c1398e6c7 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 28 May 2025 15:03:05 +1000 Subject: [PATCH 62/89] MDEV-36848: identify tests with various MSAN suitability With MSAN the following test behavious where observed: * funcs_1.myisam_views-big - normal big test for non-debug * innodb_gis.rtree_purge - normal big test with MSAN * main.alter_table_lock - very quick - unclear why disabled * main.cte_recursive - slow on Debug only * main.join_cache_notasan - special MSAN handing for returning OOM added * main.sum_distinct-big - 90 seconds on non-debug - still big however * maria.max_length - normal big test with MSAN * perfschema.statement_digest_long_query - overflows stack on debug Timingsi (on old memory constrained hardware): non-debug: funcs_1.myisam_views-big w2 [ pass ] 78564 innodb_gis.rtree_purge '16k' w2 [ pass ] 5784 innodb_gis.rtree_purge '32k' w2 [ pass ] 5242 innodb_gis.rtree_purge '4k' w1 [ pass ] 8303 innodb_gis.rtree_purge '64k' w1 [ pass ] 6348 innodb_gis.rtree_purge '8k' w2 [ pass ] 5870 main.alter_table_lock w1 [ pass ] 41 main.cte_recursive w1 [ pass ] 15485 main.join_cache_notasan w1 [ pass ] 39 main.sum_distinct-big w2 [ pass ] 96256 maria.max_length w1 [ pass ] 92990 perfschema.statement_digest_long_query w2 [ pass ] 8 debug: funcs_1.myisam_views-big w1 [ skipped ] Can't be run WITH_MSAN and CMAKE_BUILD_TYPE=Debug innodb_gis.rtree_purge '16k' w2 [ pass ] 109788 innodb_gis.rtree_purge '32k' w2 [ pass ] 62361 innodb_gis.rtree_purge '4k' w1 [ pass ] 89423 innodb_gis.rtree_purge '64k' w1 [ pass ] 72082 innodb_gis.rtree_purge '8k' w1 [ pass ] 98452 main.alter_table_lock w2 [ pass ] 38 main.cte_recursive w2 [ pass ] 180047 main.join_cache_notasan w1 [ pass ] 166 main.sum_distinct-big w1 [ skipped ] Can't be run WITH_MSAN and CMAKE_BUILD_TYPE=Debug maria.max_length w1 [ skipped ] Can't be run WITH_MSAN and CMAKE_BUILD_TYPE=Debug perfschema.statement_digest_long_query w1 [ skipped ] Can't be run WITH_MSAN and CMAKE_BUILD_TYPE=Debug --- mysql-test/include/no_msan_without_big.inc | 8 ++++++++ mysql-test/include/not_msan.inc | 3 ++- mysql-test/include/not_msan_with_debug.inc | 9 +++++++++ mysql-test/main/alter_table_lock.test | 2 -- mysql-test/main/cte_recursive.test | 2 +- mysql-test/main/join_cache_notasan.cnf | 5 +++++ mysql-test/main/join_cache_notasan.result | 1 + mysql-test/main/join_cache_notasan.test | 4 +++- mysql-test/main/sum_distinct-big.test | 2 +- mysql-test/suite/funcs_1/t/myisam_views-big.test | 3 +-- mysql-test/suite/innodb_gis/t/rtree_purge.test | 3 +-- mysql-test/suite/maria/max_length.test | 2 +- .../suite/perfschema/t/statement_digest_long_query.test | 1 + 13 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 mysql-test/include/no_msan_without_big.inc create mode 100644 mysql-test/include/not_msan_with_debug.inc create mode 100644 mysql-test/main/join_cache_notasan.cnf diff --git a/mysql-test/include/no_msan_without_big.inc b/mysql-test/include/no_msan_without_big.inc new file mode 100644 index 00000000000..158b3986768 --- /dev/null +++ b/mysql-test/include/no_msan_without_big.inc @@ -0,0 +1,8 @@ +# Slow with MSAN, but if mtr --big-test specified, then it should complete +if (!$BIG_TEST) +{ + if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`) + { + --skip Can't be run WITH_MSAN unless using --big-test + } +} diff --git a/mysql-test/include/not_msan.inc b/mysql-test/include/not_msan.inc index ca1e2c1d7bd..678139199a2 100644 --- a/mysql-test/include/not_msan.inc +++ b/mysql-test/include/not_msan.inc @@ -1,4 +1,5 @@ -# This file should only be used with tests that are too big or slow for MSAN. +# This file should only be used with tests that are too big or slow for MSAN (even with --big-test). +# Use no_msan_without_big instead unless this really won't complete in a test timeout period. if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`) { diff --git a/mysql-test/include/not_msan_with_debug.inc b/mysql-test/include/not_msan_with_debug.inc new file mode 100644 index 00000000000..155e05991a0 --- /dev/null +++ b/mysql-test/include/not_msan_with_debug.inc @@ -0,0 +1,9 @@ +# This file should only be used with tests that are too big or slow for MSAN with Debug. + +if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`) +{ + if (`select version() like '%debug%'`) + { + --skip Can't be run WITH_MSAN and CMAKE_BUILD_TYPE=Debug + } +} diff --git a/mysql-test/main/alter_table_lock.test b/mysql-test/main/alter_table_lock.test index bd26c1ac7d0..500cc3ced57 100644 --- a/mysql-test/main/alter_table_lock.test +++ b/mysql-test/main/alter_table_lock.test @@ -1,5 +1,3 @@ ---source include/not_msan.inc - --echo # --echo # MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' in --echo # Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK) diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index 4ecdaa4f0fa..6e2dd3b1f16 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -1,6 +1,6 @@ --source include/default_optimizer_switch.inc # This is too slow on MSAN ---source include/not_msan.inc +--source include/no_msan_without_big.inc --source include/not_valgrind.inc --source include/have_innodb.inc diff --git a/mysql-test/main/join_cache_notasan.cnf b/mysql-test/main/join_cache_notasan.cnf new file mode 100644 index 00000000000..7b2fb3bcb15 --- /dev/null +++ b/mysql-test/main/join_cache_notasan.cnf @@ -0,0 +1,5 @@ +!include include/default_my.cnf + +[ENV] +MSAN_OPTIONS=allocator_may_return_null=1:abort_on_error=1 + diff --git a/mysql-test/main/join_cache_notasan.result b/mysql-test/main/join_cache_notasan.result index 3cec949f5c6..885eece83d6 100644 --- a/mysql-test/main/join_cache_notasan.result +++ b/mysql-test/main/join_cache_notasan.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("MemorySanitizer failed to allocate"); # # MDEV-28217 Incorrect Join Execution When Controlling Join Buffer Size # diff --git a/mysql-test/main/join_cache_notasan.test b/mysql-test/main/join_cache_notasan.test index c2ff670f044..5271d3fae9c 100644 --- a/mysql-test/main/join_cache_notasan.test +++ b/mysql-test/main/join_cache_notasan.test @@ -4,11 +4,13 @@ --source include/have_64bit.inc # Disable asan it asan builds crashes when trying to allocate too much memory --source include/not_asan.inc ---source include/not_msan.inc # Valgrind is useful here, but very slow as lots of memory is allocated --source include/no_valgrind_without_big.inc --source include/have_innodb.inc +# MSAN runs, but ignore its notice. ER_OUTOFMEMORY is expected by tests +call mtr.add_suppression("MemorySanitizer failed to allocate"); + --echo # --echo # MDEV-28217 Incorrect Join Execution When Controlling Join Buffer Size --echo # diff --git a/mysql-test/main/sum_distinct-big.test b/mysql-test/main/sum_distinct-big.test index 8820c191ae9..54fc676740f 100644 --- a/mysql-test/main/sum_distinct-big.test +++ b/mysql-test/main/sum_distinct-big.test @@ -5,7 +5,7 @@ --source include/big_test.inc # Test will take more than one hour with valgrind --source include/not_valgrind.inc ---source include/not_msan.inc +--source include/not_msan_with_debug.inc --source include/have_innodb.inc --source include/have_sequence.inc diff --git a/mysql-test/suite/funcs_1/t/myisam_views-big.test b/mysql-test/suite/funcs_1/t/myisam_views-big.test index 60fe1b8eaba..7199542d3d6 100644 --- a/mysql-test/suite/funcs_1/t/myisam_views-big.test +++ b/mysql-test/suite/funcs_1/t/myisam_views-big.test @@ -4,8 +4,7 @@ # because of a pair of slow Solaris Sparc machines in pb2, # this test is marked as big: --source include/big_test.inc -# This test often times out with MSAN ---source include/not_msan.inc +--source include/not_msan_with_debug.inc # MyISAM tables should be used # diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test index f89f590acf0..4efb7213e28 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_purge.test +++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test @@ -4,8 +4,7 @@ --source include/innodb_page_size.inc --source include/have_sequence.inc --source include/not_valgrind.inc -# This test often times out with MSAN ---source include/not_msan.inc +--source include/no_msan_without_big.inc create table t ( b point not null,d point not null, spatial key (d),spatial key (b) diff --git a/mysql-test/suite/maria/max_length.test b/mysql-test/suite/maria/max_length.test index 02df51b33d7..c6859d5267d 100644 --- a/mysql-test/suite/maria/max_length.test +++ b/mysql-test/suite/maria/max_length.test @@ -6,7 +6,7 @@ --source include/big_test.inc # This test is too slow for valgrind --source include/not_valgrind.inc ---source include/not_msan.inc +--source include/not_msan_with_debug.inc drop table if exists t1,t2; diff --git a/mysql-test/suite/perfschema/t/statement_digest_long_query.test b/mysql-test/suite/perfschema/t/statement_digest_long_query.test index efa33800b58..23ff15c9102 100644 --- a/mysql-test/suite/perfschema/t/statement_digest_long_query.test +++ b/mysql-test/suite/perfschema/t/statement_digest_long_query.test @@ -6,6 +6,7 @@ --source include/have_perfschema.inc # Test requires: sp-protocol/ps-protocol/view-protocol/cursor-protocol disabled --source include/no_protocol.inc +--source include/not_msan_with_debug.inc # Thread stack overrun on solaris let $have_solaris = `select convert(@@version_compile_os using latin1) LIKE ("solaris%")`; if ($have_solaris) From 88d35c5c51e550843933eb3c6e0f2190a2f16529 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 28 May 2025 17:07:50 +1000 Subject: [PATCH 63/89] MDEV-34388: Stack overflow on Alpine Linux (postfix) mroonga+asan The following mroonga functions had approaching 64k stack frames, so exclude these: * chunk_merge - ~60k * buffer_merge - ~78k * grn_ii_update_one - ~60k --- storage/mroonga/vendor/groonga/lib/ii.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/storage/mroonga/vendor/groonga/lib/ii.c b/storage/mroonga/vendor/groonga/lib/ii.c index 8ce4857bfc2..e6c97c30bf2 100644 --- a/storage/mroonga/vendor/groonga/lib/ii.c +++ b/storage/mroonga/vendor/groonga/lib/ii.c @@ -44,6 +44,8 @@ # include #endif +#include "my_attribute.h" + #define MAX_PSEG 0x20000 #define MAX_PSEG_SMALL 0x00200 /* MAX_PSEG_MEDIUM has enough space for the following source: @@ -2833,6 +2835,8 @@ chunk_flush(grn_ctx *ctx, grn_ii *ii, chunk_info *cinfo, uint8_t *enc, uint32_t return ctx->rc; } +PRAGMA_DISABLE_CHECK_STACK_FRAME + static grn_rc chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt, chunk_info *cinfo, grn_id rid, datavec *dv, @@ -2940,6 +2944,8 @@ chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt, return ctx->rc; } +PRAGMA_REENABLE_CHECK_STACK_FRAME + static void buffer_merge_dump_datavec(grn_ctx *ctx, grn_ii *ii, @@ -2989,6 +2995,8 @@ buffer_merge_dump_datavec(grn_ctx *ctx, GRN_OBJ_FIN(ctx, &buffer); } +PRAGMA_DISABLE_CHECK_STACK_FRAME + /* If dc doesn't have enough space, program may be crashed. * TODO: Support auto space extension or max size check. */ @@ -3314,6 +3322,8 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h, return ctx->rc; } +PRAGMA_REENABLE_CHECK_STACK_FRAME + static void fake_map(grn_ctx *ctx, grn_io *io, grn_io_win *iw, void *addr, uint32_t seg, uint32_t size) { @@ -4509,6 +4519,9 @@ grn_ii_get_disk_usage(grn_ctx *ctx, grn_ii *ii) return usage; } + +PRAGMA_DISABLE_CHECK_STACK_FRAME + #define BIT11_01(x) ((x >> 1) & 0x7ff) #define BIT31_12(x) (x >> 12) @@ -4784,6 +4797,8 @@ exit : return ctx->rc; } +PRAGMA_REENABLE_CHECK_STACK_FRAME + grn_rc grn_ii_delete_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_hash *h) { From 7b4b759f136f25336fdc12a5a705258a5846d224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 28 May 2025 13:33:06 +0300 Subject: [PATCH 64/89] MDEV-36868: Inconsistency when shrinking innodb_buffer_pool_size buf_pool_t::resize(): After successfully shrinking the buffer pool, announce the success. The size had already been updated in shrunk(). After failing to shrink the buffer pool, re-enable the adaptive hash index if it had been enabled. Reviewed by: Debarun Banerjee --- .../innodb/r/innodb_buffer_pool_resize.result | 9 ++++++++ ...innodb_buffer_pool_resize_temporary.result | 10 +++++++++ .../innodb/t/innodb_buffer_pool_resize.test | 12 ++++++++++ .../innodb_buffer_pool_resize_temporary.test | 10 +++++++++ storage/innobase/buf/buf0buf.cc | 22 ++++++------------- 5 files changed, 48 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result index 66b36f18bc8..7b254daf492 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result @@ -18,6 +18,15 @@ SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144; SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384; +SELECT @@GLOBAL.innodb_adaptive_hash_index; +@@GLOBAL.innodb_adaptive_hash_index +1 +SET STATEMENT max_statement_time=1e-9 FOR +SET GLOBAL innodb_buffer_pool_size = 7340032; +SELECT @@GLOBAL.innodb_adaptive_hash_index; +@@GLOBAL.innodb_adaptive_hash_index +1 +FOUND 1 /innodb_buffer_pool_size=7m.*resized from|innodb_buffer_pool_size change aborted/ in mysqld.1.err set global innodb_buffer_pool_size = 7340032; select count(val) from t1; count(val) diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result index ec61bb9c0c3..12fb02a40c7 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result @@ -2,6 +2,16 @@ SET @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; SET @save_size=@@GLOBAL.innodb_buffer_pool_size; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET GLOBAL innodb_buffer_pool_size=16777216; +call mtr.add_suppression("innodb_buffer_pool_size change aborted"); +SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index = ON; +SET STATEMENT debug_dbug='+d,buf_shrink_fail' FOR +SET GLOBAL innodb_buffer_pool_size=8388608; +ERROR HY000: innodb_buffer_pool_size change aborted +SELECT @@GLOBAL.innodb_adaptive_hash_index,@@GLOBAL.innodb_buffer_pool_size; +@@GLOBAL.innodb_adaptive_hash_index @@GLOBAL.innodb_buffer_pool_size +1 16777216 +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; SET GLOBAL innodb_max_purge_lag_wait=0; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test index 4cbbdba9974..e48be6b43fa 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_sequence.inc +--source include/not_embedded.inc # there are no messages in mysqld.1.err --echo # --echo # MDEV-29445: Reorganize buffer pool (and remove chunks) @@ -42,6 +43,17 @@ INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384; SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log +SELECT @@GLOBAL.innodb_adaptive_hash_index; +--error 0,ER_WRONG_USAGE +SET STATEMENT max_statement_time=1e-9 FOR +SET GLOBAL innodb_buffer_pool_size = 7340032; +SELECT @@GLOBAL.innodb_adaptive_hash_index; + +--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_PATTERN= InnoDB: Trying to shrink innodb_buffer_pool_size=7m +--let SEARCH_PATTERN= innodb_buffer_pool_size=7m.*resized from|innodb_buffer_pool_size change aborted +--source include/search_pattern_in_file.inc + # Attempt to shrink the buffer pool. This may occasionally fail. --error 0,ER_WRONG_USAGE set global innodb_buffer_pool_size = 7340032; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test index d997c722edd..f96f89c39d5 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test @@ -8,6 +8,16 @@ SET @save_size=@@GLOBAL.innodb_buffer_pool_size; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET GLOBAL innodb_buffer_pool_size=16777216; +call mtr.add_suppression("innodb_buffer_pool_size change aborted"); + +SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index = ON; +--error ER_WRONG_USAGE +SET STATEMENT debug_dbug='+d,buf_shrink_fail' FOR +SET GLOBAL innodb_buffer_pool_size=8388608; +SELECT @@GLOBAL.innodb_adaptive_hash_index,@@GLOBAL.innodb_buffer_pool_size; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; + CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index f9769f3fb18..918d0d5d25e 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1606,6 +1606,7 @@ ATTRIBUTE_COLD buf_pool_t::shrink_status buf_pool_t::shrink(size_t size) noexcept { mysql_mutex_assert_owner(&mutex); + DBUG_EXECUTE_IF("buf_shrink_fail", return SHRINK_ABORT;); buf_load_abort(); if (!n_blocks_to_withdraw) @@ -2011,25 +2012,12 @@ ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept if (ahi_disabled) btr_search_enable(true); #endif - mysql_mutex_lock(&LOCK_global_system_variables); - bool resized= n_blocks_removed < 0; - if (n_blocks_removed > 0) - { - mysql_mutex_lock(&mutex); - resized= size_in_bytes == old_size; - if (resized) - { - size_in_bytes_requested= size; - size_in_bytes= size; - } - mysql_mutex_unlock(&mutex); - } - - if (resized) + if (n_blocks_removed) sql_print_information("InnoDB: innodb_buffer_pool_size=%zum (%zu pages)" " resized from %zum (%zu pages)", size >> 20, n_blocks_new, old_size >> 20, old_blocks); + mysql_mutex_lock(&LOCK_global_system_variables); } else { @@ -2092,6 +2080,10 @@ ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept mysql_mutex_unlock(&mutex); my_printf_error(ER_WRONG_USAGE, "innodb_buffer_pool_size change aborted", MYF(ME_ERROR_LOG)); +#ifdef BTR_CUR_HASH_ADAPT + if (ahi_disabled) + btr_search_enable(true); +#endif mysql_mutex_lock(&LOCK_global_system_variables); } From d953f2c810dab16a9da3e8514f0faff876fe272d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 28 May 2025 13:33:06 +0300 Subject: [PATCH 65/89] MDEV-36868: Inconsistency when shrinking innodb_buffer_pool_size buf_pool_t::resize(): After successfully shrinking the buffer pool, announce the success. The size had already been updated in shrunk(). After failing to shrink the buffer pool, re-enable the adaptive hash index if it had been enabled. Reviewed by: Debarun Banerjee --- .../innodb/r/innodb_buffer_pool_resize.result | 9 ++++++++ ...innodb_buffer_pool_resize_temporary.result | 10 +++++++++ .../innodb/t/innodb_buffer_pool_resize.test | 12 ++++++++++ .../innodb_buffer_pool_resize_temporary.test | 10 +++++++++ storage/innobase/buf/buf0buf.cc | 22 ++++++------------- 5 files changed, 48 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result index 5db74a71636..28282c71fd3 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result @@ -14,6 +14,15 @@ create table t1 (id int primary key, val int not null) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144; +SELECT @@GLOBAL.innodb_adaptive_hash_index; +@@GLOBAL.innodb_adaptive_hash_index +1 +SET STATEMENT max_statement_time=1e-9 FOR +SET GLOBAL innodb_buffer_pool_size = 7340032; +SELECT @@GLOBAL.innodb_adaptive_hash_index; +@@GLOBAL.innodb_adaptive_hash_index +1 +FOUND 1 /innodb_buffer_pool_size=7m.*resized from|innodb_buffer_pool_size change aborted/ in mysqld.1.err set global innodb_buffer_pool_size = 7340032; select count(val) from t1; count(val) diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result index b34da91f255..08ecf2310ff 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result @@ -2,6 +2,16 @@ SET @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; SET @save_size=@@GLOBAL.innodb_buffer_pool_size; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET GLOBAL innodb_buffer_pool_size=16777216; +call mtr.add_suppression("innodb_buffer_pool_size change aborted"); +SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index = ON; +SET STATEMENT debug_dbug='+d,buf_shrink_fail' FOR +SET GLOBAL innodb_buffer_pool_size=8388608; +ERROR HY000: innodb_buffer_pool_size change aborted +SELECT @@GLOBAL.innodb_adaptive_hash_index,@@GLOBAL.innodb_buffer_pool_size; +@@GLOBAL.innodb_adaptive_hash_index @@GLOBAL.innodb_buffer_pool_size +1 16777216 +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; SET GLOBAL innodb_max_purge_lag_wait=0; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test index 612a0c1be64..43ad79a506e 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_sequence.inc +--source include/not_embedded.inc # there are no messages in mysqld.1.err --echo # --echo # MDEV-29445: Reorganize buffer pool (and remove chunks) @@ -37,6 +38,17 @@ INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144; SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log +SELECT @@GLOBAL.innodb_adaptive_hash_index; +--error 0,ER_WRONG_USAGE +SET STATEMENT max_statement_time=1e-9 FOR +SET GLOBAL innodb_buffer_pool_size = 7340032; +SELECT @@GLOBAL.innodb_adaptive_hash_index; + +--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err +--let SEARCH_PATTERN= InnoDB: Trying to shrink innodb_buffer_pool_size=7m +--let SEARCH_PATTERN= innodb_buffer_pool_size=7m.*resized from|innodb_buffer_pool_size change aborted +--source include/search_pattern_in_file.inc + # Attempt to shrink the buffer pool. This may occasionally fail. --error 0,ER_WRONG_USAGE set global innodb_buffer_pool_size = 7340032; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test index 59afed24521..35db56747e4 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test @@ -8,6 +8,16 @@ SET @save_size=@@GLOBAL.innodb_buffer_pool_size; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET GLOBAL innodb_buffer_pool_size=16777216; +call mtr.add_suppression("innodb_buffer_pool_size change aborted"); + +SET @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index = ON; +--error ER_WRONG_USAGE +SET STATEMENT debug_dbug='+d,buf_shrink_fail' FOR +SET GLOBAL innodb_buffer_pool_size=8388608; +SELECT @@GLOBAL.innodb_adaptive_hash_index,@@GLOBAL.innodb_buffer_pool_size; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; + CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 3fce60922b5..806e995c901 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1614,6 +1614,7 @@ ATTRIBUTE_COLD buf_pool_t::shrink_status buf_pool_t::shrink(size_t size) noexcept { mysql_mutex_assert_owner(&mutex); + DBUG_EXECUTE_IF("buf_shrink_fail", return SHRINK_ABORT;); buf_load_abort(); if (!n_blocks_to_withdraw) @@ -2014,25 +2015,12 @@ ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept if (ahi_disabled) btr_search.enable(true); #endif - mysql_mutex_lock(&LOCK_global_system_variables); - bool resized= n_blocks_removed < 0; - if (n_blocks_removed > 0) - { - mysql_mutex_lock(&mutex); - resized= size_in_bytes == old_size; - if (resized) - { - size_in_bytes_requested= size; - size_in_bytes= size; - } - mysql_mutex_unlock(&mutex); - } - - if (resized) + if (n_blocks_removed) sql_print_information("InnoDB: innodb_buffer_pool_size=%zum (%zu pages)" " resized from %zum (%zu pages)", size >> 20, n_blocks_new, old_size >> 20, old_blocks); + mysql_mutex_lock(&LOCK_global_system_variables); } else { @@ -2095,6 +2083,10 @@ ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept mysql_mutex_unlock(&mutex); my_printf_error(ER_WRONG_USAGE, "innodb_buffer_pool_size change aborted", MYF(ME_ERROR_LOG)); +#ifdef BTR_CUR_HASH_ADAPT + if (ahi_disabled) + btr_search.enable(true); +#endif mysql_mutex_lock(&LOCK_global_system_variables); } From dbee7b7d7c4c3be84de76c8f48a85dd2c705e53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 28 May 2025 14:34:26 +0300 Subject: [PATCH 66/89] MDEV-36863 InnoDB: Failing assertion: !block->n_hash_helps after failing to shrink innodb_buffer_pool_size buf_pool_t::resize(): After failing to shrink the buffer pool, clear any adaptive hash index fields for blocks that were restored from buf_pool.withdrawn to buf_pool.free, so that they will be in the expected state when the blocks will be allocated later. This fixes a logic conflict between commit 4dcb1b575b6cc533f68b98ea1f83cec275534972 (MDEV-35049) and commit b6923420f326ac030e4f3ef89a2acddb45eccb30 (MDEV-29445). --- storage/innobase/buf/buf0buf.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 806e995c901..21e763423ac 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2078,6 +2078,19 @@ ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept ut_d(b->in_free_list= true); ut_ad(b->state() == buf_page_t::NOT_USED); b->lock.init(); +#ifdef BTR_CUR_HASH_ADAPT + /* Clear the AHI fields, because buf_block_init_low() expects + these to be zeroed. These were not cleared when we relocated + the block to withdrawn. Had we successfully shrunk the buffer pool, + all this virtual memory would have been zeroed or made unaccessible, + and on a subsequent buffer pool extension it would be zero again. */ + buf_block_t *block= reinterpret_cast(b); + block->n_hash_helps= 0; +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG + block->n_pointers= 0; +# endif + block->index= nullptr; +#endif } mysql_mutex_unlock(&mutex); From 4d37b1c4b99e91e119754047358a3b34980cac03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 28 May 2025 14:44:43 +0300 Subject: [PATCH 67/89] MDEV-36886 log_t::get_lsn_approx() isn't lower bound If the execution of the two reads in log_t::get_lsn_approx() is interleaved with concurrent writes of those fields in log_t::write_buf() or log_t::persist(), the returned approximation will be an upper bound. If log_t::append_prepare_wait() is pending, the approximation could be a lower bound. We must adjust each caller of log_t::get_lsn_approx() for the possibility that the return value is larger than MAX(oldest_modification) in buf_pool.flush_list. af_needed_for_redo(): Add a comment that explains why the glitch is not a problem. page_cleaner_flush_pages_recommendation(): Revise the logic for the unlikely case cur_lsn < oldest_lsn. The original logic would have invoked af_get_pct_for_lsn() with a very large age value, which would likely cause an overflow of the local variable lsn_age_factor, and make pct_for_lsn a "random number". Based on that value, total_ratio would be normalized to something between 0.0 and 1.0. Nothing extremely bad should have happened in this case; the innodb_io_capacity_max should not be exceeded. --- storage/innobase/buf/buf0flu.cc | 12 ++++++++++-- storage/innobase/include/log0log.h | 5 +++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index ad026abf64f..101fe6b72c3 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2294,6 +2294,12 @@ redo log capacity filled threshold. @return true if adaptive flushing is recommended. */ static bool af_needed_for_redo(lsn_t oldest_lsn) noexcept { + /* We may have oldest_lsn > log_sys.get_lsn_approx() if + log_t::write_buf() or log_t::persist() are executing concurrently + with this. In that case, age > af_lwm should hold, and + buf_flush_page_cleaner() would execute one more timed wait. (Not a + big problem.) */ + lsn_t age= log_sys.get_lsn_approx() - oldest_lsn; lsn_t af_lwm= static_cast(srv_adaptive_flushing_lwm * static_cast(log_sys.log_capacity) / 100); @@ -2355,8 +2361,10 @@ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, ulint n_pages = 0; const lsn_t cur_lsn = log_sys.get_lsn_approx(); - ut_ad(oldest_lsn <= cur_lsn); - ulint pct_for_lsn = af_get_pct_for_lsn(cur_lsn - oldest_lsn); + /* We may have cur_lsn < oldest_lsn if + log_t::write_buf() or log_t::persist() were executing concurrently. */ + ulint pct_for_lsn = cur_lsn < oldest_lsn + ? 0 : af_get_pct_for_lsn(cur_lsn - oldest_lsn); time_t curr_time = time(nullptr); const double max_pct = srv_max_buf_pool_modified_pct; diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 55ffbc0df99..134bb1f7567 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -406,9 +406,10 @@ public: @param encrypted whether the log is encrypted */ static void header_write(byte *buf, lsn_t lsn, bool encrypted) noexcept; - /** @return a lower bound estimate of get_lsn(), + /** @return an estimate of get_lsn(), using acquire-release ordering with write_buf() or persist(); - this is exact unless append_prepare_wait() is pending */ + an upper bound if said functions have updated only one of the fields, + a lower bound if append_prepare_wait() is pending, otherwise exact */ lsn_t get_lsn_approx() const noexcept { /* acquire-release ordering with write_buf() and persist() */ From e021a61b6fbf0b4c5929027e025d073e0c3418d5 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 2 May 2025 17:13:28 +1000 Subject: [PATCH 68/89] MDEV-36729: ha_example::show_func_example is incorrectly defined In the main.plugin this function is called assuming the function prototype int (*)(THD *, st_mysql_show_var *, void *, system_status_var *, enum_var_type)' as changed in b4ff64568c88ab3ce559e7bd39853d9cbf86704a. We update the ha_example::show_func_example to match the prototype on which it is called. --- storage/example/ha_example.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index c66c33a7818..5b0d7dcc74b 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -1078,11 +1078,11 @@ static struct st_mysql_sys_var* example_system_variables[]= { // this is an example of SHOW_SIMPLE_FUNC and of my_snprintf() service // If this function would return an array, one should use SHOW_FUNC static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var, - char *buf) + void *buf, system_status_var *, enum_var_type) { var->type= SHOW_CHAR; var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes - my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE, + my_snprintf((char*) buf, SHOW_VAR_FUNC_BUFF_SIZE, "enum_var is %lu, ulong_var is %lu, int_var is %d, " "double_var is %f, %.6b", // %b is a MySQL extension srv_enum_var, srv_ulong_var, THDVAR(thd, int_var), From 0b2434d2e9531ed986039fa184f92405155247d9 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Wed, 28 May 2025 11:28:16 +0300 Subject: [PATCH 69/89] MDEV-25158 Segfault on INTERSECT ALL with UNION in Oracle mode Oracle mode has different set operator precedence and handling (not by standard). In Oracle mode the below test case is handled as-is, in plain order from left to right. In MariaDB default mode follows SQL standard and makes INTERSECT prioritized, so UNION is taken from derived table which is INTERSECT result (here and below the same applies for EXCEPT). Non-distinct set operator (UNION ALL/INTERSECT ALL) works via unique key release but it can be done only once. We cannot add index to non-empty heap table (see heap_enable_indexes()). So every UNION ALL before rightmost UNION DISTINCT works as UNION DISTINCT. That is common syntax, MySQL, MSSQL and Oracle work that way. There is union_distinct property which indicates the rightmost distinct UNION (at least, so the algorithm works simple: it releases the unique key after union_distinct in the loop (st_select_lex_unit::exec()). INTERSECT ALL code (implemented by MDEV-18844 in a896beb) does not know about Oracle mode and treats union_distinct as the last operation, that's why it releases unique key on union_distinct operation. INTERSECT ALL requires unique key for it to work, so before any INTERSECT ALL unique key must not be released (see select_unit_ext::send_data()). The patch tweaks INTERSECT ALL code for Oracle mode. In disable_index_if_needed() it does not allow unique key release before the last operation and it allows unfold on the last operation. Test case with UNION DISTINCT following INTERSECT ALL at least does not include invalid data, but in fact the whole INTERSECT ALL code could be refactored for better semantical triggers. The patch fixes typo in st_select_lex_unit::prepare() where have_except_all_or_intersect_all masked eponymous data member which wrongly triggered unique key release in st_select_lex_unit::prepare(). The patch fixes unknown error in case ha_disable_indexes() fails. Note: optimize_bag_operation() does some operator substitutions, but it does not run under PS. So if there is difference in test with --ps that means non-optimized (have_except_all_or_intersect_all == true) code path is not good. Note 2: VIEW is stored and executed in normal mode (see Sql_mode_save_for_frm_handling) hence when SELECT order is different in Oracle mode (defined by parsed_select_expr_cont()) it must be covered by --disable_view_protocol. --- mysql-test/main/intersect_all.result | 110 +++++++++++++++++++++++++++ mysql-test/main/intersect_all.test | 68 ++++++++++++++++- sql/sql_union.cc | 45 ++++++++--- 3 files changed, 212 insertions(+), 11 deletions(-) diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result index e72209c5f89..2bda1bb37a5 100644 --- a/mysql-test/main/intersect_all.result +++ b/mysql-test/main/intersect_all.result @@ -920,3 +920,113 @@ NULL INTERSECT RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 union all /* select#4 */ select `__4`.`a` AS `a` from (/* select#2 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 intersect all /* select#3 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5) `__4` drop table t1,t2,t3; +# +# MDEV-25158 Segfault on INTERSECT ALL with UNION in Oracle mode +# +create table t3 (x int); +create table u3 (x int); +create table i3 (x int); +explain SELECT * from t3 union select * from u3 intersect all select * from i3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 system NULL NULL NULL NULL 0 Const row not found +4 UNION ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 INTERSECT NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL INTERSECT RESULT ALL NULL NULL NULL NULL NULL +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +set sql_mode= 'oracle'; +explain SELECT * from t3 union select * from u3 intersect all select * from i3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 system NULL NULL NULL NULL 0 Const row not found +2 UNION u3 system NULL NULL NULL NULL 0 Const row not found +3 INTERSECT i3 system NULL NULL NULL NULL 0 Const row not found +NULL UNIT RESULT ALL NULL NULL NULL NULL NULL +select * from t3 union select * from u3 intersect select * from i3; +x +SELECT * from t3 union select * from u3 intersect all select * from i3; +x +insert into t3 values (0); +insert into i3 values (0); +Select * from t3 union select * from u3 intersect select * from i3; +x +0 +SELECT * FROM t3 UNION SELECT * FROM u3 INTERSECT ALL SELECT * FROM i3; +x +0 +drop tables t3, u3, i3; +# First line of these results is column names, not the result +# (pay attention to "affected rows") +values (1, 2) union all values (1, 2); +1 2 +1 2 +1 2 +affected rows: 2 +values (1, 2) union all values (1, 2) union values (4, 3) union all values (4, 3); +1 2 +1 2 +4 3 +4 3 +affected rows: 3 +values (1, 2) union all values (1, 2) union values (4, 3) union all values (4, 3) union all values (1, 2); +1 2 +1 2 +4 3 +4 3 +1 2 +affected rows: 4 +values (1, 2) union all values (1, 2) union values (4, 3) union all values (4, 3) union all values (1, 2) union values (1, 2); +1 2 +1 2 +4 3 +affected rows: 2 +create table t1 (a int, b int); +create table t2 like t1; +insert t1 values (1, 2), (1, 2), (1, 2), (2, 3), (2, 3), (3, 4), (3, 4); +insert t2 values (1, 2), (1, 2), (2, 3), (2, 3), (2, 3), (2, 3), (4, 5); +select * from t1 intersect select * from t2; +a b +1 2 +2 3 +select * from t1 intersect all select * from t2; +a b +1 2 +2 3 +1 2 +2 3 +# Default: first INTERSECT ALL, then UNION +# Oracle: first UNION, then INTERSECT ALL +select * from t1 union values (1, 2) intersect all select * from t2; +a b +1 2 +2 3 +select * from t1 union (values (1, 2) intersect all select * from t2); +a b +1 2 +2 3 +3 4 +(select * from t1 union values (1, 2)) intersect all select * from t2; +a b +1 2 +2 3 +select * from t1 intersect all select * from t2 union values (1, 2); +a b +1 2 +2 3 +1 2 +2 3 +select * from t1 intersect all (select * from t2 union values (1, 2)); +a b +1 2 +2 3 +(select * from t1 intersect all select * from t2) union values (1, 2); +a b +1 2 +2 3 +explain select * from t1 intersect all select * from t2 union values (1, 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 7 +2 INTERSECT t2 ALL NULL NULL NULL NULL 7 +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT ALL NULL NULL NULL NULL NULL +drop tables t1, t2; +set sql_mode= default; diff --git a/mysql-test/main/intersect_all.test b/mysql-test/main/intersect_all.test index 5d2b038fde9..8217e4ebcbc 100644 --- a/mysql-test/main/intersect_all.test +++ b/mysql-test/main/intersect_all.test @@ -325,4 +325,70 @@ select * from t2 where a < 5 intersect all select * from t3 where a < 5; -drop table t1,t2,t3; \ No newline at end of file +drop table t1,t2,t3; + +--echo # +--echo # MDEV-25158 Segfault on INTERSECT ALL with UNION in Oracle mode +--echo # +create table t3 (x int); +create table u3 (x int); +create table i3 (x int); +explain SELECT * from t3 union select * from u3 intersect all select * from i3; +set sql_mode= 'oracle'; +explain SELECT * from t3 union select * from u3 intersect all select * from i3; +select * from t3 union select * from u3 intersect select * from i3; +SELECT * from t3 union select * from u3 intersect all select * from i3; +insert into t3 values (0); +insert into i3 values (0); +Select * from t3 union select * from u3 intersect select * from i3; +SELECT * FROM t3 UNION SELECT * FROM u3 INTERSECT ALL SELECT * FROM i3; +drop tables t3, u3, i3; + +--enable_info +--echo # First line of these results is column names, not the result +--echo # (pay attention to "affected rows") + +# MSSQL: +# 1 2 +# 1 2 +values (1, 2) union all values (1, 2); + +# MSSQL: +# 1 2 +# 4 3 +# 4 3 +values (1, 2) union all values (1, 2) union values (4, 3) union all values (4, 3); + +# MSSQL: +# 1 2 +# 4 3 +# 4 3 +# 1 2 +values (1, 2) union all values (1, 2) union values (4, 3) union all values (4, 3) union all values (1, 2); + +# MSSQL: +# 1 2 +# 4 3 +values (1, 2) union all values (1, 2) union values (4, 3) union all values (4, 3) union all values (1, 2) union values (1, 2); +--disable_info + +create table t1 (a int, b int); +create table t2 like t1; +insert t1 values (1, 2), (1, 2), (1, 2), (2, 3), (2, 3), (3, 4), (3, 4); +insert t2 values (1, 2), (1, 2), (2, 3), (2, 3), (2, 3), (2, 3), (4, 5); +select * from t1 intersect select * from t2; +select * from t1 intersect all select * from t2; +--echo # Default: first INTERSECT ALL, then UNION +--echo # Oracle: first UNION, then INTERSECT ALL +# VIEW is stored and executed normal mode (see Sql_mode_save_for_frm_handling) +--disable_view_protocol +select * from t1 union values (1, 2) intersect all select * from t2; +--enable_view_protocol +select * from t1 union (values (1, 2) intersect all select * from t2); +(select * from t1 union values (1, 2)) intersect all select * from t2; +select * from t1 intersect all select * from t2 union values (1, 2); +select * from t1 intersect all (select * from t2 union values (1, 2)); +(select * from t1 intersect all select * from t2) union values (1, 2); +explain select * from t1 intersect all select * from t2 union values (1, 2); +drop tables t1, t2; +set sql_mode= default; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 6b451349cdc..dd9998bcb9b 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -474,21 +474,30 @@ int select_unit::update_counter(Field* counter, longlong value) Try to disable index @retval - true index is disabled this time + true index is disabled and unfold is needed false this time did not disable the index */ bool select_unit_ext::disable_index_if_needed(SELECT_LEX *curr_sl) { + const bool oracle_mode= thd->variables.sql_mode & MODE_ORACLE; if (is_index_enabled && - (curr_sl == curr_sl->master_unit()->union_distinct || + ((!oracle_mode && + curr_sl == curr_sl->master_unit()->union_distinct) || !curr_sl->next_select()) ) { is_index_enabled= false; - if (table->file->ha_disable_indexes(key_map(0), false)) + int error= table->file->ha_disable_indexes(key_map(0), false); + if (error) + { + table->file->print_error(error, MYF(0)); + DBUG_ASSERT(0); return false; + } table->no_keyread=1; - return true; + /* In case of Oracle mode we unfold at the last operator */ + DBUG_ASSERT(!oracle_mode || !curr_sl->next_select()); + return oracle_mode || !curr_sl->distinct; } return false; } @@ -772,8 +781,7 @@ bool select_unit_ext::send_eof() next_sl && next_sl->get_linkage() == INTERSECT_TYPE && !next_sl->distinct; - bool need_unfold= (disable_index_if_needed(curr_sl) && - !curr_sl->distinct); + bool need_unfold= disable_index_if_needed(curr_sl); if (((curr_sl->distinct && !is_next_distinct) || curr_op_type == INTERSECT_ALL || @@ -781,7 +789,8 @@ bool select_unit_ext::send_eof() !need_unfold) { if (!next_sl) - DBUG_ASSERT(curr_op_type != INTERSECT_ALL); + DBUG_ASSERT((thd->variables.sql_mode & MODE_ORACLE) || + curr_op_type != INTERSECT_ALL); bool need_update_row; if (unlikely(table->file->ha_rnd_init_with_error(1))) return 1; @@ -1295,8 +1304,8 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg, uint union_part_count= 0; select_result *tmp_result; bool is_union_select; - bool have_except= false, have_intersect= false, - have_except_all_or_intersect_all= false; + bool have_except= false, have_intersect= false; + have_except_all_or_intersect_all= false; bool instantiate_tmp_table= false; bool single_tvc= !first_sl->next_select() && first_sl->tvc; bool single_tvc_wo_order= single_tvc && !first_sl->order_list.elements; @@ -2160,6 +2169,7 @@ bool st_select_lex_unit::exec() bool first_execution= !executed; DBUG_ENTER("st_select_lex_unit::exec"); bool was_executed= executed; + int error; if (executed && !uncacheable && !describe) DBUG_RETURN(FALSE); @@ -2243,17 +2253,32 @@ bool st_select_lex_unit::exec() if (likely(!saved_error)) { records_at_start= table->file->stats.records; + + /* select_unit::send_data() writes rows to (temporary) table */ if (sl->tvc) sl->tvc->exec(sl); else sl->join->exec(); + /* + Allow UNION ALL to work: disable unique key. We cannot disable indexes + in the middle of the query because enabling indexes requires table to be empty + (see heap_enable_indexes()). So there is special union_distinct property + which is the rightmost distinct UNION in the expression and we release + the unique key after the last (rightmost) distinct UNION, therefore only the + subsequent UNION ALL work as non-distinct. + */ if (sl == union_distinct && !have_except_all_or_intersect_all && !(with_element && with_element->is_recursive)) { // This is UNION DISTINCT, so there should be a fake_select_lex DBUG_ASSERT(fake_select_lex != NULL); - if (table->file->ha_disable_indexes(key_map(0), false)) + error= table->file->ha_disable_indexes(key_map(0), false); + if (error) + { + table->file->print_error(error, MYF(0)); + DBUG_ASSERT(0); DBUG_RETURN(TRUE); + } table->no_keyread=1; } if (!sl->tvc) From fe6a5c220046514ad6ce055f881dc569281863c2 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Wed, 28 May 2025 11:28:17 +0300 Subject: [PATCH 70/89] MDEV-29155 CREATE OR REPLACE with self-referencing CHECK hangs forever, cannot be killed mysql_rm_table_no_locks() does TDC_RT_REMOVE_ALL which waits while share is closed. The table normally is open only as OPEN_STUB, this is what parser does for CREATE TABLE. But for SELECT the table is opened not as a stub. If it is the same table name we anyway have two TABLE_LIST objects: stub and not stub. So for "not stub" TDC_RT_REMOVE_ALL sees open count and decides to wait until it is closed. And it hangs because that was opened in the same thread. The fix disables subqueries in CHECK expression at parser level. Thanks to Sergei Golubchik for the patch. --- mysql-test/main/check_constraint.result | 2 +- mysql-test/main/check_constraint.test | 2 +- mysql-test/suite/vcol/r/not_supported.result | 31 ++++++++++++++++++ mysql-test/suite/vcol/t/not_supported.test | 33 ++++++++++++++++++++ sql/sql_yacc.yy | 7 +++-- 5 files changed, 71 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/check_constraint.result b/mysql-test/main/check_constraint.result index e3986dcf75b..060407d62d5 100644 --- a/mysql-test/main/check_constraint.result +++ b/mysql-test/main/check_constraint.result @@ -139,7 +139,7 @@ drop table t1; create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or c1 is null ) ); ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the CHECK clause of `c1` create table t1 (a int check (@b in (select user from mysql.user))); -ERROR HY000: Function or expression 'select ...' cannot be used in the CHECK clause of `a` +ERROR 42000: CHECK does not support subqueries or stored functions create table t1 (a int check (a > @b)); ERROR HY000: Function or expression '@b' cannot be used in the CHECK clause of `a` create table t1 (a int check (a = 1)); diff --git a/mysql-test/main/check_constraint.test b/mysql-test/main/check_constraint.test index e12468e9013..056d5d06b60 100644 --- a/mysql-test/main/check_constraint.test +++ b/mysql-test/main/check_constraint.test @@ -87,7 +87,7 @@ create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or # # MDEV-12421 Check constraint with query crashes server and renders DB unusable # ---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +--error ER_SUBQUERIES_NOT_SUPPORTED create table t1 (a int check (@b in (select user from mysql.user))); --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create table t1 (a int check (a > @b)); diff --git a/mysql-test/suite/vcol/r/not_supported.result b/mysql-test/suite/vcol/r/not_supported.result index 37ce4865dcc..034bca6a97c 100644 --- a/mysql-test/suite/vcol/r/not_supported.result +++ b/mysql-test/suite/vcol/r/not_supported.result @@ -55,3 +55,34 @@ ERROR HY000: Function or expression 'b' cannot be used in the GENERATED ALWAYS A # # End of 10.3 tests # +# +# MDEV-29155 CREATE OR REPLACE with self-referencing CHECK hangs forever, cannot be killed +# +create table t1 (a int); +create table t2 (b int) +# create or replace table t (b int); +create table t3 (c int, check(exists(select a from t1) or exists(select b from t2))); +ERROR 42000: CHECK does not support subqueries or stored functions +create table t3 (c int, check(exists(select c from t3))); +ERROR 42000: CHECK does not support subqueries or stored functions +create table t3 (d int); +create or replace table t3 (c int, check(exists(select a from t1) or exists(select b from t2))); +ERROR 42000: CHECK does not support subqueries or stored functions +drop table t3; +create table t3 (d int); +create or replace table t3 (c int, check(exists(select c from t3))); +ERROR 42000: CHECK does not support subqueries or stored functions +drop table t3; +create table t3 (c int); +alter table t3 add check(exists(select a from t1) or exists(select b from t2)); +ERROR 42000: CHECK does not support subqueries or stored functions +alter table t3 add check(exists(select c from t3)); +ERROR 42000: CHECK does not support subqueries or stored functions +create table t3 (c int default (select a from t1)); +ERROR HY000: Function or expression 'select ...' cannot be used in the DEFAULT clause of `c` +create table t3 (c int, d int generated always as (select a from t1 limit 1)); +ERROR HY000: Function or expression 'select ...' cannot be used in the GENERATED ALWAYS AS clause of `d` +drop tables t1, t2, t3; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/vcol/t/not_supported.test b/mysql-test/suite/vcol/t/not_supported.test index d58b207a7eb..143c0160084 100644 --- a/mysql-test/suite/vcol/t/not_supported.test +++ b/mysql-test/suite/vcol/t/not_supported.test @@ -64,3 +64,36 @@ create table t1 (a int auto_increment primary key, --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # MDEV-29155 CREATE OR REPLACE with self-referencing CHECK hangs forever, cannot be killed +--echo # +create table t1 (a int); +create table t2 (b int) +# create or replace table t (b int); +--error ER_SUBQUERIES_NOT_SUPPORTED +create table t3 (c int, check(exists(select a from t1) or exists(select b from t2))); +--error ER_SUBQUERIES_NOT_SUPPORTED +create table t3 (c int, check(exists(select c from t3))); +create table t3 (d int); +--error ER_SUBQUERIES_NOT_SUPPORTED +create or replace table t3 (c int, check(exists(select a from t1) or exists(select b from t2))); +drop table t3; +create table t3 (d int); +--error ER_SUBQUERIES_NOT_SUPPORTED +create or replace table t3 (c int, check(exists(select c from t3))); +drop table t3; +create table t3 (c int); +--error ER_SUBQUERIES_NOT_SUPPORTED +alter table t3 add check(exists(select a from t1) or exists(select b from t2)); +--error ER_SUBQUERIES_NOT_SUPPORTED +alter table t3 add check(exists(select c from t3)); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t3 (c int default (select a from t1)); +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t3 (c int, d int generated always as (select a from t1 limit 1)); +drop tables t1, t2, t3; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 688330989ab..03b37f5dec9 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6126,9 +6126,12 @@ opt_check_constraint: ; check_constraint: - CHECK_SYM '(' expr ')' + CHECK_SYM '(' + { Lex->clause_that_disallows_subselect= "CHECK"; } + expr ')' { - Virtual_column_info *v= add_virtual_expression(thd, $3); + Virtual_column_info *v= add_virtual_expression(thd, $4); + Lex->clause_that_disallows_subselect= NULL; if (unlikely(!v)) MYSQL_YYABORT; $$= v; From 8c6cbb336081a5e1ad781df4a9778b61e3b4d73f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 28 May 2025 01:55:39 +0200 Subject: [PATCH 71/89] MDEV-25870 followup : pmull support on Windows ARM64 casting vmull_p64 is possible on MSVC, although with much more verbose code. The reason are missing neon types (no compiler support for 128bit ints). --- mysys/CMakeLists.txt | 4 ++-- mysys/crc32/crc32_arm64.c | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 9e909758166..93b7367d8fa 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -68,12 +68,12 @@ IF(MSVC_INTEL) ENDIF() ELSEIF(MSVC_ARM64) SET (MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_arm64.c) - ADD_DEFINITIONS(-DHAVE_ARMV8_CRC -DHAVE_ARMV8_CRC_CRYPTO_INTRINSICS) + ADD_DEFINITIONS(-DHAVE_ARMV8_CRC -DHAVE_ARMV8_CRC_CRYPTO_INTRINSICS -DHAVE_ARMV8_CRYPTO) IF(CLANG_CL) SET_SOURCE_FILES_PROPERTIES( crc32/crc32_arm64.c PROPERTIES - COMPILE_FLAGS "-march=armv8-a+crc" + COMPILE_FLAGS "-march=armv8-a+crc+crypto" ) ENDIF() ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|i386|i686") diff --git a/mysys/crc32/crc32_arm64.c b/mysys/crc32/crc32_arm64.c index 1f2f023e6ca..7c25d383173 100644 --- a/mysys/crc32/crc32_arm64.c +++ b/mysys/crc32/crc32_arm64.c @@ -29,7 +29,9 @@ my_crc32_t crc32c_aarch64_available(void) { if (crc32_aarch64_available() == 0) return NULL; - /* TODO : pmull seems supported, but does not compile*/ + + if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)) + return crc32c_aarch64_pmull; return crc32c_aarch64; } @@ -181,11 +183,19 @@ asm(".arch_extension crypto"); CRC32C3X8(buffer, ((ITR) * 7 + 6)) \ } while(0) +#if defined _MSC_VER && !defined __clang__ +#define PREF4X64L1(buffer, offset, itr)\ + __prefetch(buffer + (offset) + ((itr) + 0)*64);\ + __prefetch(buffer + (offset) + ((itr) + 1)*64);\ + __prefetch(buffer + (offset) + ((itr) + 2)*64);\ + __prefetch(buffer + (offset) + ((itr) + 3)*64); +#else #define PREF4X64L1(buffer, PREF_OFFSET, ITR) \ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 1)*64));\ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 2)*64));\ __asm__("PRFM PLDL1KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 3)*64)); +#endif #define PREF1KL1(buffer, PREF_OFFSET) \ PREF4X64L1(buffer,(PREF_OFFSET), 0) \ @@ -193,11 +203,20 @@ asm(".arch_extension crypto"); PREF4X64L1(buffer,(PREF_OFFSET), 8) \ PREF4X64L1(buffer,(PREF_OFFSET), 12) +#if defined _MSC_VER && !defined __clang__ +#define MY_PLDL2KEEP 2 /* PLDL2KEEP is 2 in ARMv8 */ +#define PREF4X64L2(buffer,offset,itr)\ + __prefetch2(buffer + offset + ((itr) + 0) * 64, MY_PLDL2KEEP);\ + __prefetch2(buffer + offset + ((itr) + 1) * 64, MY_PLDL2KEEP);\ + __prefetch2(buffer + offset + ((itr) + 2) * 64, MY_PLDL2KEEP);\ + __prefetch2(buffer + offset + ((itr) + 3) * 64, MY_PLDL2KEEP); +#else #define PREF4X64L2(buffer, PREF_OFFSET, ITR) \ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 0)*64));\ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 1)*64));\ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 2)*64));\ __asm__("PRFM PLDL2KEEP, [%x[v],%[c]]"::[v]"r"(buffer), [c]"I"((PREF_OFFSET) + ((ITR) + 3)*64)); +#endif #define PREF1KL2(buffer, PREF_OFFSET) \ PREF4X64L2(buffer,(PREF_OFFSET), 0) \ @@ -240,6 +259,16 @@ static unsigned crc32c_aarch64(unsigned crc, const void *buf, size_t len) #endif #ifdef HAVE_ARMV8_CRYPTO + +static inline uint64_t poly_mul(uint64_t a, uint64_t b) +{ +#if defined _MSC_VER && !defined __clang__ + return vgetq_lane_u64(vreinterpretq_u64_p128(neon_pmull_64(vcreate_p64(a), vcreate_p64(b))),0); +#else + return (uint64_t) vmull_p64(a, b); +#endif +} + static unsigned crc32c_aarch64_pmull(unsigned crc, const void *buf, size_t len) { int64_t length= (int64_t)len; @@ -286,8 +315,8 @@ static unsigned crc32c_aarch64_pmull(unsigned crc, const void *buf, size_t len) * crc1 multiply by K2 * crc0 multiply by K1 */ - t1= (uint64_t)vmull_p64(crc1, k2); - t0= (uint64_t)vmull_p64(crc0, k1); + t1= poly_mul(crc1, k2); + t0= poly_mul(crc0, k1); crc= __crc32cd(crc2, *(const uint64_t *)buffer); crc1= __crc32cd(0, t1); crc^= crc1; From f533333f82256e8cddf890d407939f02efb5e21c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 29 May 2025 11:28:15 +1000 Subject: [PATCH 72/89] MDEV-34388: Stack overflow on Alpine Linux (postfix) - sanitizers Remove stack limits for sanitizers. Other tests cover them. --- cmake/maintainer.cmake | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 5debb42897a..394f623f3e0 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -19,12 +19,6 @@ IF(MSVC OR MYSQL_MAINTAINER_MODE STREQUAL "NO") RETURN() ENDIF() -IF((WITH_MSAN OR WITH_ASAN) AND CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(STACK_FRAME_LIMIT 65536) -ELSE() - SET(STACK_FRAME_LIMIT 16384) -ENDIF() - # Common warning flags for GCC, G++, Clang and Clang++ SET(MY_WARNING_FLAGS -Wall @@ -47,9 +41,12 @@ SET(MY_WARNING_FLAGS -Wvla -Wwrite-strings -Wcast-function-type-strict - -Wframe-larger-than=${STACK_FRAME_LIMIT} ) +IF(NOT (WITH_MSAN OR WITH_ASAN OR WITH_UBSAN)) + SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wframe-larger-than=16384) +ENDIF() + # Warning flags that are in testing before moving # to MY_WARNING_FLAGS if stable. SET(MY_WARNING_FLAGS_NON_FATAL From 22024da64e8febc152c3a822d2d2fc67e85dc175 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 8 May 2025 15:08:02 +0300 Subject: [PATCH 73/89] MDEV-36143 Row event replication with Aria does not honour BLOCK_COMMIT This commit fixes a bug where Aria tables are used in (master->slave1->slave2) and a backup is taken on slave2. In this case it is possible that the replication position in the backup, stored in mysql.gtid_slave_pos, will be wrong. This will lead to replication errors if one is trying to use the backup as a new slave. Analyze: Replicated row events are committed with trans_commit_stmt() and thd->transaction->all.ha_list != 0. This means that backup_commit_lock is not taken for Aria tables, which means the rows are committed and binary logged on the slave under BLOCK_COMMIT which should not happen. This issue does not occur on the master as thd->transaction->all.ha_list is == 0 under AUTO_COMMIT, which sets 'is_real_trans' and 'rw_trans' which in turn causes backup_commit_lock to be taken. Fixed by checking in ha_check_and_coalesce_trx_read_only() if all handlers supports rollback and if not, then wait for BLOCK_COMMIT also for statement commit. --- mysql-test/main/backup_lock.result | 1 + mysql-test/main/backup_lock.test | 1 + sql/handler.cc | 39 ++++++++++++++++++++++++++---- sql/handler.h | 14 +++++++++-- sql/wsrep_mysqld.cc | 3 ++- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/mysql-test/main/backup_lock.result b/mysql-test/main/backup_lock.result index 488e81fd6d4..ced757265b2 100644 --- a/mysql-test/main/backup_lock.result +++ b/mysql-test/main/backup_lock.result @@ -266,6 +266,7 @@ col1 SET AUTOCOMMIT = 0; UPDATE t_permanent_innodb SET col1 = 9; UPDATE t_permanent_aria SET col1 = 9; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction UPDATE t_permanent_myisam SET col1 = 9; ERROR HY000: Lock wait timeout exceeded; try restarting transaction UPDATE t_permanent_aria2 SET col1 = 9; diff --git a/mysql-test/main/backup_lock.test b/mysql-test/main/backup_lock.test index f86f2f3670e..015041babaf 100644 --- a/mysql-test/main/backup_lock.test +++ b/mysql-test/main/backup_lock.test @@ -328,6 +328,7 @@ select * from t_permanent_aria2; SET AUTOCOMMIT = 0; UPDATE t_permanent_innodb SET col1 = 9; +--error ER_LOCK_WAIT_TIMEOUT UPDATE t_permanent_aria SET col1 = 9; --error ER_LOCK_WAIT_TIMEOUT UPDATE t_permanent_myisam SET col1 = 9; diff --git a/sql/handler.cc b/sql/handler.cc index 706e2f0df6a..cd8d2e4287d 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1586,6 +1586,12 @@ uint ha_count_rw_2pc(THD *thd, bool all) /** Check if we can skip the two-phase commit. + @param thd Thread handler + @param ha_list List of all engines participating on the commit + @param all True if this is final commit (not statement commit) + @param no_rollback Set to 1 if one of the engines doing writes does + not support rollback + A helper function to evaluate if two-phase commit is mandatory. As a side effect, propagates the read-only/read-write flags of the statement transaction to its enclosing normal transaction. @@ -1604,16 +1610,21 @@ uint ha_count_rw_2pc(THD *thd, bool all) uint ha_check_and_coalesce_trx_read_only(THD *thd, Ha_trx_info *ha_list, - bool all) + bool all, bool *no_rollback) { /* The number of storage engines that have actual changes. */ unsigned rw_ha_count= 0; Ha_trx_info *ha_info; + *no_rollback= false; for (ha_info= ha_list; ha_info; ha_info= ha_info->next()) { if (ha_info->is_trx_read_write()) + { ++rw_ha_count; + if (ha_info->is_trx_no_rollback()) + *no_rollback= true; + } if (! all) { @@ -1636,7 +1647,18 @@ ha_check_and_coalesce_trx_read_only(THD *thd, Ha_trx_info *ha_list, information up, and the need for two-phase commit has been already established. Break the loop prematurely. */ - break; + if (*no_rollback == 0) + { + while ((ha_info= ha_info->next())) + { + if (ha_info->is_trx_read_write() && ha_info->is_trx_no_rollback()) + { + *no_rollback= 1; + break; + } + } + break; + } } } return rw_ha_count; @@ -1771,7 +1793,9 @@ int ha_commit_trans(THD *thd, bool all) if (is_real_trans) /* not a statement commit */ thd->stmt_map.close_transient_cursors(); - uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all); + bool no_rollback; + uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all, + &no_rollback); /* rw_trans is TRUE when we in a transaction changing data */ bool rw_trans= is_real_trans && rw_ha_count > 0; MDL_request mdl_backup; @@ -1784,7 +1808,7 @@ int ha_commit_trans(THD *thd, bool all) calling ha_commit_trans() from spader_commit(). */ - if (rw_trans && !thd->backup_commit_lock) + if ((rw_trans || no_rollback) && !thd->backup_commit_lock) { /* Acquire a metadata lock which will ensure that COMMIT is blocked @@ -2114,7 +2138,9 @@ int ha_commit_one_phase(THD *thd, bool all) static bool is_ro_1pc_trans(THD *thd, Ha_trx_info *ha_info, bool all, bool is_real_trans) { - uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all); + bool no_rollback; + uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all, + &no_rollback); bool rw_trans= is_real_trans && (rw_ha_count > (thd->is_current_stmt_binlog_disabled()?0U:1U)); @@ -5145,6 +5171,9 @@ void handler::mark_trx_read_write_internal() */ if (table_share == NULL || table_share->tmp_table == NO_TMP_TABLE) ha_info->set_trx_read_write(); + /* Mark if we are using a table that cannot do rollback */ + if (ht->flags & HTON_NO_ROLLBACK) + ha_info->set_trx_no_rollback(); } } diff --git a/sql/handler.h b/sql/handler.h index b6046091f4f..05541765a0b 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2014,6 +2014,16 @@ public: DBUG_ASSERT(is_started()); return m_flags & (int) TRX_READ_WRITE; } + void set_trx_no_rollback() + { + DBUG_ASSERT(is_started()); + m_flags|= (int) TRX_NO_ROLLBACK; + } + bool is_trx_no_rollback() const + { + DBUG_ASSERT(is_started()); + return m_flags & (int) TRX_NO_ROLLBACK; + } bool is_started() const { return m_ht != NULL; } /** Mark this transaction read-write if the argument is read-write. */ void coalesce_trx_with(const Ha_trx_info *stmt_trx) @@ -2038,7 +2048,7 @@ public: return m_ht; } private: - enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 }; + enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1, TRX_NO_ROLLBACK= 2 }; /** Auxiliary, used for ha_list management */ Ha_trx_info *m_next; /** @@ -5531,7 +5541,7 @@ uint ha_count_rw_all(THD *thd, Ha_trx_info **ptr_ha_info); bool non_existing_table_error(int error); uint ha_count_rw_2pc(THD *thd, bool all); uint ha_check_and_coalesce_trx_read_only(THD *thd, Ha_trx_info *ha_list, - bool all); + bool all, bool *no_rollback); int get_select_field_pos(Alter_info *alter_info, int select_field_count, bool versioned); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 469cbc9da2d..010cab56614 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1446,7 +1446,8 @@ bool wsrep_check_mode_after_open_table (THD *thd, } // Check are we inside a transaction - uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, thd->transaction->all.ha_list, true); + bool not_used; + uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, thd->transaction->all.ha_list, true, ¬_used); bool changes= wsrep_has_changes(thd); // Roll back current stmt if exists From 6878c1400042f45ad0ba466c49ba7b0a6e750308 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 20 May 2025 10:39:53 +0300 Subject: [PATCH 74/89] Updated storage/maria/ma_test_big.sh to use aria_ instead of maria_ I also improved the script to use 'tmp' for storing test files instead of current directory --- storage/maria/ma_test_big.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) mode change 100644 => 100755 storage/maria/ma_test_big.sh diff --git a/storage/maria/ma_test_big.sh b/storage/maria/ma_test_big.sh old mode 100644 new mode 100755 index 6419d05e3a4..41260151cd7 --- a/storage/maria/ma_test_big.sh +++ b/storage/maria/ma_test_big.sh @@ -4,19 +4,23 @@ # finding bugs in blob handling # +mkdir -p tmp +cd tmp set -e a=15 while test $a -le 5000 do echo $a - rm -f maria_log* - ma_test2 -s -L -K -W -P -M -T -c -b32768 -t4 -A1 -m$a > /dev/null - maria_read_log -a -s >& /dev/null - maria_chk -es test2 - maria_read_log -a -s >& /dev/null - maria_chk -es test2 + rm -f aria_log* + ../ma_test2 -s -L -K -W -P -M -T -c -b32768 -t4 -A1 -m$a > /dev/null + ../aria_read_log -a -s >& /dev/null + ../aria_chk -ess test2 + ../aria_read_log -a -s >& /dev/null + ../aria_chk -ess test2 rm test2.MA? - maria_read_log -a -s >& /dev/null - maria_chk -es test2 + ../aria_read_log -a -s >& /dev/null + ../aria_chk -ess test2 a=$((a+1)) done +cd .. +rm -r tmp From 5f83b219bb05f3e24fedb3ddc90a7d81c1a73d0e Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 21 May 2025 10:59:34 +0300 Subject: [PATCH 75/89] Fixed compiler warning from clang in connect/tabxcl.cpp --- storage/connect/tabxcl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/connect/tabxcl.cpp b/storage/connect/tabxcl.cpp index d354f556ca1..8f77ecb8357 100644 --- a/storage/connect/tabxcl.cpp +++ b/storage/connect/tabxcl.cpp @@ -186,8 +186,8 @@ bool TDBXCL::OpenDB(PGLOBAL g) /*********************************************************************/ /* Physically open the object table. */ /*********************************************************************/ - if (Tdbp->OpenDB(g)) - return TRUE; + if (Tdbp->OpenDB(g)) + return TRUE; Use = USE_OPEN; return FALSE; From ce4f83e6b93756ad9dc94dab61afaf0db06417b3 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 25 May 2025 15:47:26 +0300 Subject: [PATCH 76/89] MDEV-29157 SELECT using ror_merged scan fails with s3 tables handler::clone() call did not work with read only tables like S3. It gave a wrong error message (out of memory instead of a permission error) and aborted the query. The issue was that the clone call had a wrong parameter to ha_open(). This now fixed. I also changed the clone call to provide the correct error message if things fails. This patch fixes an 'out of memory' error when using the S3 engine for queries that could use multiple indexes together to find the matching rows, like the following: SELECT * FROM t1 WHERE key1 = 99 OR key2 = 2 --- mysql-test/suite/s3/clone.result | 12 ++++++++++++ mysql-test/suite/s3/clone.test | 14 ++++++++++++++ sql/handler.cc | 11 +++++++++-- sql/opt_range.cc | 9 +-------- 4 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 mysql-test/suite/s3/clone.result create mode 100644 mysql-test/suite/s3/clone.test diff --git a/mysql-test/suite/s3/clone.result b/mysql-test/suite/s3/clone.result new file mode 100644 index 00000000000..a33c8c4259a --- /dev/null +++ b/mysql-test/suite/s3/clone.result @@ -0,0 +1,12 @@ +# +# SELECT using ror_merged scan fails with s3 tables +# +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 (a INT, b INT, KEY(a), KEY(b)) ENGINE=Aria; +INSERT INTO t1 VALUES (0,0),(0,10),(3,10); +ALTER TABLE t1 ENGINE=S3; +SELECT * FROM t1 WHERE a = 99 OR b = 2; +a b +DROP TABLE t1; diff --git a/mysql-test/suite/s3/clone.test b/mysql-test/suite/s3/clone.test new file mode 100644 index 00000000000..5695257c404 --- /dev/null +++ b/mysql-test/suite/s3/clone.test @@ -0,0 +1,14 @@ +--source include/have_s3.inc +--source include/have_sequence.inc +--source include/have_innodb.inc + +--echo # +--echo # SELECT using ror_merged scan fails with s3 tables +--echo # + +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT, b INT, KEY(a), KEY(b)) ENGINE=Aria; +INSERT INTO t1 VALUES (0,0),(0,10),(3,10); +ALTER TABLE t1 ENGINE=S3; +SELECT * FROM t1 WHERE a = 99 OR b = 2; +DROP TABLE t1; diff --git a/sql/handler.cc b/sql/handler.cc index cd8d2e4287d..44a9cf8b173 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3317,12 +3317,16 @@ int ha_delete_table(THD *thd, handlerton *hton, const char *path, handler *handler::clone(const char *name, MEM_ROOT *mem_root) { + int error= 0; handler *new_handler= get_new_handler(table->s, mem_root, ht); if (!new_handler) return NULL; if (new_handler->set_ha_share_ref(ha_share)) + { + error= ER_OUT_OF_RESOURCES; goto err; + } /* TODO: Implement a more efficient way to have more than one index open for @@ -3331,14 +3335,17 @@ handler *handler::clone(const char *name, MEM_ROOT *mem_root) This is not critical as the engines already have the table open and should be able to use the original instance of the table. */ - if (new_handler->ha_open(table, name, table->db_stat, - HA_OPEN_IGNORE_IF_LOCKED, mem_root)) + if ((error= new_handler->ha_open(table, name, + table->db_stat & HA_READ_ONLY ? + O_RDONLY : O_RDWR, + HA_OPEN_IGNORE_IF_LOCKED, mem_root))) goto err; new_handler->handler_stats= handler_stats; return new_handler; err: + new_handler->print_error(error, MYF(0)); delete new_handler; return NULL; } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 975e1b7b1f7..0a3d71abe93 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1532,14 +1532,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, if (!(file= head->file->clone(head->s->normalized_path.str, local_alloc))) { - /* - Manually set the error flag. Note: there seems to be quite a few - places where a failure could cause the server to "hang" the client by - sending no response to a query. ATM those are not real errors because - the storage engine calls in question happen to never fail with the - existing storage engines. - */ - my_error(ER_OUT_OF_RESOURCES, MYF(0)); /* purecov: inspected */ + /* clone() has already generated an error message */ /* Caller will free the memory */ goto failure; /* purecov: inspected */ } From 0a91bbdc41f7be703f422ed7b9ed393271d36b36 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 27 May 2025 10:57:16 +0300 Subject: [PATCH 77/89] Get debug version to compile with gcc 7.5.0 --- include/my_attribute.h | 15 ++++++++++++++- sql/sql_show.cc | 7 +++++++ storage/innobase/handler/i_s.cc | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/my_attribute.h b/include/my_attribute.h index 2ffd65fae3d..04f6a62b4a1 100644 --- a/include/my_attribute.h +++ b/include/my_attribute.h @@ -91,9 +91,22 @@ _Pragma("GCC diagnostic ignored \"-Wframe-larger-than=\"") #define PRAGMA_REENABLE_CHECK_STACK_FRAME \ _Pragma("GCC diagnostic pop") +/* + The following check is for older gcc version that allocates + a lot of stack during startup that does not need to be checked +*/ + +#if !defined(__clang__) && __GNUC__ < 13 +#define PRAGMA_DISABLE_CHECK_STACK_FRAME_EXTRA PRAGMA_DISABLE_CHECK_STACK_FRAME #else +#define PRAGMA_DISABLE_CHECK_STACK_FRAME_EXTRA +#endif /* !defined(__clang__) && __GNUC__ < 13 */ + +#else /*! __GNUC__ */ #define PRAGMA_DISABLE_CHECK_STACK_FRAME #define PRAGMA_REENABLE_CHECK_STACK_FRAME -#endif +#define PRAGMA_DISABLE_CHECK_STACK_FRAME +#define PRAGMA_DISABLE_CHECK_STACK_FRAME_EXTRA +#endif /* __GNUC__ */ #endif /* _my_attribute_h */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 6ba6f8088fa..b1e7dbdc52a 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -9747,6 +9747,13 @@ void init_fill_schema_files_row(TABLE* table) } +/* + gcc 7.5.0 uses a lot of stack at startup to resolve Column() expressions + Note, do not use PRAGMA_REENABLE_CHECK_STACK_FRAME later on in this file + as this causes compilation to fail. +*/ +PRAGMA_DISABLE_CHECK_STACK_FRAME_EXTRA + namespace Show { ST_FIELD_INFO referential_constraints_fields_info[]= diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index c38ff61b0e4..6385f31fe62 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1209,6 +1209,7 @@ struct st_maria_plugin i_s_innodb_cmp_reset = MariaDB_PLUGIN_MATURITY_STABLE, }; +PRAGMA_DISABLE_CHECK_STACK_FRAME_EXTRA namespace Show { /* Fields of the dynamic tables From 643319a7fb1e273797c2a1e46d76cfac0fa1da8f Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 30 May 2025 11:22:58 +0300 Subject: [PATCH 78/89] MDEV-36465 MDEV-33813 Regression, Queries in 'Waiting for someone to free space' state will not automatically retry IO and hang forever MDEV-33813 caused a regressing in that when a disk got full when writing to a MyISAM or Aria table the MariaDB connection would, instead of doing a retry after 60 seconds, hang until the query was killed. Fixed by changing mysql_coind_wait() top mysql_cond_timedwait() Author: Thomas Stangner --- sql/sql_class.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index da8120abaab..62d1cb068c3 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -8509,16 +8509,19 @@ void mariadb_sleep_for_space(unsigned int seconds) { THD *thd= current_thd; PSI_stage_info old_stage; + struct timespec abstime; if (!thd) { sleep(seconds); return; } - mysql_mutex_lock(&thd->LOCK_wakeup_ready); + set_timespec(abstime, seconds); + mysql_mutex_lock(&thd->LOCK_wakeup_ready); thd->ENTER_COND(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready, &stage_waiting_for_disk_space, &old_stage); if (!thd->killed) - mysql_cond_wait(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready); + mysql_cond_timedwait(&thd->COND_wakeup_ready, &thd->LOCK_wakeup_ready, + &abstime); thd->EXIT_COND(&old_stage); return; } From 5cd982c51b63f6e18a7ebe0cec64e2b21da7089f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 3 Jun 2025 14:18:09 +1000 Subject: [PATCH 79/89] MDEV-34863 RAM Usage Changed Significantly Between 10.11 Releases (postfix) Correct error message to use the correct system variable name - innodb_buffer_pool_size_auto_min --- storage/innobase/buf/buf0buf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 918d0d5d25e..19fb01cbf5e 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1037,7 +1037,7 @@ inline void buf_pool_t::garbage_collect() noexcept mysql_mutex_unlock(&mutex); sql_print_information("InnoDB: Memory pressure event disregarded;" " innodb_buffer_pool_size=%zum," - " innodb_buffer_pool_size_min=%zum", + " innodb_buffer_pool_size_auto_min=%zum", old_size >> 20, min_size >> 20); return; } From 6409e43177a0549160fa7980c6c42148af184691 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 18 May 2025 18:55:04 -0400 Subject: [PATCH 80/89] Replace deprecated CMAKE_COMPILER_IS_GNU(CC|CXX) with CMAKE_(C|CXX)_COMPILER_ID As of CMake 3.24 CMAKE_COMPILER_IS_GNU(CC|CXX) are deprecated and should be replaced with CMAKE_(C|CXX)_COMPILER_ID which were introduced with CMake 2.6. --- CMakeLists.txt | 2 +- cmake/build_configurations/mysql_release.cmake | 8 ++++---- cmake/dtrace.cmake | 2 +- cmake/maintainer.cmake | 2 +- cmake/os/SunOS.cmake | 4 ++-- mysys/CMakeLists.txt | 6 +++--- scripts/CMakeLists.txt | 2 +- storage/innobase/CMakeLists.txt | 4 ++-- storage/mroonga/CMakeLists.txt | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edd2738e890..4376def4580 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,7 +292,7 @@ ENDIF() SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") -IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10") +IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10") # Enable extra checks when using a recent enough version of GNU libstdc++ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS") ENDIF() diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 5e9fbf7a8f0..58877c2dabb 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -174,7 +174,7 @@ ENDIF() IF(UNIX) # Default GCC flags - IF(CMAKE_COMPILER_IS_GNUCC) + IF(CMAKE_C_COMPILER_ID STREQUAL "GNU") SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized") STRING(APPEND CMAKE_C_FLAGS_DEBUG " ${COMMON_C_FLAGS}") STRING(APPEND CMAKE_C_FLAGS_RELEASE " ${COMMON_C_FLAGS}") @@ -183,7 +183,7 @@ IF(UNIX) STRING(REGEX REPLACE "-O2" "-O3" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") STRING(REGEX REPLACE "-O2" "-O3" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") ENDIF() - IF(CMAKE_COMPILER_IS_GNUCXX) + IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized") STRING(APPEND CMAKE_CXX_FLAGS_DEBUG " ${COMMON_CXX_FLAGS}") STRING(APPEND CMAKE_CXX_FLAGS_RELEASE " ${COMMON_CXX_FLAGS}") @@ -203,11 +203,11 @@ IF(UNIX) SET(z_flags "") ENDIF() - IF(CMAKE_COMPILER_IS_GNUCC) + IF(CMAKE_C_COMPILER_ID STREQUAL "GNU") STRING(APPEND CMAKE_C_FLAGS_RELEASE " ${z_flags}") STRING(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " ${z_flags}") ENDIF() - IF(CMAKE_COMPILER_IS_GNUCXX) + IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") STRING(APPEND CMAKE_CXX_FLAGS_RELEASE " ${z_flags}") STRING(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " ${z_flags}") ENDIF() diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index 9d3d3cd50c5..0ba7fc7d6dd 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -13,7 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SIZEOF_VOID_P EQUAL 4) IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES) EXECUTE_PROCESS( diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 25c50d82fa1..86c5f289cac 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -60,7 +60,7 @@ ENDFOREACH() SET(MY_ERROR_FLAGS -Werror -fno-operator-names) -IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") +IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized) SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=non-virtual-dtor) # gcc bug 7302 ENDIF() diff --git a/cmake/os/SunOS.cmake b/cmake/os/SunOS.cmake index 3a9d2dccb87..e971a86e606 100644 --- a/cmake/os/SunOS.cmake +++ b/cmake/os/SunOS.cmake @@ -69,8 +69,8 @@ CHECK_C_SOURCE_RUNS( # Check is special processor flag needs to be set on older GCC -#that defaults to v8 sparc . Code here is taken from my_rdtsc.h -IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4 +# that defaults to v8 sparc . Code here is taken from my_rdtsc.h +IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") SET(SOURCE " diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 5970be64ca5..154080aca7c 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -67,19 +67,19 @@ IF(MSVC_INTEL) ENDIF() ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|i386|i686") SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32_x86.c crc32/crc32c_x86.cc) - IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5") + IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5") SET_SOURCE_FILES_PROPERTIES(crc32/crc32_x86.c PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") ENDIF() IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(MYSYS_SOURCES ${MYSYS_SOURCES} crc32/crc32c_amd64.cc) - IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5") + IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5") SET_SOURCE_FILES_PROPERTIES(crc32/crc32c_amd64.cc PROPERTIES COMPILE_FLAGS "-msse4.2 -mpclmul") ENDIF() ENDIF() ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64") - IF(CMAKE_COMPILER_IS_GNUCC) + IF(CMAKE_C_COMPILER_ID STREQUAL "GNU") include(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES(" diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 2626aebcff3..f3c435ab171 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -394,7 +394,7 @@ ELSE() ENDIF() # Install libgcc as mylibgcc.a -IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static") +IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_FLAGS MATCHES "-static") EXECUTE_PROCESS ( COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS} --print-libgcc diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 64540c2256d..c25db81968e 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -95,7 +95,7 @@ ENDIF() IF(NOT MSVC) # Work around MDEV-18417, MDEV-18656, MDEV-18417 - IF(WITH_ASAN AND CMAKE_COMPILER_IS_GNUCC AND + IF(WITH_ASAN AND CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") SET_SOURCE_FILES_PROPERTIES(trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1) ENDIF() @@ -455,7 +455,7 @@ ADD_DEFINITIONS(${SSL_DEFINES} ${TPOOL_DEFINES}) # A GCC bug causes crash when compiling these files on ARM64 with -O1+ # Compile them with -O0 as a workaround. -IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" +IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "5.2.0") ADD_COMPILE_FLAGS( btr/btr0btr.cc diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt index 6135a4bc7fd..1538b6cc46a 100644 --- a/storage/mroonga/CMakeLists.txt +++ b/storage/mroonga/CMakeLists.txt @@ -326,7 +326,7 @@ else() if(WITH_DEBUG) set_property(TARGET mroonga APPEND PROPERTY COMPILE_DEFINITIONS "SAFE_MUTEX") - if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} -g3 -O0") set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} -g3 -O0") endif() @@ -353,7 +353,7 @@ else() COMPILE_DEFINITIONS "MY_PTHREAD_FASTMUTEX") endif() - if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") MY_CHECK_AND_SET_COMPILER_FLAG("-Wall") MY_CHECK_AND_SET_COMPILER_FLAG("-Wextra") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-parameter") From 5ff01ad7bba0797d957549af8e007e8ea5a46117 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Tue, 3 Jun 2025 11:27:21 +0300 Subject: [PATCH 81/89] MDEV-33370 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed after ALTER TABLE of versioned table Missed error code resulted in my_ok() at higher frame which failed on assertion for m_status in state of error. --- mysql-test/suite/versioning/r/partition.result | 12 ++++++++++++ mysql-test/suite/versioning/t/partition.test | 14 ++++++++++++++ sql/ha_partition.cc | 3 +++ 3 files changed, 29 insertions(+) diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 30190235805..4c257426f72 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -3512,6 +3512,18 @@ f() drop table t; drop function f; # +# MDEV-33370 Assertion `!is_set() || (m_status == DA_OK_BULK && +# is_bulk_op())' failed after ALTER TABLE of versioned table +# +create table t1 (i int) with system versioning +partition by system_time interval 1 month ( +partition ver_p1 history, +partition ver_p2 history, +partition ver_pn current); +alter table `t1` partition by system_time interval 7 year ; +ERROR 22003: TIMESTAMP value is out of range in 'INTERVAL' +drop table t1; +# # End of 10.11 tests # set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index def50dfdd17..ed1f66dadc7 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -2766,6 +2766,20 @@ select f(); drop table t; drop function f; +--echo # +--echo # MDEV-33370 Assertion `!is_set() || (m_status == DA_OK_BULK && +--echo # is_bulk_op())' failed after ALTER TABLE of versioned table +--echo # +create table t1 (i int) with system versioning +partition by system_time interval 1 month ( + partition ver_p1 history, + partition ver_p2 history, + partition ver_pn current); + +--error ER_DATA_OUT_OF_RANGE +alter table `t1` partition by system_time interval 7 year ; +drop table t1; + --echo # --echo # End of 10.11 tests --echo # diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index d1f623d566a..70f4b03868e 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2193,7 +2193,10 @@ int ha_partition::copy_partitions(ulonglong * const copied, else if (m_part_info->part_type == VERSIONING_PARTITION) { if (m_part_info->check_constants(ha_thd(), m_part_info)) + { + result= HA_ERR_PARTITION_LIST; goto init_error; + } } while (reorg_part < m_reorged_parts) From e7aaf29e00d48b312a9c4aaba07b04552169b1c0 Mon Sep 17 00:00:00 2001 From: Raghunandan Bhat Date: Fri, 23 May 2025 16:12:01 +0530 Subject: [PATCH 82/89] MDEV-24588: Fix crash with unnamed column in derived table MariaDB server crashes when a query includes a derived table containing unnamed column (eg: `SELECT '' from t`). When `Item` object representing such unnamed column was checked for valid, non-empty name in `TABLE_LIST::create_field_translation`, the server crahsed(assertion `item->name.str && item->name.str[0]` failed). This fix removes the redundant assertion. The assert was a strict debug guard that's no longer needed because the code safely handles empty strings without it. Selecting `''` from a derived table caused `item->name.str` to be an empty string. While the pointer itself wasn't `NULL` (`item->name.str` is `true`), its first character (`item->name.str[0]`) was null terminator, which evaluates to `false` and eventually made the assert fail. The code immediately after the assert can safely handle empty strings and the assert was guarding against something which the code can already handle. Includes `mysql-test/main/derived.test` to verify the fix. --- mysql-test/main/derived.result | 146 +++++++++++++++++++++++++++++++++ mysql-test/main/derived.test | 108 ++++++++++++++++++++++++ sql/table.cc | 1 - 3 files changed, 254 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result index f2561a2569f..884fc161cb1 100644 --- a/mysql-test/main/derived.result +++ b/mysql-test/main/derived.result @@ -1356,3 +1356,149 @@ drop table t1,t2,t3; # # End of 10.3 tests # +# +# MDEV-24588: Fix crash with unnamed column in derived table. +# Assertion `item->name.str && item->name.str[0]` in +# `TABLE_LIST::create_field_translation` fails when a SELECT +# query includes a derived table containing unnamed column +# (eg: `SELECT '' from t`). +# +# Tests from the bug report +CREATE TABLE t (pk INT PRIMARY KEY); +INSERT INTO t VALUES (1), (2), (3); +SELECT SHA(pk) IN (SELECT * FROM (SELECT '' FROM t) AS a) FROM t; +SHA(pk) IN (SELECT * FROM (SELECT '' FROM t) AS a) +0 +0 +0 +SET sql_mode=''; +PREPARE p FROM 'SELECT SHA(pk) IN (SELECT * FROM (SELECT \'\' FROM t) AS a) FROM t;'; +EXECUTE p; +SHA(pk) IN (SELECT * FROM (SELECT '' FROM t) AS a) +0 +0 +0 +EXECUTE p; +SHA(pk) IN (SELECT * FROM (SELECT '' FROM t) AS a) +0 +0 +0 +DEALLOCATE PREPARE p; +# Tests on derived tables +SELECT * FROM (SELECT 1, '' FROM t) AS a; +1 +1 +1 +1 +SELECT * FROM (SELECT '', 1 FROM t) AS a; + 1 + 1 + 1 + 1 +SELECT * FROM (SELECT 1, 2, '' FROM t) AS a; +1 2 +1 2 +1 2 +1 2 +SELECT * FROM (SELECT pk, '' FROM t) AS a; +pk +1 +2 +3 +SELECT '/', '/'; +/ / +/ / +SELECT * FROM (SELECT pk, '', '' as c1 FROM t) AS a; +pk c1 +1 +2 +3 +SELECT * FROM (SELECT '', '' from t) AS a; +ERROR 42S21: Duplicate column name '' +SELECT * FROM (SELECT '/', '/' FROM t) AS a; +ERROR 42S21: Duplicate column name '/' +SELECT * FROM (SELECT '/', '/') AS a; +ERROR 42S21: Duplicate column name '/' +DROP TABLE t; +# Tests on views +CREATE TABLE t (pk INT PRIMARY KEY); +INSERT INTO t VALUES (1), (2), (3); +CREATE VIEW v_t AS SELECT * FROM t; +SHOW CREATE VIEW v_t; +View Create View character_set_client collation_connection +v_t CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_t` AS select `t`.`pk` AS `pk` from `t` latin1 latin1_swedish_ci +SELECT SHA(pk) IN (SELECT * FROM (SELECT '' FROM v_t) AS a) FROM v_t; +SHA(pk) IN (SELECT * FROM (SELECT '' FROM v_t) AS a) +0 +0 +0 +SELECT * FROM (SELECT pk, '', '' as c1 FROM v_t) AS a; +pk c1 +1 +2 +3 +SELECT * FROM (SELECT '', '' from v_t) AS a; +ERROR 42S21: Duplicate column name '' +SELECT * FROM (SELECT '/', '/' from v_t) AS a; +ERROR 42S21: Duplicate column name '/' +CREATE VIEW v1 AS SELECT '/', '/'; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select '/' AS `/`,'/' AS `My_exp_/` latin1 latin1_swedish_ci +DROP VIEW v_t, v1; +DROP TABLE t; +# Tests on views created using SELECT statements that contain derived columns +CREATE TABLE t (pk INT PRIMARY KEY); +INSERT INTO t VALUES (1), (2), (3); +CREATE VIEW v1_t AS SELECT '' FROM t; +SHOW CREATE VIEW v1_t; +View Create View character_set_client collation_connection +v1_t CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1_t` AS select '' AS `Name_exp_1` from `t` latin1 latin1_swedish_ci +SELECT * FROM v1_t; +Name_exp_1 + + + +CREATE VIEW v2_t AS SELECT * FROM (SELECT '' FROM t) AS a; +SHOW CREATE VIEW v2_t; +View Create View character_set_client collation_connection +v2_t CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2_t` AS select `tmp_field` AS `Name_exp_1` from (select '' from `t`) `a` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v2_t' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM v2_t; +ERROR HY000: View 'test.v2_t' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +CREATE VIEW v3_t AS SELECT * FROM (SELECT '' as c1 FROM t) AS a; +SHOW CREATE VIEW v3_t; +View Create View character_set_client collation_connection +v3_t CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3_t` AS select `a`.`c1` AS `c1` from (select '' AS `c1` from `t`) `a` latin1 latin1_swedish_ci +SELECT * FROM v3_t; +c1 + + + +CREATE VIEW v4_t AS SELECT * FROM (SELECT 1, '' FROM t) AS a; +SHOW CREATE VIEW v4_t; +View Create View character_set_client collation_connection +v4_t CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4_t` AS select `a`.`1` AS `1`,`tmp_field` AS `Name_exp_2` from (select 1 AS `1`,'' from `t`) `a` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v4_t' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * from v4_t; +ERROR HY000: View 'test.v4_t' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +CREATE VIEW v5_t AS SELECT ''; +SHOW CREATE VIEW v5_t; +View Create View character_set_client collation_connection +v5_t CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v5_t` AS select '' AS `Name_exp_1` latin1 latin1_swedish_ci +SELECT * FROM v5_t; +Name_exp_1 + +CREATE VIEW v6_t AS SELECT * FROM (SELECT '') AS a; +SHOW CREATE VIEW v6_t; +View Create View character_set_client collation_connection +v6_t CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6_t` AS select `tmp_field` AS `Name_exp_1` from (select '') `a` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v6_t' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM v6_t; +ERROR HY000: View 'test.v6_t' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v1_t, v2_t, v3_t, v4_t, v5_t, v6_t; +DROP TABLE t; +# End of 10.11 tests diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index 3cb665c8e6b..7b924437b30 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -1183,3 +1183,111 @@ drop table t1,t2,t3; --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # MDEV-24588: Fix crash with unnamed column in derived table. +--echo # Assertion `item->name.str && item->name.str[0]` in +--echo # `TABLE_LIST::create_field_translation` fails when a SELECT +--echo # query includes a derived table containing unnamed column +--echo # (eg: `SELECT '' from t`). +--echo # + +--echo # Tests from the bug report + +CREATE TABLE t (pk INT PRIMARY KEY); +INSERT INTO t VALUES (1), (2), (3); + +# this should pass withiout assertion fail in dbg or should not crash mariadb server +SELECT SHA(pk) IN (SELECT * FROM (SELECT '' FROM t) AS a) FROM t; + +# The PREPARE command itself should succeed without crashing +SET sql_mode=''; +PREPARE p FROM 'SELECT SHA(pk) IN (SELECT * FROM (SELECT \'\' FROM t) AS a) FROM t;'; + +EXECUTE p; +EXECUTE p; + +DEALLOCATE PREPARE p; + +--echo # Tests on derived tables + +SELECT * FROM (SELECT 1, '' FROM t) AS a; +SELECT * FROM (SELECT '', 1 FROM t) AS a; +SELECT * FROM (SELECT 1, 2, '' FROM t) AS a; +SELECT * FROM (SELECT pk, '' FROM t) AS a; +SELECT '/', '/'; + +SELECT * FROM (SELECT pk, '', '' as c1 FROM t) AS a; +--error ER_DUP_FIELDNAME +SELECT * FROM (SELECT '', '' from t) AS a; +--error ER_DUP_FIELDNAME +SELECT * FROM (SELECT '/', '/' FROM t) AS a; +--error ER_DUP_FIELDNAME +SELECT * FROM (SELECT '/', '/') AS a; + +DROP TABLE t; + +--echo # Tests on views + +CREATE TABLE t (pk INT PRIMARY KEY); +INSERT INTO t VALUES (1), (2), (3); + +CREATE VIEW v_t AS SELECT * FROM t; +SHOW CREATE VIEW v_t; + +SELECT SHA(pk) IN (SELECT * FROM (SELECT '' FROM v_t) AS a) FROM v_t; + +SELECT * FROM (SELECT pk, '', '' as c1 FROM v_t) AS a; +--error ER_DUP_FIELDNAME +SELECT * FROM (SELECT '', '' from v_t) AS a; +--error ER_DUP_FIELDNAME +SELECT * FROM (SELECT '/', '/' from v_t) AS a; + +CREATE VIEW v1 AS SELECT '/', '/'; +SHOW CREATE VIEW v1; + +DROP VIEW v_t, v1; +DROP TABLE t; + +--echo # Tests on views created using SELECT statements that contain derived columns + +CREATE TABLE t (pk INT PRIMARY KEY); +INSERT INTO t VALUES (1), (2), (3); + +CREATE VIEW v1_t AS SELECT '' FROM t; +SHOW CREATE VIEW v1_t; + +SELECT * FROM v1_t; + +CREATE VIEW v2_t AS SELECT * FROM (SELECT '' FROM t) AS a; +SHOW CREATE VIEW v2_t; + +--error ER_VIEW_INVALID +SELECT * FROM v2_t; + +CREATE VIEW v3_t AS SELECT * FROM (SELECT '' as c1 FROM t) AS a; +SHOW CREATE VIEW v3_t; + +SELECT * FROM v3_t; + +CREATE VIEW v4_t AS SELECT * FROM (SELECT 1, '' FROM t) AS a; +SHOW CREATE VIEW v4_t; + +--error ER_VIEW_INVALID +SELECT * from v4_t; + +CREATE VIEW v5_t AS SELECT ''; +SHOW CREATE VIEW v5_t; + +SELECT * FROM v5_t; + +CREATE VIEW v6_t AS SELECT * FROM (SELECT '') AS a; +SHOW CREATE VIEW v6_t; + +--error ER_VIEW_INVALID +SELECT * FROM v6_t; + +DROP VIEW v1_t, v2_t, v3_t, v4_t, v5_t, v6_t; +DROP TABLE t; + +--echo # End of 10.11 tests diff --git a/sql/table.cc b/sql/table.cc index 3a51228d1f3..81f734269ea 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -6054,7 +6054,6 @@ allocate: while ((item= it++)) { - DBUG_ASSERT(item->name.str && item->name.str[0]); transl[field_count].name.str= thd->strmake(item->name.str, item->name.length); transl[field_count].name.length= item->name.length; transl[field_count++].item= item; From 67e6fdee05ead4974fe632e91c38941ade369b0c Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Wed, 4 Jun 2025 09:39:02 -0400 Subject: [PATCH 83/89] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 35480ab4c82..fa9625685aa 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=11 MYSQL_VERSION_MINOR=8 -MYSQL_VERSION_PATCH=2 +MYSQL_VERSION_PATCH=3 SERVER_MATURITY=stable From 11d1ac7285221ab4df7d9ef7cc8ee949b01c9b32 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 4 Jun 2025 15:16:54 +1000 Subject: [PATCH 84/89] MDEV-35856 Remove error code introduced to 10.11 in MDEV-36032 Two new error codes ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS and ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS were introduced in MDEV-36032 in both 10.11 and, as part of MDEV-22491, 12.0. Here we remove them from 10.11, but they should remain in 12.0. --- mysql-test/suite/sql_sequence/alter.result | 8 ++++---- mysql-test/suite/sql_sequence/alter.test | 8 ++++---- sql/share/errmsg-utf8.txt | 4 ---- sql/sql_table.cc | 8 ++++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index eb419609823..6f040764418 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -426,7 +426,7 @@ create sequence s; alter table s sequence=0; insert into s values (3,1,9223372036854775806,1,1,1000,0,0); alter table s sequence=1; -ERROR HY000: More than one row in the table +ERROR HY000: Internal error: More than one row in the table drop table s; create sequence s; alter table s sequence=0; @@ -475,17 +475,17 @@ CREATE TABLE `s1` ( `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' ) ENGINE=innodb; alter table s1 sequence=1; -ERROR HY000: Fewer than one row in the table +ERROR HY000: Internal error: Fewer than one row in the table alter table s1 sequence=0; insert into s1 values (1,1,9223372036854775806,1,1,1000,0,0); alter table s1 sequence=1; alter table s1 sequence=0; insert into s1 values (2,1,9223372036854775806,1,1,1000,0,0); alter table s1 sequence=1; -ERROR HY000: More than one row in the table +ERROR HY000: Internal error: More than one row in the table alter table s1 sequence=0; insert into s1 values (3,1,9223372036854775806,1,1,1000,0,0); alter table s1 sequence=1; -ERROR HY000: More than one row in the table +ERROR HY000: Internal error: More than one row in the table drop table s1; # End of 10.11 tests diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test index 2bb2e1f62af..b79f83ffd76 100644 --- a/mysql-test/suite/sql_sequence/alter.test +++ b/mysql-test/suite/sql_sequence/alter.test @@ -304,7 +304,7 @@ DROP SEQUENCE s2; create sequence s; alter table s sequence=0; insert into s values (3,1,9223372036854775806,1,1,1000,0,0); ---error ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS +--error ER_INTERNAL_ERROR alter table s sequence=1; drop table s; @@ -355,7 +355,7 @@ CREATE TABLE `s1` ( `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done' ) ENGINE=innodb; ---error ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS +--error ER_INTERNAL_ERROR alter table s1 sequence=1; # (for coverage) alter a non sequence table with sequence=0 alter table s1 sequence=0; @@ -364,13 +364,13 @@ alter table s1 sequence=1; alter table s1 sequence=0; insert into s1 values (2,1,9223372036854775806,1,1,1000,0,0); ---error ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS +--error ER_INTERNAL_ERROR alter table s1 sequence=1; # (for coverage) alter a non sequence table with sequence=0 alter table s1 sequence=0; insert into s1 values (3,1,9223372036854775806,1,1,1000,0,0); ---error ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS +--error ER_INTERNAL_ERROR alter table s1 sequence=1; drop table s1; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 93224d9c1b3..e7cbb87824c 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -10758,7 +10758,3 @@ ER_CM_OPTION_MISSING_REQUIREMENT eng "CHANGE MASTER TO option '%s=%s' is missing requirement %s" ER_SLAVE_STATEMENT_TIMEOUT 70100 eng "Slave log event execution was interrupted (slave_max_statement_time exceeded)" -ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS - eng "Fewer than one row in the table" -ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS - eng "More than one row in the table" diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9f61dd13cf7..2451209f0c1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -12159,9 +12159,9 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, from->file->stats.records != 1) { if (from->file->stats.records > 1) - my_error(ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS, MYF(0)); + my_error(ER_INTERNAL_ERROR, MYF(0), "More than one row in the table"); else - my_error(ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS, MYF(0)); + my_error(ER_INTERNAL_ERROR, MYF(0), "Fewer than one row in the table"); goto err; } for (Field **ptr=to->field ; *ptr ; ptr++) @@ -12349,7 +12349,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, } if (to->s->table_type == TABLE_TYPE_SEQUENCE && found_count == 1) { - my_error(ER_SEQUENCE_TABLE_HAS_TOO_MANY_ROWS, MYF(0)); + my_error(ER_INTERNAL_ERROR, MYF(0), "More than one row in the table"); error= 1; break; } @@ -12374,7 +12374,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore, if (to->s->table_type == TABLE_TYPE_SEQUENCE && found_count == 0) { - my_error(ER_SEQUENCE_TABLE_HAS_TOO_FEW_ROWS, MYF(0)); + my_error(ER_INTERNAL_ERROR, MYF(0), "Fewer than one row in the table"); error= 1; } From 9bf0492b7da5a6aefbe59a3906eb2c4d07452039 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 10 Jun 2025 11:53:45 +0200 Subject: [PATCH 85/89] MDEV-36904 Improve runtime dependency packaging on Windows Background: In MDEV-33474, we introduced runtime dependency packaging primarily to support libcurl and other potential third-party dependencies from vcpkg. Problem: The INSTALL(RUNTIME_DEPENDENCY_SET) command was failing at packaging step unless shared libraries from the same build were explicitly excluded via PRE_EXCLUDE_REGEXES. While initially only server.dll was excluded this way, this turned out insufficient for users compiling their own plugins Solution: Exclude all linked shared libraries from the same build via PRE_EXCLUDE_REGEXES. Move dependency detection and install to the end of CMake processing, after all add_library/add_executable calls, when all targets are known. Also made the INSTALL_RUNTIME_DEPENDENCIES variable independent of vcpkg detection, for simplicity. --- CMakeLists.txt | 11 ++------- cmake/install_macros.cmake | 50 +++++++++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 943d4b4f0c2..79c43fb4fc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,15 +126,7 @@ ENDIF() FIND_PACKAGE(Git) IF(WIN32 AND (CMAKE_VERSION VERSION_GREATER "3.21")) - # Install runtime dependency by default, when using vcpkg - IF(NOT DEFINED INSTALL_RUNTIME_DEPENDENCIES_DEFAULT) - IF("${VCPKG_INSTALLED_DIR}") - SET(INSTALL_RUNTIME_DEPENDENCIES_DEFAULT OFF) - ELSE() - SET(INSTALL_RUNTIME_DEPENDENCIES_DEFAULT ON) - ENDIF() - ENDIF() - OPTION(INSTALL_RUNTIME_DEPENDENCIES "Install runtime dependencies" "${INSTALL_RUNTIME_DEPENDENCIES_DEFAULT}") + OPTION(INSTALL_RUNTIME_DEPENDENCIES "Install runtime dependencies" ON) ENDIF() # Following autotools tradition, add preprocessor definitions @@ -596,6 +588,7 @@ ENDIF() INCLUDE(build_depends) +INSTALL_RUNTIME_DEPS() INCLUDE(CPack) IF(WIN32 AND SIGNCODE) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index dd072abdfb8..4a4e3dae9b6 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -228,26 +228,58 @@ FUNCTION(MYSQL_INSTALL_TARGETS) IF(SIGNCODE) SIGN_TARGET(${target} ${COMP}) ENDIF() + IF(INSTALL_RUNTIME_DEPENDENCIES) + # Populate INSTALLED_TARGETS list (stored as global property) + # The list is used in INSTALL_RUNTIME_DEPS + GET_PROPERTY(installed_targets GLOBAL PROPERTY INSTALLED_TARGETS) + IF(NOT installed_targets) + SET(installed_targets) + ENDIF() + LIST(APPEND installed_targets "${target}") + SET_PROPERTY(GLOBAL PROPERTY INSTALLED_TARGETS "${installed_targets}") + SET(RUNTIME_DEPS RUNTIME_DEPENDENCY_SET ${target}) + ENDIF() + INSTALL(TARGETS ${target} DESTINATION ${ARG_DESTINATION} ${COMP} ${RUNTIME_DEPS}) + INSTALL_DEBUG_SYMBOLS(${target} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION}) ENDFOREACH() +ENDFUNCTION() - IF(WIN32 AND INSTALL_RUNTIME_DEPENDENCIES) - STRING(JOIN "." runtime_deps_set_name ${TARGETS}) - SET(RUNTIME_DEPS RUNTIME_DEPENDENCY_SET "${runtime_deps_set_name}") + +# On Windows, installs runtime dependency for all targets +FUNCTION(INSTALL_RUNTIME_DEPS) + IF(NOT WIN32 OR NOT INSTALL_RUNTIME_DEPENDENCIES) + RETURN() ENDIF() + # Install all runtime dependencies - INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP} ${RUNTIME_DEPS}) - INSTALL_DEBUG_SYMBOLS(${TARGETS} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION}) + GET_PROPERTY(installed_targets GLOBAL PROPERTY INSTALLED_TARGETS) + # Exclude all dependencies that are shared libraries from the + # same build. + FOREACH(tgt ${installed_targets}) + SET(exclude_libs) + GET_TARGET_PROPERTY(link_libraries ${tgt} LINK_LIBRARIES) + IF(link_libraries) + FOREACH(lib ${link_libraries}) + IF(TARGET ${lib}) + GET_TARGET_PROPERTY(type ${lib} TYPE) + IF(type MATCHES "SHARED") + LIST(APPEND exclude_libs "$\\.dll") + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() - IF(WIN32 AND INSTALL_RUNTIME_DEPENDENCIES) INSTALL( RUNTIME_DEPENDENCY_SET - "${runtime_deps_set_name}" + ${tgt} COMPONENT RuntimeDeps DESTINATION ${INSTALL_BINDIR} PRE_EXCLUDE_REGEXES "api-ms-" # Windows stuff "ext-ms-" - "server\\.dll" # main server DLL, installed separately + "icuuc\\.dll" # Old Windows 10 (1809) + "icuin\\.dll" + ${exclude_libs} "clang_rt" # ASAN libraries "vcruntime" POST_EXCLUDE_REGEXES @@ -257,7 +289,7 @@ FUNCTION(MYSQL_INSTALL_TARGETS) ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin $<$:${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin> ) - ENDIF() + ENDFOREACH() ENDFUNCTION() # Optionally install mysqld/client/embedded from debug build run. outside of the current build dir From 5203aeffb48bc8a23e09104d13b11d8fd2415fd4 Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Thu, 12 Jun 2025 11:52:17 +0200 Subject: [PATCH 86/89] MDEV-36995: ifunc is not supported by musl Only glibc and not musl currently supports the mechanisms of IFUNC. This fixes 11.8 branch build on Alpine Linux. Build error was: mariadb-11.8.2/sql/vector_mhnsw.cc: In static member function 'static const FVector* FVector::create(metric_type, void*, const void*, size_t)': mariadb-11.8.2/sql/vector_mhnsw.cc:299:19: error: multiversioning needs 'ifunc' which is not supported on this target 299 | static FVector *align_ptr(void *ptr) { return (FVector*)ptr; } | ^~~~~~~~~ mariadb-11.8.2/sql/vector_mhnsw.cc:113:3: error: use of multiversioned function without a default --- sql/bloom_filters.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/bloom_filters.h b/sql/bloom_filters.h index 728e5d9bf2f..55ae72d0923 100644 --- a/sql/bloom_filters.h +++ b/sql/bloom_filters.h @@ -35,7 +35,7 @@ SOFTWARE. implementation for now. */ #define DEFAULT_IMPLEMENTATION -#if __GNUC__ > 7 +#if __GNUC__ > 7 && defined(__GLIBC__) #ifdef __x86_64__ #ifdef HAVE_IMMINTRIN_H #include From 972dff08490900909e7e9877a45b9429918211b3 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 11 Jun 2025 09:40:32 +1000 Subject: [PATCH 87/89] MDEV-34933 remove MSAN exclusion on test plugins.rpl_auth Revert "disable the test that doesn't work in MSAN" This reverts commit 18cf72df56e8582d620711627bbd7820015068ca. --- mysql-test/suite/plugins/t/rpl_auth.test | 3 --- 1 file changed, 3 deletions(-) diff --git a/mysql-test/suite/plugins/t/rpl_auth.test b/mysql-test/suite/plugins/t/rpl_auth.test index 24d321aede9..ecaaf12a04b 100644 --- a/mysql-test/suite/plugins/t/rpl_auth.test +++ b/mysql-test/suite/plugins/t/rpl_auth.test @@ -1,6 +1,3 @@ -# MSAN doesn't like gnutls_rnd -source include/not_msan.inc; - if ($MTR_COMBINATION_ED25519) { let $AUTH_PLUGIN = ed25519; let $CLIENT_PLUGIN=client_ed25519; From c095283ea6f9ef25cd1bd731b6984c7cbc7e4c3f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 11 Jun 2025 09:45:32 +1000 Subject: [PATCH 88/89] MDEV-27964: tests - enable msan tests on have_crypt.inc Old MSAN clang versions crashed on ENCRYPT's use of the crypt function. We've instrumented this in CI for testing. --- mysql-test/include/have_crypt.inc | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysql-test/include/have_crypt.inc b/mysql-test/include/have_crypt.inc index ae94121980c..422f8922edc 100644 --- a/mysql-test/include/have_crypt.inc +++ b/mysql-test/include/have_crypt.inc @@ -1,5 +1,3 @@ -# MDEV-27964 The function ENCRYPT() causes SIGSEGV in WITH_MSAN builds --- source include/not_msan.inc # encrypt('a') is NULL if crypt(3) is not available # encrypt('a') is "*0" in fips mode if (`select length(encrypt('a')) > 3 IS NOT TRUE`) { From dbd701711085c2189a7f07b9ba9b6308d05496d7 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Thu, 12 Jun 2025 14:35:23 -0400 Subject: [PATCH 89/89] MDEV-36997 Assertion failed in ha_tina::delete_row on multi delete Multi-delete code invokes ha_rnd_end after applying deferred deletes, following the pattern as in multi-update. The CSV engine batches deletes made via calls to delete_row, then applies them all at once during ha_rnd_end. For each row batched, the CSV engine decrements an internal counter of the total rows in the table. The multi-delete code was not calling ha_rnd_end, so this internal counter was not consistent with the total number of rows in the table, triggering the assertion. In the CSV engine, explicitly delete the destination file before renaming the source file over it. This avoids a file rename problem on Windows. This change would have been necessary before the latest multi-delete changes, had this test case existed at that point in time, because the end_read_record call in do_table_deletes swallowed the rename failure on Windows. --- mysql-test/main/delete_multi_order_by.result | 34 ++++++++++++++++++++ mysql-test/main/delete_multi_order_by.test | 28 ++++++++++++++++ sql/sql_delete.cc | 4 +++ storage/csv/ha_tina.cc | 1 + 4 files changed, 67 insertions(+) diff --git a/mysql-test/main/delete_multi_order_by.result b/mysql-test/main/delete_multi_order_by.result index 20f3f1b3d30..656090040ef 100644 --- a/mysql-test/main/delete_multi_order_by.result +++ b/mysql-test/main/delete_multi_order_by.result @@ -391,3 +391,37 @@ id v select * from t3; id v drop table t1, t2, t3; +# +# Begin 11.8 tests +# +# +# MDEV-36997 Assertion failed in ha_tina::delete_row on multi delete +# +SET sql_mode=''; +CREATE TABLE t1 (v INT (1) NOT NULL) ENGINE=CSV; +INSERT INTO t1 SELECT 1 away; +SELECT COUNT(*) from t1; +COUNT(*) +1 +DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3; +SELECT COUNT(*) from t1; +COUNT(*) +0 +DROP TABLE t1; +SET sql_mode=''; +CREATE TABLE t1 (v VECTOR (1) NOT NULL) ENGINE=CSV; +INSERT INTO t1 SELECT 1 away; +Warnings: +Warning 4078 Cannot cast 'int' as 'vector' in assignment of `test`.`t1`.`v` +Warning 1292 Incorrect vector value: '1' for column `test`.`t1`.`v` at row 1 +SELECT COUNT(*) from t1; +COUNT(*) +1 +DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3; +SELECT COUNT(*) from t1; +COUNT(*) +0 +DROP TABLE t1; +# +# End 11.8 tests +# diff --git a/mysql-test/main/delete_multi_order_by.test b/mysql-test/main/delete_multi_order_by.test index 801d324c61b..c2c2b281553 100644 --- a/mysql-test/main/delete_multi_order_by.test +++ b/mysql-test/main/delete_multi_order_by.test @@ -3,6 +3,7 @@ # --source include/have_innodb.inc +--source include/have_csv.inc create table t1 (id int primary key, v int); create table t2 (id int primary key, v int); @@ -203,3 +204,30 @@ select * from t2; select * from t3; drop table t1, t2, t3; + +--echo # +--echo # Begin 11.8 tests +--echo # + +--echo # +--echo # MDEV-36997 Assertion failed in ha_tina::delete_row on multi delete +--echo # +SET sql_mode=''; +CREATE TABLE t1 (v INT (1) NOT NULL) ENGINE=CSV; +INSERT INTO t1 SELECT 1 away; +SELECT COUNT(*) from t1; +DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3; +SELECT COUNT(*) from t1; +DROP TABLE t1; + +SET sql_mode=''; +CREATE TABLE t1 (v VECTOR (1) NOT NULL) ENGINE=CSV; +INSERT INTO t1 SELECT 1 away; +SELECT COUNT(*) from t1; +DELETE FROM a3,a1 USING t1 AS a1 JOIN t1 AS a2 JOIN t1 AS a3; +SELECT COUNT(*) from t1; +DROP TABLE t1; + +--echo # +--echo # End 11.8 tests +--echo # diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index cc8eb6082ae..fcf024a1f4c 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1647,6 +1647,10 @@ int multi_delete::rowid_table_deletes(TABLE *table, bool ignore) err: if (err_table) err_table->file->print_error(local_error,MYF(ME_FATAL)); + if (tmp_table->file->inited == handler::init_stat::RND) + tmp_table->file->ha_rnd_end(); + if (table->file->inited == handler::init_stat::RND) + table->file->ha_rnd_end(); DBUG_RETURN(local_error); } diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 98f5a943791..a2c23eb580e 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1463,6 +1463,7 @@ int ha_tina::rnd_end() of the old datafile. */ if (mysql_file_close(data_file, MYF(0)) || + mysql_file_delete(csv_key_file_data, share->data_file_name, MYF(0)) || mysql_file_rename(csv_key_file_data, fn_format(updated_fname, share->table_name, "", CSN_EXT,