From 4b37db70339b07f2357de0590cace45a318d9b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 1 Mar 2022 10:31:26 +0200 Subject: [PATCH 1/4] MDEV-27968 GCC 12 -Og -Wmaybe-uninitialized in udf_handler::fix_fields() udf_handler::fix_fields(): Execute an assignment outside "if" so that GCC 12 will not issue a bogus-looking warning. Also, deduplicate some error handling code. --- sql/item_func.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index 6b8025c9d0f..7a7eaf9dc23 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB + Copyright (c) 2009, 2022, MariaDB 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 @@ -3463,6 +3463,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func, thd->alloc(f_args.arg_count*sizeof(Item_result)))) { + err_exit: free_udf(u_d); DBUG_RETURN(TRUE); } @@ -3504,7 +3505,8 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func, f_args.arg_type[i]=item->result_type(); } //TODO: why all following memory is not allocated with 1 thd->alloc() call? - if (!(buffers=new String[arg_count]) || + buffers= new String[arg_count]; + if (!buffers || !(f_args.args= (char**) thd->alloc(arg_count * sizeof(char *))) || !(f_args.lengths= (ulong*) thd->alloc(arg_count * sizeof(long))) || !(f_args.maybe_null= (char*) thd->alloc(arg_count * sizeof(char))) || @@ -3514,10 +3516,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func, sizeof(char *))) || !(f_args.attribute_lengths= (ulong*) thd->alloc(arg_count * sizeof(long)))) - { - free_udf(u_d); - DBUG_RETURN(TRUE); - } + goto err_exit; } if (func->fix_length_and_dec()) DBUG_RETURN(TRUE); @@ -3583,8 +3582,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func, { my_error(ER_CANT_INITIALIZE_UDF, MYF(0), u_d->name.str, init_msg_buff); - free_udf(u_d); - DBUG_RETURN(TRUE); + goto err_exit; } func->max_length=MY_MIN(initid.max_length,MAX_BLOB_WIDTH); func->maybe_null=initid.maybe_null; From 1c74d1bcacee9d05999c7e3230ae5b6d7c03d440 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 1 Mar 2022 11:36:39 +0200 Subject: [PATCH 2/4] federated.rpl failed if federatedx was not compiled --- mysql-test/suite/federated/rpl.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/federated/rpl.test b/mysql-test/suite/federated/rpl.test index 6ec4bec5a1a..cc94ea8b716 100644 --- a/mysql-test/suite/federated/rpl.test +++ b/mysql-test/suite/federated/rpl.test @@ -1,3 +1,4 @@ +source have_federatedx.inc; source include/have_binlog_format_row.inc; source include/master-slave.inc; From 3fd79a04b69af46eddcdef947bef07b4c139ac75 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 1 Mar 2022 11:46:57 +0200 Subject: [PATCH 3/4] MMDEV-27823 mariadb-install-db --group fails Fixed by not sending --group option to the server (for now) Reviwer: Sergei Golubchik --- scripts/mysql_install_db.sh | 9 +++++---- scripts/mysqld_safe.sh | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 63c014ea098..3df48f0eb95 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -484,10 +484,11 @@ then args="$args --user=$user" fi -if test -n "$group" -then - args="$args --group=$group" -fi +#To be enabled if/when we enable --group as an option to mysqld +#if test -n "$group" +#then +# args="$args --group=$group" +#fi # When doing a "cross bootstrap" install, no reference to the current # host should be added to the system tables. So we filter out any diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 29b6d839685..5574587da6b 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -722,6 +722,7 @@ then if test "$user" != "root" -o $SET_USER = 1 then USER_OPTION="--user=$user" + # To be used if/when we enable --system-group as an option to mysqld GROUP_OPTION="--group=$group" fi if test -n "$open_files" From a92f07f4bd450f7368a998ce63443dd66374262a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Mar 2022 11:51:25 +0200 Subject: [PATCH 4/4] MDEV-27993 Assertion failed in btr_page_reorganize_low() btr_cur_optimistic_insert(): Disregard DEBUG_DBUG injection to invoke btr_page_reorganize() if the page (and the table) is empty. Otherwise, an assertion would fail in btr_page_reorganize_low() because PAGE_MAX_TRX_ID is 0 in an empty secondary index leaf page. --- mysql-test/suite/innodb/r/page_reorganize.result | 7 +++++++ mysql-test/suite/innodb/t/page_reorganize.test | 8 ++++++++ storage/innobase/btr/btr0cur.cc | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/page_reorganize.result b/mysql-test/suite/innodb/r/page_reorganize.result index 1059fc78531..20e1600bd0d 100644 --- a/mysql-test/suite/innodb/r/page_reorganize.result +++ b/mysql-test/suite/innodb/r/page_reorganize.result @@ -25,3 +25,10 @@ f1 disconnect con1; connection default; drop table t1; +# +# MDEV-27993 Assertion failed in btr_page_reorganize_low() +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_DBUG = '+d,do_page_reorganize'; +INSERT INTO t1 VALUES(0,0); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/page_reorganize.test b/mysql-test/suite/innodb/t/page_reorganize.test index 7408353976d..c4e0160cb6d 100644 --- a/mysql-test/suite/innodb/t/page_reorganize.test +++ b/mysql-test/suite/innodb/t/page_reorganize.test @@ -53,4 +53,12 @@ connection default; drop table t1; +--echo # +--echo # MDEV-27993 Assertion failed in btr_page_reorganize_low() +--echo # +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_DBUG = '+d,do_page_reorganize'; +INSERT INTO t1 VALUES(0,0); +DROP TABLE t1; + --source include/wait_until_count_sessions.inc diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 8d0a34d07a1..195edb65e5a 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3,7 +3,7 @@ Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -3212,6 +3212,7 @@ fail_err: << ib::hex(thr ? thr->graph->trx->id : 0) << ' ' << rec_printer(entry).str()); DBUG_EXECUTE_IF("do_page_reorganize", + if (n_recs) btr_page_reorganize(page_cursor, index, mtr);); /* Now, try the insert */