From 58e2ca68bb86e6d1e086ab978f4b8d434ffef184 Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Mon, 29 May 2017 14:52:50 +0530 Subject: [PATCH 01/30] Raise version number after cloning 5.5.57 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 68358acf754..2905c37cc09 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=57 +MYSQL_VERSION_PATCH=58 MYSQL_VERSION_EXTRA= From def68691ce5a97f6a717fc6d33a4f1d26c063ac6 Mon Sep 17 00:00:00 2001 From: Piotr Obrzut Date: Thu, 1 Jun 2017 15:25:04 +0200 Subject: [PATCH 02/30] Bug#26181622 MSI BUILD FAIL DUE TO DUPLICATED FILE ID Fixed generated mysql_server.wxs not to contain duplicates, or too long ids --- packaging/WiX/create_msi.cmake.in | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in index 95cbbb3d437..b306c0c70d3 100644 --- a/packaging/WiX/create_msi.cmake.in +++ b/packaging/WiX/create_msi.cmake.in @@ -218,22 +218,37 @@ MACRO(GENERATE_GUID VarName) OUTPUT_STRIP_TRAILING_WHITESPACE) ENDMACRO() -SET(INC_VAR 0) +# Make sure that WIX identifier created from a path matches all the rules: +# - it is shorter than 72 characters +# - doesn't contain reserver characters ('+', '-' and '/') +# ID_SET contains a global list of all identifiers which are too long. +# Every time we use an identifier which is too long we use its index in +# ID_SET to shorten the name. +SET_PROPERTY(GLOBAL PROPERTY ID_SET) MACRO(MAKE_WIX_IDENTIFIER str varname) STRING(REPLACE "/" "." ${varname} "${str}") + STRING(REPLACE "+" "p" ${varname} "${str}") + STRING(REPLACE "-" "m" ${varname} "${str}") STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}") STRING(LENGTH "${${varname}}" len) + # FIXME: the prefix length has to be controlled better # Identifier should be smaller than 72 character - # We have to cut down the length to 70 chars, since we add 2 char prefix + # We have to cut down the length to 40 chars, since we add prefixes # pretty often - IF(len GREATER 70) - STRING(SUBSTRING "${${varname}}" 0 67 shortstr) - MATH(EXPR INC_VAR ${INC_VAR}+1) - SET(${varname} "${shortstr}${INC_VAR}") + IF(len GREATER 40) + STRING(SUBSTRING "${${varname}}" 0 37 shortstr) + GET_PROPERTY(LOCAL_LIST GLOBAL PROPERTY ID_SET) + LIST(FIND LOCAL_LIST "${${varname}}" STRING_ID) + IF(${STRING_ID} EQUAL -1) + LIST(APPEND LOCAL_LIST "${${varname}}") + SET_PROPERTY(GLOBAL PROPERTY ID_SET "${LOCAL_LIST}") + LIST(LENGTH LOCAL_LIST STRING_ID) + MATH(EXPR STRING_ID "${STRING_ID}-1" ) + ENDIF() + SET(${varname} "${shortstr}${STRING_ID}") ENDIF() ENDMACRO() - FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root) FILE(RELATIVE_PATH dir_rel ${topdir} ${dir}) IF(dir_rel) From 1bb43334fc8e349624c2dd168dffb789e1550633 Mon Sep 17 00:00:00 2001 From: Piotr Obrzut Date: Fri, 2 Jun 2017 19:17:30 +0200 Subject: [PATCH 03/30] Bug#26171638 MYSQL 5.5.57 - MSI COMMUNITY PACKAGES NOT GETTING INSTALLED Temporary revert of the VS2008 redist check. --- packaging/WiX/create_msi.cmake.in | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in index b306c0c70d3..ae6a5773dce 100644 --- a/packaging/WiX/create_msi.cmake.in +++ b/packaging/WiX/create_msi.cmake.in @@ -218,37 +218,6 @@ MACRO(GENERATE_GUID VarName) OUTPUT_STRIP_TRAILING_WHITESPACE) ENDMACRO() -# Make sure that WIX identifier created from a path matches all the rules: -# - it is shorter than 72 characters -# - doesn't contain reserver characters ('+', '-' and '/') -# ID_SET contains a global list of all identifiers which are too long. -# Every time we use an identifier which is too long we use its index in -# ID_SET to shorten the name. -SET_PROPERTY(GLOBAL PROPERTY ID_SET) -MACRO(MAKE_WIX_IDENTIFIER str varname) - STRING(REPLACE "/" "." ${varname} "${str}") - STRING(REPLACE "+" "p" ${varname} "${str}") - STRING(REPLACE "-" "m" ${varname} "${str}") - STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}") - STRING(LENGTH "${${varname}}" len) - # FIXME: the prefix length has to be controlled better - # Identifier should be smaller than 72 character - # We have to cut down the length to 40 chars, since we add prefixes - # pretty often - IF(len GREATER 40) - STRING(SUBSTRING "${${varname}}" 0 37 shortstr) - GET_PROPERTY(LOCAL_LIST GLOBAL PROPERTY ID_SET) - LIST(FIND LOCAL_LIST "${${varname}}" STRING_ID) - IF(${STRING_ID} EQUAL -1) - LIST(APPEND LOCAL_LIST "${${varname}}") - SET_PROPERTY(GLOBAL PROPERTY ID_SET "${LOCAL_LIST}") - LIST(LENGTH LOCAL_LIST STRING_ID) - MATH(EXPR STRING_ID "${STRING_ID}-1" ) - ENDIF() - SET(${varname} "${shortstr}${STRING_ID}") - ENDIF() -ENDMACRO() - FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root) FILE(RELATIVE_PATH dir_rel ${topdir} ${dir}) IF(dir_rel) From b5258c7134398b7b0c7b915c2c6c22e8decba453 Mon Sep 17 00:00:00 2001 From: Piotr Obrzut Date: Mon, 5 Jun 2017 08:09:07 +0200 Subject: [PATCH 04/30] Bug#26171638 MYSQL 5.5.57 - MSI COMMUNITY PACKAGES NOT GETTING INSTALLED Corrected the revert. --- packaging/WiX/create_msi.cmake.in | 31 +++++++++++++++++++++++++++++++ packaging/WiX/mysql_server.wxs.in | 26 -------------------------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in index ae6a5773dce..b306c0c70d3 100644 --- a/packaging/WiX/create_msi.cmake.in +++ b/packaging/WiX/create_msi.cmake.in @@ -218,6 +218,37 @@ MACRO(GENERATE_GUID VarName) OUTPUT_STRIP_TRAILING_WHITESPACE) ENDMACRO() +# Make sure that WIX identifier created from a path matches all the rules: +# - it is shorter than 72 characters +# - doesn't contain reserver characters ('+', '-' and '/') +# ID_SET contains a global list of all identifiers which are too long. +# Every time we use an identifier which is too long we use its index in +# ID_SET to shorten the name. +SET_PROPERTY(GLOBAL PROPERTY ID_SET) +MACRO(MAKE_WIX_IDENTIFIER str varname) + STRING(REPLACE "/" "." ${varname} "${str}") + STRING(REPLACE "+" "p" ${varname} "${str}") + STRING(REPLACE "-" "m" ${varname} "${str}") + STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}") + STRING(LENGTH "${${varname}}" len) + # FIXME: the prefix length has to be controlled better + # Identifier should be smaller than 72 character + # We have to cut down the length to 40 chars, since we add prefixes + # pretty often + IF(len GREATER 40) + STRING(SUBSTRING "${${varname}}" 0 37 shortstr) + GET_PROPERTY(LOCAL_LIST GLOBAL PROPERTY ID_SET) + LIST(FIND LOCAL_LIST "${${varname}}" STRING_ID) + IF(${STRING_ID} EQUAL -1) + LIST(APPEND LOCAL_LIST "${${varname}}") + SET_PROPERTY(GLOBAL PROPERTY ID_SET "${LOCAL_LIST}") + LIST(LENGTH LOCAL_LIST STRING_ID) + MATH(EXPR STRING_ID "${STRING_ID}-1" ) + ENDIF() + SET(${varname} "${shortstr}${STRING_ID}") + ENDIF() +ENDMACRO() + FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root) FILE(RELATIVE_PATH dir_rel ${topdir} ${dir}) IF(dir_rel) diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in index 2092d0ebe3d..3eb81ec532c 100644 --- a/packaging/WiX/mysql_server.wxs.in +++ b/packaging/WiX/mysql_server.wxs.in @@ -61,32 +61,6 @@ - - - - - - - - Installed OR VS08REDISTX64 - - - - - - - Installed OR VS08REDISTX86 - - - From 790770c26438520d3dd139009ce51e3873d5fd9b Mon Sep 17 00:00:00 2001 From: Balasubramanian Kandasamy Date: Fri, 7 Jul 2017 17:43:40 +0530 Subject: [PATCH 05/30] Bug#26400146 - 5.5 AND 5.6 DOCKER PACKAGES MISSING MYSQLCHECK UPGRADE NOT POSSIBLE - Add mysqlcheck tool to docker rpms for upgrade --- packaging/rpm-docker/mysql.spec.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/rpm-docker/mysql.spec.in b/packaging/rpm-docker/mysql.spec.in index 497ae395577..cc4e7bc541e 100644 --- a/packaging/rpm-docker/mysql.spec.in +++ b/packaging/rpm-docker/mysql.spec.in @@ -178,7 +178,7 @@ for f in msql2mysql mysqlaccess mysqlaccess.conf mysqlbug mysql_convert_table_fo done for f in innochecksum myisamchk myisam_ftdump myisamlog myisampack \ - mysqlbinlog mysqlcheck mysql_client_test mysql_config_editor \ + mysqlbinlog mysql_client_test mysql_config_editor \ mysqld_multi mysqld_safe mysqldumpslow mysql_embedded mysqlimport \ mysql_plugin mysql_secure_installation mysqlshow mysqlslap mysqltest \ perror replace resolveip resolve_stack_dump; do @@ -232,6 +232,7 @@ rm -r $(readlink var) var %attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_bindir}/mysql %attr(755, root, root) %{_bindir}/mysqladmin +%attr(755, root, root) %{_bindir}/mysqlcheck %attr(755, root, root) %{_bindir}/mysqldump %attr(755, root, root) %{_bindir}/mysql_config %attr(755, root, root) %{_bindir}/mysql_install_db From 6a6d5bc98abdd25b32590fea7ef6572ecc355d7e Mon Sep 17 00:00:00 2001 From: Deepa Dixit Date: Tue, 25 Jul 2017 11:49:51 +0530 Subject: [PATCH 06/30] Bug#26161247: MTR: --NOREORDER IS SEARCHING FOR TEST SCRIPT ONLY IN MAIN SUITE Issue: ------ Running MTR with the --no-reorder option by specifying test cases on the command line, without prefixing the suite name results in an error saying the test case was not found in the main suite. This is because MTR looks for the test case only in the main suite, and no other suites. Fix: ---- The fix involves searching for the test in every suite if only the test name is specified. This back-ports two bug fixes: Bug#24967869 and Bug#24365783 Reviewed-by: Pavan Naik RB: 16812 --- mysql-test/lib/mtr_cases.pm | 66 ++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index e8d24eb399f..ce7d4e690c6 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -143,7 +143,13 @@ sub collect_test_cases ($$$$) { if ( @$opt_cases ) { - # A list of tests was specified on the command line + # A list of tests was specified on the command line. + # Among those, the tests which are not already collected will be + # collected and stored temporarily in an array of hashes pointed + # by the below reference. This array is eventually appeneded to + # the one having all collected test cases. + my $cmdline_cases; + # Check that the tests specified was found # in at least one suite foreach my $test_name_spec ( @$opt_cases ) @@ -162,20 +168,56 @@ sub collect_test_cases ($$$$) { } if ( not $found ) { - $sname= "main" if !$opt_reorder and !$sname; - mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname; - # If suite was part of name, find it there, may come with combinations - my @this_case = collect_one_suite($sname, [ $tname ]); - if (@this_case) + if ( $sname ) { - push (@$cases, @this_case); - } - else - { - mtr_error("Could not find '$tname' in '$sname' suite"); + # If suite was part of name, find it there, may come with combinations + my @this_case = collect_one_suite($sname, [ $tname ]); + + # If a test is specified multiple times on the command line, all + # instances of the test need to be picked. Hence, such tests are + # stored in the temporary array instead of adding them to $cases + # directly so that repeated tests are not run only once + if (@this_case) + { + push (@$cmdline_cases, @this_case); + } + else + { + mtr_error("Could not find '$tname' in '$sname' suite"); + } + } + else + { + if ( !$opt_reorder ) + { + # If --no-reorder is passed and if suite was not part of name, + # search in all the suites + foreach my $suite (split(",", $suites)) + { + my @this_case = collect_one_suite($suite, [ $tname ]); + if ( @this_case ) + { + push (@$cmdline_cases, @this_case); + $found= 1; + } + @this_case= collect_one_suite("i_".$suite, [ $tname ]); + if ( @this_case ) + { + push (@$cmdline_cases, @this_case); + $found= 1; + } + } + } + if ( !$found ) + { + mtr_error("Could not find '$tname' in '$suites' suite(s)"); + } } } } + # Add test cases collected in the temporary array to the one + # containing all previously collected test cases + push (@$cases, @$cmdline_cases) if $cmdline_cases; } if ( $opt_reorder && !$quick_collect) From d75f8a174218fd0ada64222d2a538f7aace897bc Mon Sep 17 00:00:00 2001 From: Venkatesh Duggirala Date: Wed, 23 Aug 2017 09:16:12 +0530 Subject: [PATCH 07/30] Bug#24763131 LOCAL-INFILE DEFAULT SHOULD BE DISABLED Problem & Analysis: Slave's Receiver thread, Applier thread and worker threads are created with LOCAL-INFILE option enabled. As the document says https://dev.mysql.com/doc/refman/5.7/en/load-data-local.html, there are some issues if a thread enables local infile. This flag should be enabled with care. But for the above mentioned internal threads, server is enabling it at the time of creation. Fix: Further analysis on the code shows that none of threads really need this flag to be enabled at any time as Slave never executes "LOAD DATA LOCAL INFILE" after reading it from Relay log. Applier thread removes "LOCAL" before start executing the query. --- sql/slave.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/slave.cc b/sql/slave.cc index 1e641ac6d7e..e533bc09b3d 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2109,7 +2109,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) thd->slave_thread = 1; thd->enable_slow_log= opt_log_slow_slave_statements; set_slave_thread_options(thd); - thd->client_capabilities = CLIENT_LOCAL_FILES; mysql_mutex_lock(&LOCK_thread_count); thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; mysql_mutex_unlock(&LOCK_thread_count); From ebd96c314953f5c0073ff5846484fd5e438fe0ad Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 15 Aug 2017 13:15:19 +0200 Subject: [PATCH 08/30] Bug#19875294 ASSERTION `SRC' FAILED IN MY_STRNXFRM_UNICODE (SIG 6 -STRINGS/CTYPE-UTF8.C:5151) Backport from 5.7 to 5.5 Field_set::val_str() should return String("", 0, cs) rather than String(NULL, 0, cs) --- mysql-test/r/case.result | 16 ++++++++++++++++ mysql-test/t/case.test | 12 ++++++++++++ sql/field.cc | 12 ++++++------ 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 40d900a0389..be712114a29 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -220,3 +220,19 @@ a d 3 11120436154190595086 drop table t1, t2; End of 5.0 tests +# +# Bug#19875294 ASSERTION `SRC' FAILED IN MY_STRNXFRM_UNICODE +# (SIG 6 -STRINGS/CTYPE-UTF8.C:5151) +# +set @@sql_mode=''; +CREATE TABLE t1(c1 SET('','')CHARACTER SET ucs2) engine=innodb; +Warnings: +Note 1291 Column 'c1' has duplicated value '' in SET +INSERT INTO t1 VALUES(990101.102); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +SELECT COALESCE(c1)FROM t1 ORDER BY 1; +COALESCE(c1) + +DROP TABLE t1; +set @@sql_mode=default; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index e1c807fe32b..c2d8f44e953 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -173,3 +173,15 @@ select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1 drop table t1, t2; --echo End of 5.0 tests + +--echo # +--echo # Bug#19875294 ASSERTION `SRC' FAILED IN MY_STRNXFRM_UNICODE +--echo # (SIG 6 -STRINGS/CTYPE-UTF8.C:5151) +--echo # + +set @@sql_mode=''; +CREATE TABLE t1(c1 SET('','')CHARACTER SET ucs2) engine=innodb; +INSERT INTO t1 VALUES(990101.102); +SELECT COALESCE(c1)FROM t1 ORDER BY 1; +DROP TABLE t1; +set @@sql_mode=default; diff --git a/sql/field.cc b/sql/field.cc index 15571afefb8..e98c17fabae 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. 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 @@ -8257,13 +8257,13 @@ String *Field_set::val_str(String *val_buffer, ulonglong tmp=(ulonglong) Field_enum::val_int(); uint bitnr=0; + /* + Some callers expect *val_buffer to contain the result, + so we assign to it, rather than doing 'return &empty_set_string. + */ + *val_buffer= empty_set_string; if (tmp == 0) { - /* - Some callers expect *val_buffer to contain the result, - so we assign to it, rather than doing 'return &empty_set_string. - */ - *val_buffer= empty_set_string; return val_buffer; } From be901b60ae59c93848c829d1b0b2cb523ab8692e Mon Sep 17 00:00:00 2001 From: Nisha Gopalakrishnan Date: Wed, 16 Aug 2017 13:58:25 +0530 Subject: [PATCH 09/30] Bug#26390632: CREATE TABLE CAN CAUSE MYSQL TO EXIT. Analysis ======== CREATE TABLE of InnoDB table with a partition name which exceeds the path limit can cause the server to exit. During the preparation of the partition name, there was no check to identify whether the complete path name for partition exceeds the max supported path length, causing the server to exit during subsequent processing. Fix === During the preparation of partition name, check and report an error if the partition path name exceeds the maximum path name limit. This is a 5.5 patch. --- sql/ha_partition.cc | 150 +++++++++++++++++++++++--------------- sql/sql_partition.cc | 169 +++++++++++++++++++++++++++---------------- sql/sql_partition.h | 6 +- 3 files changed, 200 insertions(+), 125 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index aadac36e2ee..414f9d52536 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. 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 @@ -624,7 +624,7 @@ int ha_partition::create(const char *name, TABLE *table_arg, int ha_partition::drop_partitions(const char *path) { List_iterator part_it(m_part_info->partitions); - char part_name_buff[FN_REFLEN]; + char part_name_buff[FN_REFLEN + 1]; uint num_parts= m_part_info->partitions.elements; uint num_subparts= m_part_info->num_subparts; uint i= 0; @@ -657,9 +657,12 @@ int ha_partition::drop_partitions(const char *path) { partition_element *sub_elem= sub_it++; part= i * num_subparts + j; - create_subpartition_name(part_name_buff, path, - part_elem->partition_name, - sub_elem->partition_name, name_variant); + if ((ret_error= create_subpartition_name(part_name_buff, path, + part_elem->partition_name, + sub_elem->partition_name, + name_variant))) + error= ret_error; + file= m_file[part]; DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff)); if ((ret_error= file->ha_delete_table(part_name_buff))) @@ -670,9 +673,11 @@ int ha_partition::drop_partitions(const char *path) } else { - create_partition_name(part_name_buff, path, - part_elem->partition_name, name_variant, - TRUE); + if ((ret_error= create_partition_name(part_name_buff, path, + part_elem->partition_name, + name_variant, TRUE))) + error= ret_error; + file= m_file[i]; DBUG_PRINT("info", ("Drop partition %s", part_name_buff)); if ((ret_error= file->ha_delete_table(part_name_buff))) @@ -714,8 +719,8 @@ int ha_partition::rename_partitions(const char *path) { List_iterator part_it(m_part_info->partitions); List_iterator temp_it(m_part_info->temp_partitions); - char part_name_buff[FN_REFLEN]; - char norm_name_buff[FN_REFLEN]; + char part_name_buff[FN_REFLEN + 1]; + char norm_name_buff[FN_REFLEN + 1]; uint num_parts= m_part_info->partitions.elements; uint part_count= 0; uint num_subparts= m_part_info->num_subparts; @@ -757,10 +762,11 @@ int ha_partition::rename_partitions(const char *path) { sub_elem= sub_it++; file= m_reorged_file[part_count++]; - create_subpartition_name(norm_name_buff, path, - part_elem->partition_name, - sub_elem->partition_name, - NORMAL_PART_NAME); + if ((ret_error= create_subpartition_name(norm_name_buff, path, + part_elem->partition_name, + sub_elem->partition_name, + NORMAL_PART_NAME))) + error= ret_error; DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff)); if ((ret_error= file->ha_delete_table(norm_name_buff))) error= ret_error; @@ -773,9 +779,11 @@ int ha_partition::rename_partitions(const char *path) else { file= m_reorged_file[part_count++]; - create_partition_name(norm_name_buff, path, - part_elem->partition_name, NORMAL_PART_NAME, - TRUE); + if ((ret_error= create_partition_name(norm_name_buff, path, + part_elem->partition_name, + NORMAL_PART_NAME, TRUE))) + error= ret_error; + DBUG_PRINT("info", ("Delete partition %s", norm_name_buff)); if ((ret_error= file->ha_delete_table(norm_name_buff))) error= ret_error; @@ -825,10 +833,12 @@ int ha_partition::rename_partitions(const char *path) { sub_elem= sub_it++; part= i * num_subparts + j; - create_subpartition_name(norm_name_buff, path, - part_elem->partition_name, - sub_elem->partition_name, - NORMAL_PART_NAME); + if ((ret_error= create_subpartition_name(norm_name_buff, path, + part_elem->partition_name, + sub_elem->partition_name, + NORMAL_PART_NAME))) + error= ret_error; + if (part_elem->part_state == PART_IS_CHANGED) { file= m_reorged_file[part_count++]; @@ -840,10 +850,12 @@ int ha_partition::rename_partitions(const char *path) (void) sync_ddl_log(); } file= m_new_file[part]; - create_subpartition_name(part_name_buff, path, - part_elem->partition_name, - sub_elem->partition_name, - TEMP_PART_NAME); + if ((ret_error= create_subpartition_name(part_name_buff, path, + part_elem->partition_name, + sub_elem->partition_name, + TEMP_PART_NAME))) + error= ret_error; + DBUG_PRINT("info", ("Rename subpartition from %s to %s", part_name_buff, norm_name_buff)); if ((ret_error= file->ha_rename_table(part_name_buff, @@ -857,9 +869,11 @@ int ha_partition::rename_partitions(const char *path) } else { - create_partition_name(norm_name_buff, path, - part_elem->partition_name, NORMAL_PART_NAME, - TRUE); + if ((ret_error= create_partition_name(norm_name_buff, path, + part_elem->partition_name, + NORMAL_PART_NAME, TRUE))) + error= ret_error; + if (part_elem->part_state == PART_IS_CHANGED) { file= m_reorged_file[part_count++]; @@ -871,9 +885,11 @@ int ha_partition::rename_partitions(const char *path) (void) sync_ddl_log(); } file= m_new_file[i]; - create_partition_name(part_name_buff, path, - part_elem->partition_name, TEMP_PART_NAME, - TRUE); + if ((ret_error= create_partition_name(part_name_buff, path, + part_elem->partition_name, + TEMP_PART_NAME, TRUE))) + error= ret_error; + DBUG_PRINT("info", ("Rename partition from %s to %s", part_name_buff, norm_name_buff)); if ((ret_error= file->ha_rename_table(part_name_buff, @@ -1477,7 +1493,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, { List_iterator part_it(m_part_info->partitions); List_iterator t_it(m_part_info->temp_partitions); - char part_name_buff[FN_REFLEN]; + char part_name_buff[FN_REFLEN + 1]; uint num_parts= m_part_info->partitions.elements; uint num_subparts= m_part_info->num_subparts; uint i= 0; @@ -1687,10 +1703,15 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, do { partition_element *sub_elem= sub_it++; - create_subpartition_name(part_name_buff, path, - part_elem->partition_name, - sub_elem->partition_name, - name_variant); + if ((error= create_subpartition_name(part_name_buff, path, + part_elem->partition_name, + sub_elem->partition_name, + name_variant))) + { + cleanup_new_partition(part_count); + DBUG_RETURN(error); + } + part= i * num_subparts + j; DBUG_PRINT("info", ("Add subpartition %s", part_name_buff)); if ((error= prepare_new_partition(table, create_info, @@ -1708,9 +1729,14 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info, } else { - create_partition_name(part_name_buff, path, - part_elem->partition_name, name_variant, - TRUE); + if ((error= create_partition_name(part_name_buff, path, + part_elem->partition_name, + name_variant, TRUE))) + { + cleanup_new_partition(part_count); + DBUG_RETURN(error); + } + DBUG_PRINT("info", ("Add partition %s", part_name_buff)); if ((error= prepare_new_partition(table, create_info, new_file_array[i], @@ -1967,8 +1993,8 @@ int ha_partition::del_ren_cre_table(const char *from, { int save_error= 0; int error= HA_ERR_INTERNAL_ERROR; - char from_buff[FN_REFLEN], to_buff[FN_REFLEN], from_lc_buff[FN_REFLEN], - to_lc_buff[FN_REFLEN], buff[FN_REFLEN]; + char from_buff[FN_REFLEN + 1], to_buff[FN_REFLEN + 1], from_lc_buff[FN_REFLEN + 1], + to_lc_buff[FN_REFLEN + 1], buff[FN_REFLEN + 1]; char *name_buffer_ptr; const char *from_path; const char *to_path= NULL; @@ -2015,13 +2041,16 @@ int ha_partition::del_ren_cre_table(const char *from, i= 0; do { - create_partition_name(from_buff, from_path, name_buffer_ptr, - NORMAL_PART_NAME, FALSE); + if ((error= create_partition_name(from_buff, from_path, name_buffer_ptr, + NORMAL_PART_NAME, FALSE))) + DBUG_RETURN(error); if (to != NULL) { // Rename branch - create_partition_name(to_buff, to_path, name_buffer_ptr, - NORMAL_PART_NAME, FALSE); + if ((error= create_partition_name(to_buff, to_path, name_buffer_ptr, + NORMAL_PART_NAME, FALSE))) + DBUG_RETURN(error); + error= (*file)->ha_rename_table(from_buff, to_buff); if (error) goto rename_error; @@ -2066,9 +2095,9 @@ create_error: name_buffer_ptr= m_name_buffer_ptr; for (abort_file= file, file= m_file; file < abort_file; file++) { - create_partition_name(from_buff, from_path, name_buffer_ptr, NORMAL_PART_NAME, - FALSE); - (void) (*file)->ha_delete_table((const char*) from_buff); + if (!create_partition_name(from_buff, from_path, name_buffer_ptr, NORMAL_PART_NAME, + FALSE)) + (void) (*file)->ha_delete_table((const char*) from_buff); name_buffer_ptr= strend(name_buffer_ptr) + 1; } DBUG_RETURN(error); @@ -2077,12 +2106,12 @@ rename_error: for (abort_file= file, file= m_file; file < abort_file; file++) { /* Revert the rename, back from 'to' to the original 'from' */ - create_partition_name(from_buff, from_path, name_buffer_ptr, - NORMAL_PART_NAME, FALSE); - create_partition_name(to_buff, to_path, name_buffer_ptr, - NORMAL_PART_NAME, FALSE); - /* Ignore error here */ - (void) (*file)->ha_rename_table(to_buff, from_buff); + if (!create_partition_name(from_buff, from_path, name_buffer_ptr, + NORMAL_PART_NAME, FALSE)) + if (!create_partition_name(to_buff, to_path, name_buffer_ptr, + NORMAL_PART_NAME, FALSE)) + /* Ignore error here */ + (void) (*file)->ha_rename_table(to_buff, from_buff); name_buffer_ptr= strend(name_buffer_ptr) + 1; } DBUG_RETURN(error); @@ -2707,7 +2736,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) char *name_buffer_ptr; int error= HA_ERR_INITIALIZATION; handler **file; - char name_buff[FN_REFLEN]; + char name_buff[FN_REFLEN + 1]; bool is_not_tmp_table= (table_share->tmp_table == NO_TMP_TABLE); ulonglong check_table_flags; DBUG_ENTER("ha_partition::open"); @@ -2777,8 +2806,10 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) file= m_is_clone_of->m_file; for (i= 0; i < m_tot_parts; i++) { - create_partition_name(name_buff, name, name_buffer_ptr, NORMAL_PART_NAME, - FALSE); + if ((error= create_partition_name(name_buff, name, name_buffer_ptr, + NORMAL_PART_NAME, FALSE))) + goto err_handler; + if (!(m_file[i]= file[i]->clone(name_buff, m_clone_mem_root))) { error= HA_ERR_INITIALIZATION; @@ -2793,8 +2824,9 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) file= m_file; do { - create_partition_name(name_buff, name, name_buffer_ptr, NORMAL_PART_NAME, - FALSE); + if ((error= create_partition_name(name_buff, name, name_buffer_ptr, + NORMAL_PART_NAME, FALSE))) + goto err_handler; if ((error= (*file)->ha_open(table, name_buff, mode, test_if_locked))) goto err_handler; m_num_locks+= (*file)->lock_count(); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 5358535e9f9..65d4da0f2f6 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. 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 @@ -5958,8 +5958,8 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, DDL_LOG_ENTRY ddl_log_entry; partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; - char tmp_path[FN_REFLEN]; - char normal_path[FN_REFLEN]; + char tmp_path[FN_REFLEN + 1]; + char normal_path[FN_REFLEN + 1]; List_iterator part_it(part_info->partitions); uint temp_partitions= part_info->temp_partitions.elements; uint num_elements= part_info->partitions.elements; @@ -5983,14 +5983,18 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ddl_log_entry.next_entry= *next_entry; ddl_log_entry.handler_name= ha_resolve_storage_engine_name(sub_elem->engine_type); - create_subpartition_name(tmp_path, path, - part_elem->partition_name, - sub_elem->partition_name, - TEMP_PART_NAME); - create_subpartition_name(normal_path, path, - part_elem->partition_name, - sub_elem->partition_name, - NORMAL_PART_NAME); + if (create_subpartition_name(tmp_path, path, + part_elem->partition_name, + sub_elem->partition_name, + TEMP_PART_NAME)) + DBUG_RETURN(TRUE); + + if (create_subpartition_name(normal_path, path, + part_elem->partition_name, + sub_elem->partition_name, + NORMAL_PART_NAME)) + DBUG_RETURN(TRUE); + ddl_log_entry.name= normal_path; ddl_log_entry.from_name= tmp_path; if (part_elem->part_state == PART_IS_CHANGED) @@ -6011,12 +6015,13 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ddl_log_entry.next_entry= *next_entry; ddl_log_entry.handler_name= ha_resolve_storage_engine_name(part_elem->engine_type); - create_partition_name(tmp_path, path, - part_elem->partition_name, - TEMP_PART_NAME, TRUE); - create_partition_name(normal_path, path, - part_elem->partition_name, - NORMAL_PART_NAME, TRUE); + if ((create_partition_name(tmp_path, path, part_elem->partition_name, + TEMP_PART_NAME, TRUE)) || + (create_partition_name(normal_path, path, + part_elem->partition_name, + NORMAL_PART_NAME, TRUE))) + DBUG_RETURN(TRUE); + ddl_log_entry.name= normal_path; ddl_log_entry.from_name= tmp_path; if (part_elem->part_state == PART_IS_CHANGED) @@ -6055,7 +6060,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, DDL_LOG_ENTRY ddl_log_entry; partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; - char tmp_path[FN_LEN]; + char tmp_path[FN_REFLEN + 1]; List_iterator part_it(part_info->partitions); List_iterator temp_it(part_info->temp_partitions); uint num_temp_partitions= part_info->temp_partitions.elements; @@ -6094,10 +6099,12 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ddl_log_entry.next_entry= *next_entry; ddl_log_entry.handler_name= ha_resolve_storage_engine_name(sub_elem->engine_type); - create_subpartition_name(tmp_path, path, - part_elem->partition_name, - sub_elem->partition_name, - name_variant); + if (create_subpartition_name(tmp_path, path, + part_elem->partition_name, + sub_elem->partition_name, + name_variant)) + DBUG_RETURN(TRUE); + ddl_log_entry.name= tmp_path; if (write_ddl_log_entry(&ddl_log_entry, &log_entry)) { @@ -6113,9 +6120,10 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, ddl_log_entry.next_entry= *next_entry; ddl_log_entry.handler_name= ha_resolve_storage_engine_name(part_elem->engine_type); - create_partition_name(tmp_path, path, - part_elem->partition_name, - name_variant, TRUE); + if ((create_partition_name(tmp_path, path, part_elem->partition_name, + name_variant, TRUE))) + DBUG_RETURN(TRUE); + ddl_log_entry.name= tmp_path; if (write_ddl_log_entry(&ddl_log_entry, &log_entry)) { @@ -8194,29 +8202,28 @@ static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR *part_iter) } -/* - Create partition names +/** + Create partition names. This method is used to calculate the + partition name, service routine to the del_ren_cre_table method. + The output buffer size should be FN_REFLEN + 1(terminating '\0'). - SYNOPSIS - create_partition_name() - out:out Created partition name string - in1 First part - in2 Second part - name_variant Normal, temporary or renamed partition name + @param [out] out Created partition name string + @param in1 First part + @param in2 Second part + @param in3 Third part + @param name_variant Normal, temporary or renamed partition name + @param translate Flag to determine whether to convert a table name + to it its corresponding filename. - RETURN VALUE - NONE - - DESCRIPTION - This method is used to calculate the partition name, service routine to - the del_ren_cre_table method. + @retval true Error. + @retval false Success. */ -void create_partition_name(char *out, const char *in1, +bool create_partition_name(char *out, const char *in1, const char *in2, uint name_variant, bool translate) { - char transl_part_name[FN_REFLEN]; + char transl_part_name[FN_REFLEN + 1]; const char *transl_part; if (translate) @@ -8226,35 +8233,50 @@ void create_partition_name(char *out, const char *in1, } else transl_part= in2; + + // Check if the path name for partition exceeds maximum path length. if (name_variant == NORMAL_PART_NAME) - strxmov(out, in1, "#P#", transl_part, NullS); + { + if ((strlen(in1) + strlen(transl_part) + 3) > FN_REFLEN) + { + my_error(ER_PATH_LENGTH, MYF(0), in2); + return true; + } + } + else + if ((strlen(in1) + strlen(transl_part) + 8) > FN_REFLEN) + { + my_error(ER_PATH_LENGTH, MYF(0), in2); + return true; + } + + if (name_variant == NORMAL_PART_NAME) + strxnmov(out, FN_REFLEN, in1, "#P#", transl_part, NullS); else if (name_variant == TEMP_PART_NAME) - strxmov(out, in1, "#P#", transl_part, "#TMP#", NullS); + strxnmov(out, FN_REFLEN, in1, "#P#", transl_part, "#TMP#", NullS); else if (name_variant == RENAMED_PART_NAME) - strxmov(out, in1, "#P#", transl_part, "#REN#", NullS); + strxnmov(out, FN_REFLEN, in1, "#P#", transl_part, "#REN#", NullS); + + return false; } -/* - Create subpartition name +/** + Create subpartition name. This method is used to calculate the + subpartition name, service routine to the del_ren_cre_table method. + The output buffer size should be FN_REFLEN + 1(terminating '\0'). - SYNOPSIS - create_subpartition_name() - out:out Created partition name string - in1 First part - in2 Second part - in3 Third part - name_variant Normal, temporary or renamed partition name + @param [out] out Created partition name string + @param in1 First part + @param in2 Second part + @param in3 Third part + @param name_variant Normal, temporary or renamed partition name - RETURN VALUE - NONE - - DESCRIPTION - This method is used to calculate the subpartition name, service routine to - the del_ren_cre_table method. + @retval true Error. + @retval false Success. */ -void create_subpartition_name(char *out, const char *in1, +bool create_subpartition_name(char *out, const char *in1, const char *in2, const char *in3, uint name_variant) { @@ -8262,15 +8284,36 @@ void create_subpartition_name(char *out, const char *in1, tablename_to_filename(in2, transl_part_name, FN_REFLEN); tablename_to_filename(in3, transl_subpart_name, FN_REFLEN); + + // Check if the path name for subpartition exceeds maximum path length. if (name_variant == NORMAL_PART_NAME) - strxmov(out, in1, "#P#", transl_part_name, + { + if ((strlen(in1) + strlen(transl_part_name) + + strlen(transl_subpart_name) + 7) > FN_REFLEN) + { + my_error(ER_PATH_LENGTH, MYF(0), in3); + return true; + } + } + else + if ((strlen(in1) + strlen(transl_part_name) + + strlen(transl_subpart_name) + 12) > FN_REFLEN) + { + my_error(ER_PATH_LENGTH, MYF(0), in3); + return true; + } + + if (name_variant == NORMAL_PART_NAME) + strxnmov(out, FN_REFLEN, in1, "#P#", transl_part_name, "#SP#", transl_subpart_name, NullS); else if (name_variant == TEMP_PART_NAME) - strxmov(out, in1, "#P#", transl_part_name, + strxnmov(out, FN_REFLEN, in1, "#P#", transl_part_name, "#SP#", transl_subpart_name, "#TMP#", NullS); else if (name_variant == RENAMED_PART_NAME) - strxmov(out, in1, "#P#", transl_part_name, + strxnmov(out, FN_REFLEN, in1, "#P#", transl_part_name, "#SP#", transl_subpart_name, "#REN#", NullS); + + return false; } uint get_partition_field_store_length(Field *field) diff --git a/sql/sql_partition.h b/sql/sql_partition.h index f232eaa0629..cfaab903f04 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -1,7 +1,7 @@ #ifndef SQL_PARTITION_INCLUDED #define SQL_PARTITION_INCLUDED -/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. 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 @@ -272,10 +272,10 @@ char *generate_partition_syntax(partition_info *part_info, const char *current_comment_start); #endif -void create_partition_name(char *out, const char *in1, +bool create_partition_name(char *out, const char *in1, const char *in2, uint name_variant, bool translate); -void create_subpartition_name(char *out, const char *in1, +bool create_subpartition_name(char *out, const char *in1, const char *in2, const char *in3, uint name_variant); From f2f6025a445d9a799ccce27bc9124c3a63c28764 Mon Sep 17 00:00:00 2001 From: Arun Kuruvila Date: Thu, 24 Aug 2017 14:19:38 +0530 Subject: [PATCH 10/30] Bug#26482173: TLS CIPHER NEGOTIATION INCORRECTLY MATCHES ON LAST BYTE ONLY (YASSL) Description:- TLS cipher negociation happens incorrectly leading to the use of a different Analysis:- YaSSL based MySQL server will compare only the last byte of each cipher sent in the Client Hello message. This can cause TLS connections to fail, due to the server picking a cipher which the client doesn't actually support. Fix:- A fix for detecting cipher suites with non leading zeros is included as YaSSL only supports cipher suites with leading zeros. --- extra/yassl/README | 8 ++ extra/yassl/certs/ca-cert.pem | 96 ++++++++++++------------ extra/yassl/certs/client-cert.pem | 99 ++++++++++++------------ extra/yassl/certs/server-cert.pem | 120 +++++++++++++++--------------- extra/yassl/include/openssl/ssl.h | 4 +- extra/yassl/src/yassl_imp.cpp | 6 +- extra/yassl/src/yassl_int.cpp | 13 +++- 7 files changed, 182 insertions(+), 164 deletions(-) diff --git a/extra/yassl/README b/extra/yassl/README index a3d4f60f561..de1bf5132aa 100644 --- a/extra/yassl/README +++ b/extra/yassl/README @@ -12,6 +12,14 @@ before calling SSL_new(); *** end Note *** +yaSSL Release notes, version 2.4.4 (8/8/2017) + This release of yaSSL fixes an interop issue. A fix for detecting cipher + suites with non leading zeros is included as yaSSL only supports cipher + suites with leading zeros. Thanks for the report from Security Innovation + and Oracle. + + Users interoping with other SSL stacks should update. + yaSSL Release notes, version 2.4.2 (9/22/2016) This release of yaSSL fixes a medium security vulnerability. A fix for potential AES side channel leaks is included that a local user monitoring diff --git a/extra/yassl/certs/ca-cert.pem b/extra/yassl/certs/ca-cert.pem index 7e64eb47961..8b34ea43dd2 100644 --- a/extra/yassl/certs/ca-cert.pem +++ b/extra/yassl/certs/ca-cert.pem @@ -1,40 +1,13 @@ ------BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIJAJpBR82hFGKMMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD -VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G -A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 -dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe -Fw0xNDA3MTEwMzIwMDhaFw0xNzA0MDYwMzIwMDhaMIGUMQswCQYDVQQGEwJVUzEQ -MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3 -dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns -LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAL8Myi0Ush6EQlvNOB9K8k11EPG2NZ/fyn0D -mNOs3gNm7irx2LB9bgdUCxCYIU2AyxIg58xP3kV9yXJ3MurKkLtpUhADL6jzlcXx -i2JWG+9nb6QQQZWtCpvjpcCw0nB2UDBbqOgILHztp6J6jTgpHKzH7fJ8lbCVgn1J -XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc -/hr8fat6Nj+Y3oR8BWfOahQ4h6nxjLVoy2h/cSAr9aBj9VYvoybSt2+xWhfXOJkI -/pNYb/7DE0kIFgunTWcAUjFnI06Y7VFFHbkE2Qvs2CizS73tNnkCAwEAAaOB/DCB -+TAdBgNVHQ4EFgQUJ45nEXTDJh0/7TNjs6TYHTDl6NUwgckGA1UdIwSBwTCBvoAU -J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290 -aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t -MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYD -VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAeXgMbXmIkfw6FZz5J2IW8CEf -+n0/oqgyHvfyEal0FnRe3BjK8AAq1QMGJjDxR4P9Mm787apPfQxjYDEvfAy/mWaH -7ScIhi3EM+iYIxz+o9uaSU78WkLvccM/rdxKqNKjHQmsMwR7hvNtAFmjyNvRPHP2 -DpDWXkngvzZjCHulsI81O1aMETVJBBzQ57pWxQ0KkY3Wt2IZNBJSTNJtfMU9DxiB -VMv2POWE0tZxFewaNAvwoCF0Q8ijsN/ZZ9rirZNI+KCHvXkU4GIK3/cxLjF70TIq -Cv5dFO/ZZFDkg5G8cA3XiI3ZvIQOxRqzv2QCTlGRpKKFFYOv8FubKElfsrMD2A== ------END CERTIFICATE----- Certificate: Data: Version: 3 (0x2) Serial Number: - 9a:41:47:cd:a1:14:62:8c - Signature Algorithm: sha1WithRSAEncryption + b7:b6:90:33:66:1b:6b:23 + Signature Algorithm: sha256WithRSAEncryption Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Jul 11 03:20:08 2014 GMT - Not After : Apr 6 03:20:08 2017 GMT + Not Before: Aug 11 20:07:37 2016 GMT + Not After : May 8 20:07:37 2019 GMT Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption @@ -65,23 +38,50 @@ Certificate: X509v3 Authority Key Identifier: keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com - serial:9A:41:47:CD:A1:14:62:8C + serial:B7:B6:90:33:66:1B:6B:23 X509v3 Basic Constraints: CA:TRUE - Signature Algorithm: sha1WithRSAEncryption - 79:78:0c:6d:79:88:91:fc:3a:15:9c:f9:27:62:16:f0:21:1f: - fa:7d:3f:a2:a8:32:1e:f7:f2:11:a9:74:16:74:5e:dc:18:ca: - f0:00:2a:d5:03:06:26:30:f1:47:83:fd:32:6e:fc:ed:aa:4f: - 7d:0c:63:60:31:2f:7c:0c:bf:99:66:87:ed:27:08:86:2d:c4: - 33:e8:98:23:1c:fe:a3:db:9a:49:4e:fc:5a:42:ef:71:c3:3f: - ad:dc:4a:a8:d2:a3:1d:09:ac:33:04:7b:86:f3:6d:00:59:a3: - c8:db:d1:3c:73:f6:0e:90:d6:5e:49:e0:bf:36:63:08:7b:a5: - b0:8f:35:3b:56:8c:11:35:49:04:1c:d0:e7:ba:56:c5:0d:0a: - 91:8d:d6:b7:62:19:34:12:52:4c:d2:6d:7c:c5:3d:0f:18:81: - 54:cb:f6:3c:e5:84:d2:d6:71:15:ec:1a:34:0b:f0:a0:21:74: - 43:c8:a3:b0:df:d9:67:da:e2:ad:93:48:f8:a0:87:bd:79:14: - e0:62:0a:df:f7:31:2e:31:7b:d1:32:2a:0a:fe:5d:14:ef:d9: - 64:50:e4:83:91:bc:70:0d:d7:88:8d:d9:bc:84:0e:c5:1a:b3: - bf:64:02:4e:51:91:a4:a2:85:15:83:af:f0:5b:9b:28:49:5f: - b2:b3:03:d8 + Signature Algorithm: sha256WithRSAEncryption + 0e:93:48:44:4a:72:96:60:71:25:82:a9:2c:ca:60:5b:f2:88: + 3e:cf:11:74:5a:11:4a:dc:d9:d8:f6:58:2c:05:d3:56:d9:e9: + 8f:37:ef:8e:3e:3b:ff:22:36:00:ca:d8:e2:96:3f:a7:d1:ed: + 1f:de:7a:b0:d7:8f:36:bd:41:55:1e:d4:b9:86:3b:87:25:69: + 35:60:48:d6:e4:5a:94:ce:a2:fa:70:38:36:c4:85:b4:4b:23: + fe:71:9e:2f:db:06:c7:b5:9c:21:f0:3e:7c:eb:91:f8:5c:09: + fd:84:43:a4:b3:4e:04:0c:22:31:71:6a:48:c8:ab:bb:e8:ce: + fa:67:15:1a:3a:82:98:43:33:b5:0e:1f:1e:89:f8:37:de:1b: + e6:b5:a0:f4:a2:8b:b7:1c:90:ba:98:6d:94:21:08:80:5d:f3: + bf:66:ad:c9:72:28:7a:6a:48:ee:cf:63:69:31:8c:c5:8e:66: + da:4b:78:65:e8:03:3a:4b:f8:cc:42:54:d3:52:5c:2d:04:ae: + 26:87:e1:7e:40:cb:45:41:16:4b:6e:a3:2e:4a:76:bd:29:7f: + 1c:53:37:06:ad:e9:5b:6a:d6:b7:4e:94:a2:7c:e8:ac:4e:a6: + 50:3e:2b:32:9e:68:42:1b:e4:59:67:61:ea:c7:9a:51:9c:1c: + 55:a3:77:76 +-----BEGIN CERTIFICATE----- +MIIEqjCCA5KgAwIBAgIJALe2kDNmG2sjMA0GCSqGSIb3DQEBCwUAMIGUMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G +A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 +dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe +Fw0xNjA4MTEyMDA3MzdaFw0xOTA1MDgyMDA3MzdaMIGUMQswCQYDVQQGEwJVUzEQ +MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3 +dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns +LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAL8Myi0Ush6EQlvNOB9K8k11EPG2NZ/fyn0D +mNOs3gNm7irx2LB9bgdUCxCYIU2AyxIg58xP3kV9yXJ3MurKkLtpUhADL6jzlcXx +i2JWG+9nb6QQQZWtCpvjpcCw0nB2UDBbqOgILHztp6J6jTgpHKzH7fJ8lbCVgn1J +XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc +/hr8fat6Nj+Y3oR8BWfOahQ4h6nxjLVoy2h/cSAr9aBj9VYvoybSt2+xWhfXOJkI +/pNYb/7DE0kIFgunTWcAUjFnI06Y7VFFHbkE2Qvs2CizS73tNnkCAwEAAaOB/DCB ++TAdBgNVHQ4EFgQUJ45nEXTDJh0/7TNjs6TYHTDl6NUwgckGA1UdIwSBwTCBvoAU +J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290 +aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAt7aQM2YbayMwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEADpNIREpylmBxJYKpLMpgW/KI +Ps8RdFoRStzZ2PZYLAXTVtnpjzfvjj47/yI2AMrY4pY/p9HtH956sNePNr1BVR7U +uYY7hyVpNWBI1uRalM6i+nA4NsSFtEsj/nGeL9sGx7WcIfA+fOuR+FwJ/YRDpLNO +BAwiMXFqSMiru+jO+mcVGjqCmEMztQ4fHon4N94b5rWg9KKLtxyQuphtlCEIgF3z +v2atyXIoempI7s9jaTGMxY5m2kt4ZegDOkv4zEJU01JcLQSuJofhfkDLRUEWS26j +Lkp2vSl/HFM3Bq3pW2rWt06UonzorE6mUD4rMp5oQhvkWWdh6seaUZwcVaN3dg== +-----END CERTIFICATE----- diff --git a/extra/yassl/certs/client-cert.pem b/extra/yassl/certs/client-cert.pem index 38330d5380e..9262ad60991 100644 --- a/extra/yassl/certs/client-cert.pem +++ b/extra/yassl/certs/client-cert.pem @@ -2,13 +2,13 @@ Certificate: Data: Version: 3 (0x2) Serial Number: - b6:63:af:8f:5d:62:57:a0 - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Programming, CN=www.wolfssl.com/emailAddress=info@wolfssl.com + b9:bc:90:ed:ad:aa:0a:8c + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=wolfSSL_2048, OU=Programming-2048, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Jul 11 17:39:44 2014 GMT - Not After : Apr 6 17:39:44 2017 GMT - Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Programming, CN=www.wolfssl.com/emailAddress=info@wolfssl.com + Not Before: Aug 11 20:07:37 2016 GMT + Not After : May 8 20:07:37 2019 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL_2048, OU=Programming-2048, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (2048 bit) @@ -37,51 +37,52 @@ Certificate: 33:D8:45:66:D7:68:87:18:7E:54:0D:70:27:91:C7:26:D7:85:65:C0 X509v3 Authority Key Identifier: keyid:33:D8:45:66:D7:68:87:18:7E:54:0D:70:27:91:C7:26:D7:85:65:C0 - DirName:/C=US/ST=Montana/L=Bozeman/O=wolfSSL/OU=Programming/CN=www.wolfssl.com/emailAddress=info@wolfssl.com - serial:B6:63:AF:8F:5D:62:57:A0 + DirName:/C=US/ST=Montana/L=Bozeman/O=wolfSSL_2048/OU=Programming-2048/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:B9:BC:90:ED:AD:AA:0A:8C X509v3 Basic Constraints: CA:TRUE - Signature Algorithm: sha1WithRSAEncryption - 85:10:90:c5:5d:de:25:8c:f2:57:7b:2d:14:1c:05:f9:71:63: - 40:b0:e3:c1:c1:2e:13:2a:7a:b7:d6:24:58:87:eb:03:fb:0d: - af:e0:f4:d0:c8:bc:51:36:10:4f:79:cc:4f:66:7d:af:99:cb: - 7b:ce:68:94:c6:36:aa:42:6e:8c:78:5b:b2:85:ca:d1:e1:a8: - 31:d1:81:d9:f9:c1:a3:9e:34:43:ef:0a:79:7d:3e:83:61:fc: - 14:5c:d1:dd:bc:0e:d7:51:b7:71:6e:41:7e:8b:2c:5a:9a:cb: - 77:4b:6a:f5:06:ff:02:af:1e:e6:63:4f:bc:44:d9:3f:56:9e: - 09:9c:43:f9:55:21:32:46:82:09:86:a9:7b:74:1c:9e:5a:2a: - bf:03:79:91:cb:f2:29:7f:c9:15:82:89:b9:53:cd:7e:07:90: - a9:5d:76:e1:19:5e:0d:58:b8:59:d5:0d:df:23:ab:6b:63:76: - 19:9e:9c:df:b0:57:49:6c:d0:86:97:c3:6c:3c:fa:e0:56:c2: - 1b:e3:a1:42:1a:58:62:85:9d:74:19:83:08:af:59:90:f8:99: - bd:67:d3:4a:ea:0e:c9:ca:61:8a:0d:8a:42:cc:90:e9:2e:c2: - 54:73:7f:5e:af:8d:e2:32:cb:45:20:d6:19:4d:5b:77:31:cc: - 0f:2d:c0:7e + Signature Algorithm: sha256WithRSAEncryption + 33:85:08:b4:58:0e:a2:00:03:74:de:77:fb:d1:2b:76:9c:97: + 90:20:21:a2:e8:2e:22:50:26:04:76:ba:5b:47:79:e5:52:f7: + c4:0d:79:ff:62:3f:05:7c:c3:08:6c:e0:b7:81:d0:ce:c6:c9: + 46:b9:8e:4b:5f:56:79:4b:13:b6:d1:6b:66:4b:ce:00:0d:e3: + 76:5e:fb:cb:b5:5d:12:31:05:f1:bb:39:f6:86:90:ca:92:56: + a4:a0:75:21:b6:1d:4c:96:c3:45:eb:5a:91:94:32:d3:59:b8: + c9:73:1f:03:a9:81:63:e0:43:c0:1e:c8:65:be:3b:a7:53:c3: + 44:ff:b3:fb:47:84:a8:b6:9d:00:d5:6b:ae:87:f8:bb:35:b2: + 6c:66:0b:11:ee:6f:fe:12:ed:59:79:f1:3e:f2:d3:61:27:8b: + 95:7e:99:75:8d:a4:9f:34:85:f1:25:4d:48:1e:9b:6b:70:f6: + 66:cc:56:b1:a3:02:52:8a:7c:aa:af:07:da:97:c6:0c:a5:8f: + ed:cb:f5:d8:04:5d:97:0a:5d:5a:2b:49:f5:bd:93:e5:23:9b: + 99:b5:0c:ff:0c:7e:38:82:b2:6e:ab:8a:c9:a7:45:ab:d6:d7: + 93:35:70:07:7e:c8:3d:a5:fe:33:8f:d9:85:c0:c7:5a:02:e4: + 7c:d6:35:9e -----BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIJALZjr49dYlegMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD -VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEQMA4G -A1UECgwHd29sZlNTTDEUMBIGA1UECwwLUHJvZ3JhbW1pbmcxGDAWBgNVBAMMD3d3 -dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe -Fw0xNDA3MTExNzM5NDRaFw0xNzA0MDYxNzM5NDRaMIGUMQswCQYDVQQGEwJVUzEQ -MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEQMA4GA1UECgwHd29s -ZlNTTDEUMBIGA1UECwwLUHJvZ3JhbW1pbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns -LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAMMD0Sv+OaQyRTtTyIQrKnx0mr2qKlIHR9am -NrIHMo7Quml7xsNEntSBSP0taKKLZ7uhdcg2LErSG/eLus8N+e/s8YEee5sDR5q/ -Zcx/ZSRppugUiVvkNPfFsBST9Wd7Onp44QFWVpGmE0KN0jxAnEzv0YbfN1EbDKE7 -9fGjSjXk4c6W3xt+v06X0BDoqAgwga8gC0MUxXRntDKCb42GwohAmTaDuh5AciIX -11JlJHOwzu8Zza7/eGx7wBID1E5yDVBtO6M7o5lencjZDIWz2YrZVCbbbfqsu/8l -TMTRefRx04ZAGBOwY7VyTjDEl4SGLVYv1xX3f8Cu9fxb5fuhutMCAwEAAaOB/DCB -+TAdBgNVHQ4EFgQUM9hFZtdohxh+VA1wJ5HHJteFZcAwgckGA1UdIwSBwTCBvoAU -M9hFZtdohxh+VA1wJ5HHJteFZcChgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMRAwDgYDVQQKDAd3b2xmU1NM -MRQwEgYDVQQLDAtQcm9ncmFtbWluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t -MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAtmOvj11iV6AwDAYD -VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAhRCQxV3eJYzyV3stFBwF+XFj -QLDjwcEuEyp6t9YkWIfrA/sNr+D00Mi8UTYQT3nMT2Z9r5nLe85olMY2qkJujHhb -soXK0eGoMdGB2fnBo540Q+8KeX0+g2H8FFzR3bwO11G3cW5BfossWprLd0tq9Qb/ -Aq8e5mNPvETZP1aeCZxD+VUhMkaCCYape3QcnloqvwN5kcvyKX/JFYKJuVPNfgeQ -qV124RleDVi4WdUN3yOra2N2GZ6c37BXSWzQhpfDbDz64FbCG+OhQhpYYoWddBmD -CK9ZkPiZvWfTSuoOycphig2KQsyQ6S7CVHN/Xq+N4jLLRSDWGU1bdzHMDy3Afg== +MIIEyjCCA7KgAwIBAgIJALm8kO2tqgqMMA0GCSqGSIb3DQEBCwUAMIGeMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEVMBMG +A1UECgwMd29sZlNTTF8yMDQ4MRkwFwYDVQQLDBBQcm9ncmFtbWluZy0yMDQ4MRgw +FgYDVQQDDA93d3cud29sZnNzbC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29s +ZnNzbC5jb20wHhcNMTYwODExMjAwNzM3WhcNMTkwNTA4MjAwNzM3WjCBnjELMAkG +A1UEBhMCVVMxEDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xFTAT +BgNVBAoMDHdvbGZTU0xfMjA0ODEZMBcGA1UECwwQUHJvZ3JhbW1pbmctMjA0ODEY +MBYGA1UEAwwPd3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdv +bGZzc2wuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwwPRK/45 +pDJFO1PIhCsqfHSavaoqUgdH1qY2sgcyjtC6aXvGw0Se1IFI/S1oootnu6F1yDYs +StIb94u6zw357+zxgR57mwNHmr9lzH9lJGmm6BSJW+Q098WwFJP1Z3s6enjhAVZW +kaYTQo3SPECcTO/Rht83URsMoTv18aNKNeThzpbfG36/TpfQEOioCDCBryALQxTF +dGe0MoJvjYbCiECZNoO6HkByIhfXUmUkc7DO7xnNrv94bHvAEgPUTnINUG07ozuj +mV6dyNkMhbPZitlUJttt+qy7/yVMxNF59HHThkAYE7BjtXJOMMSXhIYtVi/XFfd/ +wK71/Fvl+6G60wIDAQABo4IBBzCCAQMwHQYDVR0OBBYEFDPYRWbXaIcYflQNcCeR +xybXhWXAMIHTBgNVHSMEgcswgciAFDPYRWbXaIcYflQNcCeRxybXhWXAoYGkpIGh +MIGeMQswCQYDVQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96 +ZW1hbjEVMBMGA1UECgwMd29sZlNTTF8yMDQ4MRkwFwYDVQQLDBBQcm9ncmFtbWlu +Zy0yMDQ4MRgwFgYDVQQDDA93d3cud29sZnNzbC5jb20xHzAdBgkqhkiG9w0BCQEW +EGluZm9Ad29sZnNzbC5jb22CCQC5vJDtraoKjDAMBgNVHRMEBTADAQH/MA0GCSqG +SIb3DQEBCwUAA4IBAQAzhQi0WA6iAAN03nf70St2nJeQICGi6C4iUCYEdrpbR3nl +UvfEDXn/Yj8FfMMIbOC3gdDOxslGuY5LX1Z5SxO20WtmS84ADeN2XvvLtV0SMQXx +uzn2hpDKklakoHUhth1MlsNF61qRlDLTWbjJcx8DqYFj4EPAHshlvjunU8NE/7P7 +R4Sotp0A1Wuuh/i7NbJsZgsR7m/+Eu1ZefE+8tNhJ4uVfpl1jaSfNIXxJU1IHptr +cPZmzFaxowJSinyqrwfal8YMpY/ty/XYBF2XCl1aK0n1vZPlI5uZtQz/DH44grJu +q4rJp0Wr1teTNXAHfsg9pf4zj9mFwMdaAuR81jWe -----END CERTIFICATE----- diff --git a/extra/yassl/certs/server-cert.pem b/extra/yassl/certs/server-cert.pem index f56cba9de70..5504c822fae 100644 --- a/extra/yassl/certs/server-cert.pem +++ b/extra/yassl/certs/server-cert.pem @@ -2,11 +2,11 @@ Certificate: Data: Version: 3 (0x2) Serial Number: 1 (0x1) - Signature Algorithm: sha1WithRSAEncryption + Signature Algorithm: sha256WithRSAEncryption Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Jul 11 17:20:14 2014 GMT - Not After : Apr 6 17:20:14 2017 GMT + Not Before: Aug 11 20:07:37 2016 GMT + Not After : May 8 20:07:37 2019 GMT Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Support, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption @@ -37,32 +37,32 @@ Certificate: X509v3 Authority Key Identifier: keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com - serial:9A:41:47:CD:A1:14:62:8C + serial:B7:B6:90:33:66:1B:6B:23 X509v3 Basic Constraints: CA:TRUE - Signature Algorithm: sha1WithRSAEncryption - 3d:8c:70:05:5b:62:4b:bf:6c:b6:48:61:01:10:1d:5e:05:ba: - 55:94:2c:ae:59:6f:97:80:5d:6c:86:ec:9a:eb:15:45:44:e4: - 56:f8:75:ca:8a:45:32:f4:c7:e1:fa:f2:98:1c:91:d3:3f:e8: - 0e:c9:1b:fa:e1:79:99:67:0e:0d:6b:8a:ec:1a:2c:59:c4:34: - 04:8d:39:77:cd:b5:e9:60:5b:82:bf:34:ce:ed:c6:4f:3f:b4: - 5c:4d:8a:b4:f4:0a:04:12:a0:56:c1:e1:33:37:a1:54:87:48: - e9:81:c2:0f:8f:6f:d3:52:4c:4c:32:4c:6b:9f:3a:04:8f:77: - 5d:ad:dc:3d:2b:f2:c9:df:3c:60:5d:d8:fc:86:72:7c:3d:d0: - 84:4b:8c:df:26:43:fe:c0:cc:5b:e1:36:b3:3d:32:28:a3:ef: - 0c:20:d6:b1:50:39:d6:67:a9:8b:84:bc:92:34:eb:19:23:e8: - 10:8f:ea:bd:18:8c:93:27:3c:74:75:8e:58:04:fa:2a:74:44: - 7d:fc:4d:39:df:54:17:ba:78:e1:5d:6a:70:d3:7c:a2:80:81: - e6:19:51:91:c3:44:51:ec:bb:88:a9:53:e1:d7:a9:8c:28:f4: - 21:1c:42:51:09:b4:12:6d:a0:d6:25:09:85:c6:2a:0c:af:a7: - 58:e6:52:8b + Signature Algorithm: sha256WithRSAEncryption + 51:fe:2a:df:07:7e:43:ca:66:8d:15:c4:2b:db:57:b2:06:6d: + 0d:90:66:ff:a5:24:9c:14:ef:81:f2:a4:ab:99:a9:6a:49:20: + a5:d2:71:e7:1c:3c:99:07:c7:47:fc:e8:96:b4:f5:42:30:ce: + 39:01:4b:d1:c2:e8:bc:95:84:87:ce:55:5d:97:9f:cf:78:f3: + 56:9b:a5:08:6d:ac:f6:a5:5c:c4:ef:3e:2a:39:a6:48:26:29: + 7b:2d:e0:cd:a6:8c:57:48:0b:bb:31:32:c2:bf:d9:43:4c:47: + 25:18:81:a8:c9:33:82:41:9b:ba:61:86:d7:84:93:17:24:25: + 36:ca:4d:63:6b:4f:95:79:d8:60:e0:1e:f5:ac:c1:8a:a1:b1: + 7e:85:8e:87:20:2f:08:31:ad:5e:c6:4a:c8:61:f4:9e:07:1e: + a2:22:ed:73:7c:85:ee:fa:62:dc:50:36:aa:fd:c7:9d:aa:18: + 04:fb:ea:cc:2c:68:9b:b3:a9:c2:96:d8:c1:cc:5a:7e:f7:0d: + 9e:08:e0:9d:29:8b:84:46:8f:d3:91:6a:b5:b8:7a:5c:cc:4f: + 55:01:b8:9a:48:a0:94:43:ca:25:47:52:0a:f7:f4:be:b0:d1: + 71:6d:a5:52:4a:65:50:b2:ad:4e:1d:e0:6c:01:d8:fb:43:80: + e6:e4:0c:37 -----BEGIN CERTIFICATE----- -MIIEnjCCA4agAwIBAgIBATANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCVVMx +MIIEnjCCA4agAwIBAgIBATANBgkqhkiG9w0BAQsFADCBlDELMAkGA1UEBhMCVVMx EDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNh d3Rvb3RoMRMwEQYDVQQLDApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNz -bC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20wHhcNMTQwNzEx -MTcyMDE0WhcNMTcwNDA2MTcyMDE0WjCBkDELMAkGA1UEBhMCVVMxEDAOBgNVBAgM +bC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20wHhcNMTYwODEx +MjAwNzM3WhcNMTkwNTA4MjAwNzM3WjCBkDELMAkGA1UEBhMCVVMxEDAOBgNVBAgM B01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xEDAOBgNVBAoMB3dvbGZTU0wxEDAO BgNVBAsMB1N1cHBvcnQxGDAWBgNVBAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqG SIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP @@ -76,24 +76,24 @@ sxEyyZKYhOLJ+NA7bgNCyh8OjjwwgckGA1UdIwSBwTCBvoAUJ45nEXTDJh0/7TNj s6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIDAdNb250YW5h MRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290aDETMBEGA1UECwwK Q29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcN -AQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYDVR0TBAUwAwEB/zAN -BgkqhkiG9w0BAQUFAAOCAQEAPYxwBVtiS79stkhhARAdXgW6VZQsrllvl4BdbIbs -musVRUTkVvh1yopFMvTH4frymByR0z/oDskb+uF5mWcODWuK7BosWcQ0BI05d821 -6WBbgr80zu3GTz+0XE2KtPQKBBKgVsHhMzehVIdI6YHCD49v01JMTDJMa586BI93 -Xa3cPSvyyd88YF3Y/IZyfD3QhEuM3yZD/sDMW+E2sz0yKKPvDCDWsVA51mepi4S8 -kjTrGSPoEI/qvRiMkyc8dHWOWAT6KnREffxNOd9UF7p44V1qcNN8ooCB5hlRkcNE -Uey7iKlT4depjCj0IRxCUQm0Em2g1iUJhcYqDK+nWOZSiw== +AQkBFhBpbmZvQHdvbGZzc2wuY29tggkAt7aQM2YbayMwDAYDVR0TBAUwAwEB/zAN +BgkqhkiG9w0BAQsFAAOCAQEAUf4q3wd+Q8pmjRXEK9tXsgZtDZBm/6UknBTvgfKk +q5mpakkgpdJx5xw8mQfHR/zolrT1QjDOOQFL0cLovJWEh85VXZefz3jzVpulCG2s +9qVcxO8+KjmmSCYpey3gzaaMV0gLuzEywr/ZQ0xHJRiBqMkzgkGbumGG14STFyQl +NspNY2tPlXnYYOAe9azBiqGxfoWOhyAvCDGtXsZKyGH0ngceoiLtc3yF7vpi3FA2 +qv3HnaoYBPvqzCxom7OpwpbYwcxafvcNngjgnSmLhEaP05Fqtbh6XMxPVQG4mkig +lEPKJUdSCvf0vrDRcW2lUkplULKtTh3gbAHY+0OA5uQMNw== -----END CERTIFICATE----- Certificate: Data: Version: 3 (0x2) Serial Number: - 9a:41:47:cd:a1:14:62:8c - Signature Algorithm: sha1WithRSAEncryption + b7:b6:90:33:66:1b:6b:23 + Signature Algorithm: sha256WithRSAEncryption Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Jul 11 03:20:08 2014 GMT - Not After : Apr 6 03:20:08 2017 GMT + Not Before: Aug 11 20:07:37 2016 GMT + Not After : May 8 20:07:37 2019 GMT Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption @@ -124,32 +124,32 @@ Certificate: X509v3 Authority Key Identifier: keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com - serial:9A:41:47:CD:A1:14:62:8C + serial:B7:B6:90:33:66:1B:6B:23 X509v3 Basic Constraints: CA:TRUE - Signature Algorithm: sha1WithRSAEncryption - 79:78:0c:6d:79:88:91:fc:3a:15:9c:f9:27:62:16:f0:21:1f: - fa:7d:3f:a2:a8:32:1e:f7:f2:11:a9:74:16:74:5e:dc:18:ca: - f0:00:2a:d5:03:06:26:30:f1:47:83:fd:32:6e:fc:ed:aa:4f: - 7d:0c:63:60:31:2f:7c:0c:bf:99:66:87:ed:27:08:86:2d:c4: - 33:e8:98:23:1c:fe:a3:db:9a:49:4e:fc:5a:42:ef:71:c3:3f: - ad:dc:4a:a8:d2:a3:1d:09:ac:33:04:7b:86:f3:6d:00:59:a3: - c8:db:d1:3c:73:f6:0e:90:d6:5e:49:e0:bf:36:63:08:7b:a5: - b0:8f:35:3b:56:8c:11:35:49:04:1c:d0:e7:ba:56:c5:0d:0a: - 91:8d:d6:b7:62:19:34:12:52:4c:d2:6d:7c:c5:3d:0f:18:81: - 54:cb:f6:3c:e5:84:d2:d6:71:15:ec:1a:34:0b:f0:a0:21:74: - 43:c8:a3:b0:df:d9:67:da:e2:ad:93:48:f8:a0:87:bd:79:14: - e0:62:0a:df:f7:31:2e:31:7b:d1:32:2a:0a:fe:5d:14:ef:d9: - 64:50:e4:83:91:bc:70:0d:d7:88:8d:d9:bc:84:0e:c5:1a:b3: - bf:64:02:4e:51:91:a4:a2:85:15:83:af:f0:5b:9b:28:49:5f: - b2:b3:03:d8 + Signature Algorithm: sha256WithRSAEncryption + 0e:93:48:44:4a:72:96:60:71:25:82:a9:2c:ca:60:5b:f2:88: + 3e:cf:11:74:5a:11:4a:dc:d9:d8:f6:58:2c:05:d3:56:d9:e9: + 8f:37:ef:8e:3e:3b:ff:22:36:00:ca:d8:e2:96:3f:a7:d1:ed: + 1f:de:7a:b0:d7:8f:36:bd:41:55:1e:d4:b9:86:3b:87:25:69: + 35:60:48:d6:e4:5a:94:ce:a2:fa:70:38:36:c4:85:b4:4b:23: + fe:71:9e:2f:db:06:c7:b5:9c:21:f0:3e:7c:eb:91:f8:5c:09: + fd:84:43:a4:b3:4e:04:0c:22:31:71:6a:48:c8:ab:bb:e8:ce: + fa:67:15:1a:3a:82:98:43:33:b5:0e:1f:1e:89:f8:37:de:1b: + e6:b5:a0:f4:a2:8b:b7:1c:90:ba:98:6d:94:21:08:80:5d:f3: + bf:66:ad:c9:72:28:7a:6a:48:ee:cf:63:69:31:8c:c5:8e:66: + da:4b:78:65:e8:03:3a:4b:f8:cc:42:54:d3:52:5c:2d:04:ae: + 26:87:e1:7e:40:cb:45:41:16:4b:6e:a3:2e:4a:76:bd:29:7f: + 1c:53:37:06:ad:e9:5b:6a:d6:b7:4e:94:a2:7c:e8:ac:4e:a6: + 50:3e:2b:32:9e:68:42:1b:e4:59:67:61:ea:c7:9a:51:9c:1c: + 55:a3:77:76 -----BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIJAJpBR82hFGKMMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +MIIEqjCCA5KgAwIBAgIJALe2kDNmG2sjMA0GCSqGSIb3DQEBCwUAMIGUMQswCQYD VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe -Fw0xNDA3MTEwMzIwMDhaFw0xNzA0MDYwMzIwMDhaMIGUMQswCQYDVQQGEwJVUzEQ +Fw0xNjA4MTEyMDA3MzdaFw0xOTA1MDgyMDA3MzdaMIGUMQswCQYDVQQGEwJVUzEQ MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3 dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI @@ -163,11 +163,11 @@ XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290 aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t -MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYD -VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAeXgMbXmIkfw6FZz5J2IW8CEf -+n0/oqgyHvfyEal0FnRe3BjK8AAq1QMGJjDxR4P9Mm787apPfQxjYDEvfAy/mWaH -7ScIhi3EM+iYIxz+o9uaSU78WkLvccM/rdxKqNKjHQmsMwR7hvNtAFmjyNvRPHP2 -DpDWXkngvzZjCHulsI81O1aMETVJBBzQ57pWxQ0KkY3Wt2IZNBJSTNJtfMU9DxiB -VMv2POWE0tZxFewaNAvwoCF0Q8ijsN/ZZ9rirZNI+KCHvXkU4GIK3/cxLjF70TIq -Cv5dFO/ZZFDkg5G8cA3XiI3ZvIQOxRqzv2QCTlGRpKKFFYOv8FubKElfsrMD2A== +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAt7aQM2YbayMwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEADpNIREpylmBxJYKpLMpgW/KI +Ps8RdFoRStzZ2PZYLAXTVtnpjzfvjj47/yI2AMrY4pY/p9HtH956sNePNr1BVR7U +uYY7hyVpNWBI1uRalM6i+nA4NsSFtEsj/nGeL9sGx7WcIfA+fOuR+FwJ/YRDpLNO +BAwiMXFqSMiru+jO+mcVGjqCmEMztQ4fHon4N94b5rWg9KKLtxyQuphtlCEIgF3z +v2atyXIoempI7s9jaTGMxY5m2kt4ZegDOkv4zEJU01JcLQSuJofhfkDLRUEWS26j +Lkp2vSl/HFM3Bq3pW2rWt06UonzorE6mUD4rMp5oQhvkWWdh6seaUZwcVaN3dg== -----END CERTIFICATE----- diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 0609dfc0592..0cce783de35 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -35,7 +35,7 @@ #include "rsa.h" -#define YASSL_VERSION "2.4.2" +#define YASSL_VERSION "2.4.4" #if defined(__cplusplus) diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index f190761604d..c5892388eaf 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. 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 @@ -1578,6 +1578,10 @@ void ServerHello::Process(input_buffer& input, SSL& ssl) ssl.SetError(badVersion_error); return; } + if (cipher_suite_[0] != 0x00) { + ssl.SetError(unknown_cipher); + return; + } ssl.set_pending(cipher_suite_[1]); ssl.set_random(random_, server_end); if (id_len_) diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index f041850f85f..34a1c3b73a2 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. 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 @@ -1399,12 +1399,17 @@ void SSL::matchSuite(const opaque* peer, uint length) // start with best, if a match we are good, Ciphers are at odd index // since all SSL and TLS ciphers have 0x00 first byte for (uint i = 1; i < secure_.get_parms().suites_size_; i += 2) - for (uint j = 1; j < length; j+= 2) - if (secure_.use_parms().suites_[i] == peer[j]) { + for (uint j = 0; (j + 1) < length; j+= 2) { + if (peer[j] != 0x00) { + continue; // only 0x00 first byte supported + } + + if (secure_.use_parms().suites_[i] == peer[j + 1]) { secure_.use_parms().suite_[0] = 0x00; - secure_.use_parms().suite_[1] = peer[j]; + secure_.use_parms().suite_[1] = peer[j + 1]; return; } + } SetError(match_error); } From f7316aa0c9a3909fc7498e7b95d5d3af044a7e21 Mon Sep 17 00:00:00 2001 From: Ajo Robert Date: Thu, 24 Aug 2017 17:03:21 +0530 Subject: [PATCH 11/30] Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL)) Backport of Bug#19143243 fix. NAME_CONST item can return NULL_ITEM type in case of incorrect arguments. NULL_ITEM has special processing in Item_func_in function. In Item_func_in::fix_length_and_dec an array of possible comparators is created. Since NAME_CONST function has NULL_ITEM type, corresponding array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE. ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(), so the NULL_ITEM is attempted compared with an empty comparator. The fix is to disable the caching of Item_name_const item. --- sql/item.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sql/item.h b/sql/item.h index 8caa2bc5f9f..9f4e1d24424 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,7 +1,7 @@ #ifndef ITEM_INCLUDED #define ITEM_INCLUDED -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. 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 @@ -1552,6 +1552,12 @@ public: return TRUE; } + virtual bool cache_const_expr_analyzer(uchar **arg) + { + // Item_name_const always wraps a literal, so there is no need to cache it. + return false; + } + int save_in_field(Field *field, bool no_conversions) { return value_item->save_in_field(field, no_conversions); From 5ac61b2af0cf37eeed5050a91819d6d273f037a5 Mon Sep 17 00:00:00 2001 From: Anushree Prakash B Date: Fri, 8 Sep 2017 18:29:07 +0530 Subject: [PATCH 12/30] Bug#26372491 - RCE THROUGH THE MISHANDLE OF BACKSLASH DESCRIPTION: =========== The bug is related to incorrect parsing of SQL queries when typed in on the CLI. The incorrect parsing can result in unexpected results. ANALYSIS: ======== The scenarios mainly happens for identifier names with a typical combination of backslashes and backticks. The incorrect parsing can either result in executing additional queries or can result in query truncation. This can impact mysqldump as well. FIX: === The fix makes sure that such identifier names are correctly parsed and a proper query is sent to the server for execution. (cherry picked from commit 31a372aa1c2b93dc75267d1f05a7f7fca6080dc0) --- client/mysql.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index d09499c120a..715d74f18b2 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2119,7 +2119,10 @@ static bool add_line(String &buffer,char *line,char *in_string, if (*in_string || inchar == 'N') // \N is short for NULL { // Don't allow commands in string *out++='\\'; - *out++= (char) inchar; + if ((inchar == '`') && (*in_string == inchar)) + pos--; + else + *out++= (char) inchar; continue; } if ((com=find_command(NullS,(char) inchar))) From 1da916c37e5107b27297fc9e22c3da7772bb097d Mon Sep 17 00:00:00 2001 From: "mysql-builder@oracle.com" <> Date: Wed, 13 Sep 2017 12:14:06 +0530 Subject: [PATCH 13/30] From bea99275de3871ea286ab935d4d9d6fe26dd45b8 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 5 Oct 2017 15:07:21 +0200 Subject: [PATCH 14/30] MDEV-13595: mariadb-10.2.8/storage/maria/ma_loghandler.c:2730]: (style) Array index 'chunk_offset' is used before limits check. In fact just a cosmetic fix, code was safe because translog_get_first_chunk_offset return offsets inside the page. --- storage/maria/ma_loghandler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index e2e52546fc9..2118b3b6ce6 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -2741,7 +2741,7 @@ static my_bool translog_recover_page_up_to_sector(uchar *page, uint16 offset) DBUG_PRINT("enter", ("offset: %u first chunk: %u", (uint) offset, (uint) chunk_offset)); - while (page[chunk_offset] != TRANSLOG_FILLER && chunk_offset < offset) + while (chunk_offset < offset && page[chunk_offset] != TRANSLOG_FILLER) { uint16 chunk_length; if ((chunk_length= From e30b6a983fe135dd1af0c79c81dbdb5b14b881c8 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 6 Oct 2017 18:23:40 +0400 Subject: [PATCH 15/30] MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value --- mysql-test/r/func_time.result | 14 ++++++++++++++ mysql-test/suite/vcol/r/vcol_misc.result | 19 +++++++++++++++++++ mysql-test/suite/vcol/t/vcol_misc.test | 20 ++++++++++++++++++++ mysql-test/t/func_time.test | 16 ++++++++++++++++ sql/item_timefunc.h | 10 +++++++++- 5 files changed, 78 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 68b1e0f04ad..fa159972c9a 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2626,3 +2626,17 @@ DROP TABLE t1; SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2; 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2 3 +# +# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value +# +SET sql_mode='NO_ZERO_IN_DATE'; +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 SELECT timediff(timestamp'2008-12-31 23:59:59.000001',timestamp'2008-12-30 01:01:01.000002'); +SELECT * FROM t1; +a +46:58:57.999999 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of 5.5 tests +# diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 699b6d4efe3..0a8d87dc2f7 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -337,3 +337,22 @@ tsv timestamp as (adddate(ts, interval 1 day)) virtual ); drop table t1; set sql_mode=default; +# +# MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value +# +SET sql_mode='NO_ZERO_IN_DATE'; +CREATE TABLE t1 +( +a datetime DEFAULT NULL, +b datetime DEFAULT NULL, +c time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL +); +INSERT INTO t1 VALUES ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',DEFAULT); +SELECT * FROM t1; +a b c +2008-12-31 23:59:59 2008-12-30 01:01:01 46:58:58 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of 5.5 tests +# diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 80a36d9c623..1ac0b4f80b7 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -301,3 +301,23 @@ create table t1 ( ); drop table t1; set sql_mode=default; + +--echo # +--echo # MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value +--echo # + +SET sql_mode='NO_ZERO_IN_DATE'; +CREATE TABLE t1 +( + a datetime DEFAULT NULL, + b datetime DEFAULT NULL, + c time GENERATED ALWAYS AS (timediff(`a`,`b`)) VIRTUAL +); +INSERT INTO t1 VALUES ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',DEFAULT); +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 92e1c38cec2..7544f9e7761 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1602,3 +1602,19 @@ DROP TABLE t1; --echo # MDEV-10524 Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision() --echo # SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2; + + +--echo # +--echo # MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value +--echo # + +SET sql_mode='NO_ZERO_IN_DATE'; +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 SELECT timediff(timestamp'2008-12-31 23:59:59.000001',timestamp'2008-12-30 01:01:01.000002'); +SELECT * FROM t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 0062d500835..5be9c5cacbd 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -500,8 +500,16 @@ public: { return val_decimal_from_date(decimal_value); } Field *tmp_table_field(TABLE *table) { return tmp_table_field_from_field_type(table, 0); } +#if MARIADB_VERSION_ID > 100300 +#error This code should be removed in 10.3, to use the derived save_in_field() +#else int save_in_field(Field *field, bool no_conversions) - { return save_date_in_field(field); } + { + return field_type() == MYSQL_TYPE_TIME ? + save_time_in_field(field) : + save_date_in_field(field); + } +#endif void fix_length_and_dec(); }; From c2509a1588ee1dc7351b67b2f9149003540015c4 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 10 Oct 2017 10:35:12 +0400 Subject: [PATCH 16/30] MDEV-13972 crash in Item_func_sec_to_time::get_date --- mysql-test/r/ctype_ucs.result | 8 ++++++++ mysql-test/r/func_time.result | 20 ++++++++++++++++++++ mysql-test/t/ctype_ucs.test | 7 +++++++ mysql-test/t/func_time.test | 15 +++++++++++++++ sql/item_timefunc.cc | 15 ++++++++++++--- 5 files changed, 62 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 7a93c5524ef..d55d308c694 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -4367,5 +4367,13 @@ NO_ENGINE_SUBSTITUTION SET sql_mode=DEFAULT; SET NAMES utf8; # +# MDEV-13972 crash in Item_func_sec_to_time::get_date +# +SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)); +SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '77760000' +# # End of 5.5 tests # diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index fa159972c9a..cffed8eae5b 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2638,5 +2638,25 @@ a DROP TABLE t1; SET sql_mode=DEFAULT; # +# MDEV-13972 crash in Item_func_sec_to_time::get_date +# +DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID())))); +DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~(''))))); +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect INTEGER value: '' +Warning 1292 Truncated incorrect time value: '20000101' +SELECT TO_DAYS(SEC_TO_TIME(MAKEDATE(0,RAND(~0)))); +TO_DAYS(SEC_TO_TIME(MAKEDATE(0,RAND(~0)))) +0 +Warnings: +Warning 1292 Truncated incorrect time value: '20000101' +SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0))); +SEC_TO_TIME(MAKEDATE(0,RAND(~0))) +838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '20000101' +# # End of 5.5 tests # diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index d94c9ae62ac..62890d0cd1b 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -862,6 +862,13 @@ SELECT @@sql_mode; SET sql_mode=DEFAULT; SET NAMES utf8; +--echo # +--echo # MDEV-13972 crash in Item_func_sec_to_time::get_date +--echo # + +SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)); + + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 7544f9e7761..8323bd30d2c 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1615,6 +1615,21 @@ SELECT * FROM t1; DROP TABLE t1; SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-13972 crash in Item_func_sec_to_time::get_date +--echo # + +# The below query can return warning sporadically +--disable_warnings +DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID())))); +--enable_warnings + +DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~(''))))); +SELECT TO_DAYS(SEC_TO_TIME(MAKEDATE(0,RAND(~0)))); +SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0))); + + --echo # --echo # End of 5.5 tests --echo # diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 0ed1506bbee..eeb373a75ee 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1733,9 +1733,18 @@ overflow: ltime->hour= TIME_MAX_HOUR+1; check_time_range(ltime, decimals, &unused); - make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - err->ptr(), err->length(), - MYSQL_TIMESTAMP_TIME, NullS); + if (!err) + { + ErrConvInteger err2(sec, unsigned_flag); + make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + &err2, MYSQL_TIMESTAMP_TIME, NullS); + } + else + { + ErrConvString err2(err); + make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + &err2, MYSQL_TIMESTAMP_TIME, NullS); + } return 0; } From 93aadda513d8b5c2b49001514e235c4fdd73e08a Mon Sep 17 00:00:00 2001 From: Vesa Pentti Date: Sun, 8 Oct 2017 22:15:00 +0300 Subject: [PATCH 17/30] MDEV-13149 -- show function status now works with PAD_CHAR_TO_FULL_LENGTH --- ...nction_with_pad_char_to_full_length.result | 24 +++++++++++++++++++ ...function_with_pad_char_to_full_length.test | 23 ++++++++++++++++++ sql/sql_show.cc | 5 ++++ 3 files changed, 52 insertions(+) create mode 100644 mysql-test/r/show_function_with_pad_char_to_full_length.result create mode 100644 mysql-test/t/show_function_with_pad_char_to_full_length.test diff --git a/mysql-test/r/show_function_with_pad_char_to_full_length.result b/mysql-test/r/show_function_with_pad_char_to_full_length.result new file mode 100644 index 00000000000..785cab7b3e6 --- /dev/null +++ b/mysql-test/r/show_function_with_pad_char_to_full_length.result @@ -0,0 +1,24 @@ +create function f() returns int return 1; +show function status; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +T f T T T T T T T T T +set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH'; +show function status; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +T f T T T T T T T T T +drop function f; +select @@sql_mode; +@@sql_mode +PAD_CHAR_TO_FULL_LENGTH +create function f() returns int return 1; +select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f'; +ROUTINE_NAME +f +set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH'; +select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f'; +ROUTINE_NAME +f +drop function f; +select @@sql_mode; +@@sql_mode +PAD_CHAR_TO_FULL_LENGTH diff --git a/mysql-test/t/show_function_with_pad_char_to_full_length.test b/mysql-test/t/show_function_with_pad_char_to_full_length.test new file mode 100644 index 00000000000..f47f36294d4 --- /dev/null +++ b/mysql-test/t/show_function_with_pad_char_to_full_length.test @@ -0,0 +1,23 @@ +# +# Test that show function status succeeds with +# sql_mode = 'PAD_CHAR_TO_FULL_LENGTH (MDEV-13149) + +# show function status + +create function f() returns int return 1; +--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T +show function status; +set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH'; +--replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T +show function status; +drop function f; +select @@sql_mode; + +# select ROUTINE_NAME from information_schema.ROUTINES + +create function f() returns int return 1; +select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f'; +set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH'; +select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f'; +drop function f; +select @@sql_mode; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d8ea232caea..6e045648591 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5716,6 +5716,10 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) DBUG_RETURN(1); } + /* Disable padding temporarily so it doesn't break the query */ + ulonglong sql_mode_was = thd->variables.sql_mode; + thd->variables.sql_mode &= ~MODE_PAD_CHAR_TO_FULL_LENGTH; + if (proc_table->file->ha_index_init(0, 1)) { res= 1; @@ -5751,6 +5755,7 @@ err: (void) proc_table->file->ha_index_end(); close_system_tables(thd, &open_tables_state_backup); + thd->variables.sql_mode = sql_mode_was; DBUG_RETURN(res); } From 991b9ee73597ba7287267207b3918e157e346899 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 13 Oct 2017 07:06:09 +0400 Subject: [PATCH 18/30] MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 --- mysql-test/r/ctype_ucs.result | 22 ++++++ mysql-test/r/ctype_utf32.result | 15 ++++ mysql-test/r/ctype_utf8.result | 22 ++++++ mysql-test/r/errors.result | 2 +- mysql-test/r/myisam.result | 9 ++- mysql-test/r/partition_datatype.result | 8 ++- mysql-test/r/show_check.result | 4 +- mysql-test/r/strict.result | 4 +- mysql-test/r/type_blob.result | 2 +- mysql-test/r/type_varchar.result | 69 +++++++++++++++++++ mysql-test/suite/maria/maria.result | 9 ++- mysql-test/suite/maria/maria.test | 3 +- mysql-test/t/ctype_ucs.test | 16 +++++ mysql-test/t/ctype_utf32.test | 13 ++++ mysql-test/t/ctype_utf8.test | 16 +++++ mysql-test/t/myisam.test | 3 +- mysql-test/t/partition_datatype.test | 8 ++- mysql-test/t/type_varchar.test | 44 ++++++++++++ sql/sql_const.h | 13 +++- .../mysql-test/tokudb/r/type_blob.result | 2 +- 20 files changed, 266 insertions(+), 18 deletions(-) diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index d55d308c694..1bbd3af4af7 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -4375,5 +4375,27 @@ SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)) Warnings: Warning 1292 Truncated incorrect time value: '77760000' # +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +CREATE TABLE t1 (c1 VARCHAR(32766) CHARACTER SET ucs2); +DESCRIBE t1; +Field Type Null Key Default Extra +c1 varchar(32766) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(32767) CHARACTER SET ucs2); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 text YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(32768) CHARACTER SET ucs2); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 9b062f9480f..02683bc66e6 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -1283,5 +1283,20 @@ NO_ENGINE_SUBSTITUTION SET sql_mode=DEFAULT; SET NAMES utf8; # +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +CREATE TABLE t1 (c1 VARCHAR(16383) CHARACTER SET utf32); +DESCRIBE t1; +Field Type Null Key Default Extra +c1 varchar(16383) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(16384) CHARACTER SET utf32); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 74fed6a3162..fee27ef177f 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5933,5 +5933,27 @@ Warnings: SET sql_mode=DEFAULT; DROP TABLE t1; # +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +CREATE TABLE t1 (c1 VARCHAR(21844) CHARACTER SET utf8); +DESCRIBE t1; +Field Type Null Key Default Extra +c1 varchar(21844) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(21845) CHARACTER SET utf8); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 text YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(21846) CHARACTER SET utf8); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 23c77d3978c..d71759cb128 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -27,7 +27,7 @@ create table t1 (a int(256)); ERROR 42000: Display width out of range for 'a' (max = 255) set sql_mode='traditional'; create table t1 (a varchar(66000)); -ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead +ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead set sql_mode=default; CREATE TABLE t1 (a INT); SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0))); diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 85af643387e..81a2001c28c 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1697,7 +1697,14 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (v varchar(65535)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs +Warnings: +Note 1246 Converting column 'v' from VARCHAR to TEXT +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` text +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; set storage_engine=MyISAM; set @save_concurrent_insert=@@concurrent_insert; set global concurrent_insert=1; diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result index 1151a1cb1fe..879b603c5ad 100644 --- a/mysql-test/r/partition_datatype.result +++ b/mysql-test/r/partition_datatype.result @@ -314,12 +314,14 @@ bbbb drop table t1; create table t1 (a varchar(3070)) partition by key (a); ERROR HY000: The total length of the partitioning fields is too large +create table t1 (a varchar(65532) not null) partition by key (a); +ERROR HY000: The total length of the partitioning fields is too large create table t1 (a varchar(65533)) partition by key (a); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs +ERROR HY000: A BLOB field is not allowed in partition function create table t1 (a varchar(65534) not null) partition by key (a); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs +ERROR HY000: A BLOB field is not allowed in partition function create table t1 (a varchar(65535)) partition by key (a); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs +ERROR HY000: A BLOB field is not allowed in partition function create table t1 (a bit(27), primary key (a)) engine=myisam partition by hash (a) (partition p0, partition p1, partition p2); diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 0e4cf6c6775..8d4c3feb100 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -959,7 +959,7 @@ def information_schema COLUMNS COLUMNS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N def information_schema COLUMNS COLUMNS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 def information_schema COLUMNS COLUMNS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589815 0 Y 16 0 33 +def information_schema COLUMNS COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589788 0 Y 16 0 33 def information_schema COLUMNS COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 1 0 33 def information_schema COLUMNS COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 1 0 33 def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 96 0 Y 0 0 33 @@ -984,7 +984,7 @@ def information_schema COLUMNS COLUMNS COLUMN_NAME Field 253 192 1 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33 def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 -def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589815 0 Y 16 0 33 +def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589788 0 Y 16 0 33 def information_schema COLUMNS COLUMNS EXTRA Extra 253 81 0 N 1 0 33 Field Type Null Key Default Extra c int(11) NO PRI NULL diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index da3c658b5a4..a3262ca5caa 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1240,9 +1240,9 @@ Warning 1364 Field 'i' doesn't have a default value DROP TABLE t1; set @@sql_mode='traditional'; create table t1(a varchar(65537)); -ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead +ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead create table t1(a varbinary(65537)); -ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead +ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead set @@sql_mode='traditional'; create table t1(a int, b date not null); alter table t1 modify a bigint unsigned not null; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index f49b2a7d5ef..9b20ddeb1df 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -37,7 +37,7 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT CREATE TABLE t2 (a char(256)); ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead CREATE TABLE t1 (a varchar(70000) default "hello"); -ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead +ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead CREATE TABLE t2 (a blob default "hello"); ERROR 42000: BLOB/TEXT column 'a' can't have a default value drop table if exists t1,t2; diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 38ed8a47339..0ab13be113e 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -510,3 +510,72 @@ SELECT 5 = a FROM t1; Warnings: Warning 1292 Truncated incorrect DOUBLE value: 's ' DROP TABLE t1; +# +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +CREATE TABLE t1 (c1 VARBINARY(65532)); +DESCRIBE t1; +Field Type Null Key Default Extra +c1 varbinary(65532) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARBINARY(65533)); +Warnings: +Note 1246 Converting column 'c1' from VARBINARY to BLOB +DESCRIBE t1; +Field Type Null Key Default Extra +c1 blob YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARBINARY(65534)); +Warnings: +Note 1246 Converting column 'c1' from VARBINARY to BLOB +DESCRIBE t1; +Field Type Null Key Default Extra +c1 blob YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARBINARY(65535)); +Warnings: +Note 1246 Converting column 'c1' from VARBINARY to BLOB +DESCRIBE t1; +Field Type Null Key Default Extra +c1 blob YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARBINARY(65536)); +Warnings: +Note 1246 Converting column 'c1' from VARBINARY to BLOB +DESCRIBE t1; +Field Type Null Key Default Extra +c1 mediumblob YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(65532)); +DESCRIBE t1; +Field Type Null Key Default Extra +c1 varchar(65532) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(65533)); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 text YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(65534)); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 text YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(65535)); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 text YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(65536)); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +DROP TABLE t1; diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 0de42a9e7fe..890f6bbfaf5 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -1586,7 +1586,14 @@ t1 CREATE TABLE `t1` ( ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 drop table t1; create table t1 (v varchar(65535)); -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs +Warnings: +Note 1246 Converting column 'v' from VARCHAR to TEXT +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `v` text +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 +drop table t1; set @save_concurrent_insert=@@concurrent_insert; set global concurrent_insert=1; create table t1 (a int) ROW_FORMAT=FIXED; diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index 3fa7d755fe4..b6a3e2784b6 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -924,8 +924,9 @@ show create table t1; drop table t1; # ARIA specific varchar tests ---error 1118 create table t1 (v varchar(65535)); +show create table t1; +drop table t1; # # Test concurrent insert diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 62890d0cd1b..b3d0be4432f 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -868,6 +868,22 @@ SET NAMES utf8; SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)); +--echo # +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +CREATE TABLE t1 (c1 VARCHAR(32766) CHARACTER SET ucs2); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(32767) CHARACTER SET ucs2); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(32768) CHARACTER SET ucs2); +DESCRIBE t1; +DROP TABLE t1; + --echo # --echo # End of 5.5 tests diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index 2b3d3b3bdc5..fced2838273 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -890,6 +890,19 @@ SELECT @@sql_mode; SET sql_mode=DEFAULT; SET NAMES utf8; +--echo # +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +CREATE TABLE t1 (c1 VARCHAR(16383) CHARACTER SET utf32); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(16384) CHARACTER SET utf32); +DESCRIBE t1; +DROP TABLE t1; + + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 75581ede8fa..592e3a3b662 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1695,6 +1695,22 @@ SELECT CHAR(i USING utf8) FROM t1; SET sql_mode=DEFAULT; DROP TABLE t1; +--echo # +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +CREATE TABLE t1 (c1 VARCHAR(21844) CHARACTER SET utf8); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(21845) CHARACTER SET utf8); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(21846) CHARACTER SET utf8); +DESCRIBE t1; +DROP TABLE t1; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 43c12b42bc9..c4bb93b6bfe 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1030,8 +1030,9 @@ show create table t1; drop table t1; # MyISAM specific varchar tests ---error 1118 create table t1 (v varchar(65535)); +show create table t1; +drop table t1; eval set storage_engine=$default; diff --git a/mysql-test/t/partition_datatype.test b/mysql-test/t/partition_datatype.test index a6035fcb592..4ec0232718e 100644 --- a/mysql-test/t/partition_datatype.test +++ b/mysql-test/t/partition_datatype.test @@ -217,11 +217,13 @@ select * from t1 where a = 'bbbb'; drop table t1; -- error ER_PARTITION_FIELDS_TOO_LONG create table t1 (a varchar(3070)) partition by key (a); --- error ER_TOO_BIG_ROWSIZE +-- error ER_PARTITION_FIELDS_TOO_LONG +create table t1 (a varchar(65532) not null) partition by key (a); +-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR create table t1 (a varchar(65533)) partition by key (a); --- error ER_TOO_BIG_ROWSIZE +-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR create table t1 (a varchar(65534) not null) partition by key (a); --- error ER_TOO_BIG_ROWSIZE +-- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR create table t1 (a varchar(65535)) partition by key (a); # diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index 33b84266118..ed8218208c3 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -217,3 +217,47 @@ CREATE TABLE t1 (a CHAR(16)); INSERT INTO t1 VALUES ('5'), ('s'), (''); SELECT 5 = a FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +--echo # + +CREATE TABLE t1 (c1 VARBINARY(65532)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65533)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65534)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65535)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARBINARY(65536)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65532)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65533)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65534)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65535)); +DESCRIBE t1; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(65536)); +DESCRIBE t1; +DROP TABLE t1; diff --git a/sql/sql_const.h b/sql/sql_const.h index abe2a496045..e8385b537a8 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -41,7 +41,18 @@ #define MAX_MBWIDTH 3 /* Max multibyte sequence */ #define MAX_FIELD_CHARLENGTH 255 -#define MAX_FIELD_VARCHARLENGTH 65535 +/* + In MAX_FIELD_VARCHARLENGTH we reserve extra bytes for the overhead: + - 2 bytes for the length + - 1 byte for NULL bits + to avoid the "Row size too large" error for these three corner definitions: + CREATE TABLE t1 (c VARBINARY(65533)); + CREATE TABLE t1 (c VARBINARY(65534)); + CREATE TABLE t1 (c VARBINARY(65535)); + Like VARCHAR(65536), they will be converted to BLOB automatically + in non-sctict mode. +*/ +#define MAX_FIELD_VARCHARLENGTH (65535-2-1) #define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */ #define CONVERT_IF_BIGGER_TO_BLOB 512 /* Threshold *in characters* */ diff --git a/storage/tokudb/mysql-test/tokudb/r/type_blob.result b/storage/tokudb/mysql-test/tokudb/r/type_blob.result index 2c8ba56fe0f..2c4e364f3b7 100644 --- a/storage/tokudb/mysql-test/tokudb/r/type_blob.result +++ b/storage/tokudb/mysql-test/tokudb/r/type_blob.result @@ -38,7 +38,7 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT CREATE TABLE t2 (a char(256)); ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead CREATE TABLE t1 (a varchar(70000) default "hello"); -ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead +ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead CREATE TABLE t2 (a blob default "hello"); ERROR 42000: BLOB/TEXT column 'a' can't have a default value drop table if exists t1,t2; From a4868c3509772da1666eb3d492515e7d39f8834d Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 19 Dec 2016 22:03:28 +0100 Subject: [PATCH 19/30] MDEV-9208: Function->Function->View = Mysqld segfault (Server crashes in Dependency_marker::visit_field on 2nd execution with merged subquery) Prevent crossing name resolution border in finding item tables. --- mysql-test/r/ps.result | 30 ++++++++++++++++++++++++++++++ mysql-test/t/ps.test | 26 ++++++++++++++++++++++++++ sql/item.cc | 6 +++++- 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index f954583a097..e2c0d6567ac 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4173,4 +4173,34 @@ Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0 deallocate prepare stmt2; drop table t1; +# +# MDEV-9208: Function->Function->View = Mysqld segfault +# (Server crashes in Dependency_marker::visit_field on 2nd +# execution with merged subquery) +# +CREATE TABLE t1 (i1 INT); +insert into t1 values(1),(2); +CREATE TABLE t2 (i2 INT); +insert into t2 values(1),(2); +prepare stmt from " + select 1 from ( + select + if (i1<0, 0, 0) as f1, + (select f1) as f2 + from t1, t2 + ) sq +"; +execute stmt; +1 +1 +1 +1 +1 +execute stmt; +1 +1 +1 +1 +1 +drop table t1,t2; # End of 5.5 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index cfd810fd625..dac0bbd4d29 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3714,4 +3714,30 @@ deallocate prepare stmt2; drop table t1; +--echo # +--echo # MDEV-9208: Function->Function->View = Mysqld segfault +--echo # (Server crashes in Dependency_marker::visit_field on 2nd +--echo # execution with merged subquery) +--echo # + +CREATE TABLE t1 (i1 INT); +insert into t1 values(1),(2); + +CREATE TABLE t2 (i2 INT); +insert into t2 values(1),(2); + +prepare stmt from " + select 1 from ( + select + if (i1<0, 0, 0) as f1, + (select f1) as f2 + from t1, t2 + ) sq +"; + +execute stmt; +execute stmt; + +drop table t1,t2; + --echo # End of 5.5 tests diff --git a/sql/item.cc b/sql/item.cc index fdfbba31404..3100a4e3408 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6876,7 +6876,11 @@ public: // Find which select the field is in. This is achieved by walking up // the select tree and looking for the table of interest. st_select_lex *sel; - for (sel= current_select; sel; sel= sel->outer_select()) + for (sel= current_select; + sel ; + sel= (sel->context.outer_context ? + sel->context.outer_context->select_lex: + NULL)) { List_iterator li(sel->leaf_tables); TABLE_LIST *tbl; From 8be76a6a907ab858b4fdb5d525548aedfdb4ddf3 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 12 Oct 2017 13:30:02 +0400 Subject: [PATCH 20/30] MDEV-10892 - rpl.rpl_semi_sync_uninstall_plugin fails with Assertion `0' failure in buildbot Removed plugin_array_version: it is being checked without mutex protection and thus is prone to data race and race conditions. In effect plugins are not protected from concurrent destruction. Removed state_mask inversion: doesn't seem to make any sense. When collecting local plugins list, only add plugins that match state_mask. Use plugin ref counting to protect against concurrent plugin destruction. --- sql/sql_plugin.cc | 57 +++++++++++++++++++---------------------------- sql/sql_show.cc | 5 +++-- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 75aca02990d..9eecd6a1345 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -194,7 +194,6 @@ static DYNAMIC_ARRAY plugin_array; static HASH plugin_hash[MYSQL_MAX_PLUGIN_TYPE_NUM]; static MEM_ROOT plugin_mem_root; static bool reap_needed= false; -static int plugin_array_version=0; static bool initialized= 0; @@ -312,7 +311,6 @@ static void plugin_vars_free_values(sys_var *vars); static void restore_pluginvar_names(sys_var *first); static void plugin_opt_set_limits(struct my_option *, const struct st_mysql_sys_var *); -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin); static void intern_plugin_unlock(LEX *lex, plugin_ref plugin); static void reap_plugins(void); @@ -924,14 +922,16 @@ SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type) } -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc) +static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc, + uint state_mask= PLUGIN_IS_READY | + PLUGIN_IS_UNINITIALIZED) { st_plugin_int *pi= plugin_ref_to_int(rc); DBUG_ENTER("intern_plugin_lock"); mysql_mutex_assert_owner(&LOCK_plugin); - if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED)) + if (pi->state & state_mask) { plugin_ref plugin; #ifdef DBUG_OFF @@ -1111,7 +1111,6 @@ static bool plugin_add(MEM_ROOT *tmp_root, if (!(tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) goto err; - plugin_array_version++; if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) tmp_plugin_ptr->state= PLUGIN_IS_FREED; init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); @@ -1210,7 +1209,6 @@ static void plugin_del(struct st_plugin_int *plugin) if (plugin->plugin_dl) plugin_dl_del(&plugin->plugin_dl->dl); plugin->state= PLUGIN_IS_FREED; - plugin_array_version++; free_root(&plugin->mem_root, MYF(0)); DBUG_VOID_RETURN; } @@ -2297,64 +2295,55 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name, bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, int type, uint state_mask, void *arg) { - uint idx, total; - struct st_plugin_int *plugin, **plugins; - int version=plugin_array_version; + uint idx, total= 0; + struct st_plugin_int *plugin; + plugin_ref *plugins; + my_bool res= FALSE; DBUG_ENTER("plugin_foreach_with_mask"); if (!initialized) DBUG_RETURN(FALSE); - state_mask= ~state_mask; // do it only once - mysql_mutex_lock(&LOCK_plugin); - total= type == MYSQL_ANY_PLUGIN ? plugin_array.elements - : plugin_hash[type].records; /* Do the alloca out here in case we do have a working alloca: - leaving the nested stack frame invalidates alloca allocation. + leaving the nested stack frame invalidates alloca allocation. */ - plugins=(struct st_plugin_int **)my_alloca(total*sizeof(plugin)); if (type == MYSQL_ANY_PLUGIN) { - for (idx= 0; idx < total; idx++) + plugins= (plugin_ref*) my_alloca(plugin_array.elements * sizeof(plugin_ref)); + for (idx= 0; idx < plugin_array.elements; idx++) { plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); - plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL; + if ((plugins[total]= intern_plugin_lock(0, plugin_int_to_ref(plugin), + state_mask))) + total++; } } else { HASH *hash= plugin_hash + type; - for (idx= 0; idx < total; idx++) + plugins= (plugin_ref*) my_alloca(hash->records * sizeof(plugin_ref)); + for (idx= 0; idx < hash->records; idx++) { plugin= (struct st_plugin_int *) my_hash_element(hash, idx); - plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL; + if ((plugins[total]= intern_plugin_lock(0, plugin_int_to_ref(plugin), + state_mask))) + total++; } } mysql_mutex_unlock(&LOCK_plugin); for (idx= 0; idx < total; idx++) { - if (unlikely(version != plugin_array_version)) - { - mysql_mutex_lock(&LOCK_plugin); - for (uint i=idx; i < total; i++) - if (plugins[i] && plugins[i]->state & state_mask) - plugins[i]=0; - mysql_mutex_unlock(&LOCK_plugin); - } - plugin= plugins[idx]; /* It will stop iterating on first engine error when "func" returns TRUE */ - if (plugin && func(thd, plugin_int_to_ref(plugin), arg)) - goto err; + if ((res= func(thd, plugins[idx], arg))) + break; } + plugin_unlock_list(0, plugins, total); my_afree(plugins); - DBUG_RETURN(FALSE); -err: - my_afree(plugins); - DBUG_RETURN(TRUE); + DBUG_RETURN(res); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 6e045648591..512548b1d51 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -262,7 +262,7 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond) TABLE *table= tables->table; if (plugin_foreach_with_mask(thd, show_plugins, MYSQL_ANY_PLUGIN, - ~PLUGIN_IS_FREED, table)) + ~(PLUGIN_IS_FREED | PLUGIN_IS_DYING), table)) DBUG_RETURN(1); DBUG_RETURN(0); @@ -5294,7 +5294,8 @@ int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond) DBUG_ENTER("fill_schema_engines"); if (plugin_foreach_with_mask(thd, iter_schema_engines, MYSQL_STORAGE_ENGINE_PLUGIN, - ~PLUGIN_IS_FREED, tables->table)) + ~(PLUGIN_IS_FREED | PLUGIN_IS_DYING), + tables->table)) DBUG_RETURN(1); DBUG_RETURN(0); } From 2bab29ebba7a641d43a98737fd1c160971357cd4 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Fri, 13 Oct 2017 07:24:35 -0700 Subject: [PATCH 21/30] Fixed the bug mdev-13135. For each SELECT the list sj_nests is built by the function simplify_joins() when scanning different join nests. This function may be called several times for the same join nest. That's why before adding a new member to sj_nests it is necessary to check if it's already in the list. The code of simplify_joins() lacked this check and as a result it could cause memory overwright for some queries. --- mysql-test/r/subselect_mat_cost_bugs.result | 17 +++++++++++++++++ mysql-test/t/subselect_mat_cost_bugs.test | 19 +++++++++++++++++++ sql/sql_select.cc | 21 +++++++++++++++++---- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result index 57b0526c6a3..df6b543bab8 100644 --- a/mysql-test/r/subselect_mat_cost_bugs.result +++ b/mysql-test/r/subselect_mat_cost_bugs.result @@ -502,3 +502,20 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index idx idx 5 NULL 5 Using where; Using index 2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1; +# +# MDEV-13135: subquery with ON expression subject to +# semi-join optimizations +# +CREATE TABLE t1 (a INT); +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a AS v_a FROM t1; +INSERT INTO t1 VALUES (1),(3); +CREATE TABLE t2 (b INT, KEY(b)); +INSERT INTO t2 VALUES (3),(4); +SELECT * FROM t1 WHERE a NOT IN ( +SELECT b FROM t2 INNER JOIN v1 ON (b IN ( SELECT a FROM t1 )) +WHERE v_a = b +); +a +1 +DROP VIEW v1; +DROP TABLE t1,t2; diff --git a/mysql-test/t/subselect_mat_cost_bugs.test b/mysql-test/t/subselect_mat_cost_bugs.test index 35f2b9588fe..67af6e3a54a 100644 --- a/mysql-test/t/subselect_mat_cost_bugs.test +++ b/mysql-test/t/subselect_mat_cost_bugs.test @@ -522,4 +522,23 @@ select * from t1 where a in (select max(a) from t1 where a < 4) or a > 5; drop table t1; +--echo # +--echo # MDEV-13135: subquery with ON expression subject to +--echo # semi-join optimizations +--echo # + +CREATE TABLE t1 (a INT); +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a AS v_a FROM t1; +INSERT INTO t1 VALUES (1),(3); + +CREATE TABLE t2 (b INT, KEY(b)); +INSERT INTO t2 VALUES (3),(4); + +SELECT * FROM t1 WHERE a NOT IN ( + SELECT b FROM t2 INNER JOIN v1 ON (b IN ( SELECT a FROM t1 )) + WHERE v_a = b +); + +DROP VIEW v1; +DROP TABLE t1,t2; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 720c0a22681..6e67bb11015 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13349,10 +13349,23 @@ simplify_joins(JOIN *join, List *join_list, COND *conds, bool top, nested_join= table->nested_join; if (table->sj_on_expr && !in_sj) { - /* - If this is a semi-join that is not contained within another semi-join, - leave it intact (otherwise it is flattened) - */ + /* + If this is a semi-join that is not contained within another semi-join + leave it intact (otherwise it is flattened) + */ + /* + Make sure that any semi-join appear in + the join->select_lex->sj_nests list only once + */ + List_iterator_fast sj_it(join->select_lex->sj_nests); + TABLE_LIST *sj_nest; + while ((sj_nest= sj_it++)) + { + if (table == sj_nest) + break; + } + if (sj_nest) + continue; join->select_lex->sj_nests.push_back(table); /* From 235b68299bc112f9cb7be97af8d01bf904919a6b Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Sat, 18 Feb 2017 17:47:31 +0100 Subject: [PATCH 22/30] MDEV-9619: Assertion `null_ref_table' failed in virtual table_map Item_direct_view_ref::used_tables() const on 2nd execution of PS Refer left expression indirectly in case it changes from execution to execution. --- mysql-test/r/ps.result | 113 +++++++++++++++++++++++++++++++++++++++++ mysql-test/t/ps.test | 103 +++++++++++++++++++++++++++++++++++++ sql/item_row.cc | 30 ++++++++++- sql/item_row.h | 1 + sql/item_subselect.cc | 6 +++ sql/opt_subselect.cc | 55 +++++++++++++++++--- sql/sql_base.cc | 7 ++- sql/sql_base.h | 5 +- sql/sql_do.cc | 2 +- sql/sql_insert.cc | 14 ++--- sql/sql_lex.h | 1 + sql/sql_load.cc | 10 ++-- sql/sql_prepare.cc | 9 ++-- sql/sql_select.cc | 2 +- sql/sql_update.cc | 4 +- sql/table.h | 3 +- 16 files changed, 332 insertions(+), 33 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index e2c0d6567ac..3fed0a5b0d1 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4203,4 +4203,117 @@ execute stmt; 1 1 drop table t1,t2; +# +# MDEV-9619: Assertion `null_ref_table' failed in virtual +# table_map Item_direct_view_ref::used_tables() const on 2nd +# execution of PS +# +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); +PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )"; +EXECUTE stmt; +f1 +EXECUTE stmt; +f1 +insert into t1 values ('c'); +EXECUTE stmt; +f1 +c +EXECUTE stmt; +f1 +c +deallocate prepare stmt; +drop view v1; +drop table t1,t2; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); +PREPARE stmt FROM "SELECT * FROM v1 WHERE (f1,f1) = SOME ( SELECT f2,f2 FROM t2 )"; +EXECUTE stmt; +f1 +EXECUTE stmt; +f1 +insert into t1 values ('c'); +EXECUTE stmt; +f1 +c +EXECUTE stmt; +f1 +c +deallocate prepare stmt; +drop view v1; +drop table t1,t2; +CREATE TABLE t1 (column1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(9); +CREATE TABLE t2 (column2 INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(4); +CREATE TABLE t3 (column3 INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6),(8); +CREATE TABLE t4 (column4 INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (2),(5); +PREPARE stmt FROM " +SELECT ( + SELECT MAX( table1.column1 ) AS field1 + FROM t1 AS table1 + WHERE (111,table3.column3) IN ( SELECT 111,table2.column2 AS field2 FROM t2 AS table2 ) +) AS sq +FROM t3 AS table3, t4 AS table4 GROUP BY sq +"; +EXECUTE stmt; +sq +NULL +EXECUTE stmt; +sq +NULL +deallocate prepare stmt; +drop table t1,t2,t3,t4; +create table t1 (a int, b int, c int); +create table t2 (x int, y int, z int); +create table t3 as select * from t1; +insert into t1 values (1,2,3),(4,5,6),(100,200,300),(400,500,600); +insert into t2 values (1,2,3),(7,8,9),(100,200,300),(400,500,600); +insert into t3 values (1,2,3),(11,12,13),(100,0,0),(400,500,600); +set @optimizer_switch_save=@@optimizer_switch; +set @join_cache_level_save=@@join_cache_level; +set optimizer_switch='materialization=off'; +set join_cache_level=0; +select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z); +a b c +1 2 3 +400 500 600 +prepare stmt from "select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z)"; +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +create view v1 as select * from t1; +create view v2 as select * from t2; +create view v3 as select * from t3; +select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z); +a b c +1 2 3 +400 500 600 +prepare stmt from "select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z)"; +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +set optimizer_switch=@optimizer_switch_save; +set join_cache_level=@join_cache_level_save; +deallocate prepare stmt; +drop view v1,v2,v3; +drop table t1,t2,t3; # End of 5.5 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index dac0bbd4d29..4431f722ae0 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3740,4 +3740,107 @@ execute stmt; drop table t1,t2; +--echo # +--echo # MDEV-9619: Assertion `null_ref_table' failed in virtual +--echo # table_map Item_direct_view_ref::used_tables() const on 2nd +--echo # execution of PS +--echo # + +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); + +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); + +PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )"; +EXECUTE stmt; +EXECUTE stmt; +insert into t1 values ('c'); +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; +drop view v1; +drop table t1,t2; + +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); + +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); + +PREPARE stmt FROM "SELECT * FROM v1 WHERE (f1,f1) = SOME ( SELECT f2,f2 FROM t2 )"; +EXECUTE stmt; +EXECUTE stmt; +insert into t1 values ('c'); +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; +drop view v1; +drop table t1,t2; + + + +CREATE TABLE t1 (column1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(9); + +CREATE TABLE t2 (column2 INT) ENGINE=MyISAM; + +INSERT INTO t2 VALUES (1),(4); + +CREATE TABLE t3 (column3 INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6),(8); + +CREATE TABLE t4 (column4 INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (2),(5); + +PREPARE stmt FROM " +SELECT ( + SELECT MAX( table1.column1 ) AS field1 + FROM t1 AS table1 + WHERE (111,table3.column3) IN ( SELECT 111,table2.column2 AS field2 FROM t2 AS table2 ) +) AS sq +FROM t3 AS table3, t4 AS table4 GROUP BY sq +"; + +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; +drop table t1,t2,t3,t4; + +create table t1 (a int, b int, c int); +create table t2 (x int, y int, z int); +create table t3 as select * from t1; +insert into t1 values (1,2,3),(4,5,6),(100,200,300),(400,500,600); +insert into t2 values (1,2,3),(7,8,9),(100,200,300),(400,500,600); +insert into t3 values (1,2,3),(11,12,13),(100,0,0),(400,500,600); + + +set @optimizer_switch_save=@@optimizer_switch; +set @join_cache_level_save=@@join_cache_level; +set optimizer_switch='materialization=off'; +set join_cache_level=0; +select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z); +prepare stmt from "select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z)"; +EXECUTE stmt; +EXECUTE stmt; + +create view v1 as select * from t1; +create view v2 as select * from t2; +create view v3 as select * from t3; +select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z); +prepare stmt from "select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z)"; +EXECUTE stmt; +EXECUTE stmt; +set optimizer_switch=@optimizer_switch_save; +set join_cache_level=@join_cache_level_save; + +deallocate prepare stmt; +drop view v1,v2,v3; +drop table t1,t2,t3; + --echo # End of 5.5 tests diff --git a/sql/item_row.cc b/sql/item_row.cc index ee1d17213ee..9e81c053b69 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -44,7 +44,14 @@ Item_row::Item_row(List &arg): //TODO: think placing 2-3 component items in item (as it done for function) if ((arg_count= arg.elements)) + { items= (Item**) sql_alloc(sizeof(Item*)*arg_count); + if (!items) + { + arg_count= 0; + return; + } + } else items= 0; List_iterator li(arg); @@ -53,7 +60,28 @@ Item_row::Item_row(List &arg): while ((item= li++)) { items[i]= item; - i++; + i++; + } +} + + +Item_row::Item_row(Item *item): + Item(), + used_tables_cache(0), + not_null_tables_cache(0), + arg_count(item->cols()), + const_item_cache(1), + with_null(0) +{ + items= (Item**) sql_alloc(sizeof(Item*) * arg_count); + if (!items) + { + arg_count= 0; + return; + } + for (uint i= 0; i < arg_count; i++) + { + items[i]= item->element_index(i); } } diff --git a/sql/item_row.h b/sql/item_row.h index aa56068f8ba..4d5c20711b5 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -35,6 +35,7 @@ public: const_item_cache(item->const_item_cache), with_null(0) {} + Item_row(Item *item); enum Type type() const { return ROW_ITEM; }; void illegal_method_call(const char *); diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index ef90dd59be3..90f2bd5b9eb 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1374,6 +1374,9 @@ Item_in_subselect::Item_in_subselect(Item * left_exp, { DBUG_ENTER("Item_in_subselect::Item_in_subselect"); left_expr_orig= left_expr= left_exp; + /* prepare to possible disassembling the item in convert_subq_to_sj() */ + if (left_exp->type() == Item::ROW_ITEM) + left_expr_orig= new Item_row(left_exp); func= &eq_creator; init(select_lex, new select_exists_subselect(this)); max_columns= UINT_MAX; @@ -1398,6 +1401,9 @@ Item_allany_subselect::Item_allany_subselect(Item * left_exp, { DBUG_ENTER("Item_allany_subselect::Item_allany_subselect"); left_expr_orig= left_expr= left_exp; + /* prepare to possible disassembling the item in convert_subq_to_sj() */ + if (left_exp->type() == Item::ROW_ITEM) + left_expr_orig= new Item_row(left_exp); func= func_creator(all_arg); init(select_lex, new select_exists_subselect(this)); max_columns= 1; diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index af1abb2001e..69a5367cdf1 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -1609,6 +1609,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) sj-nest. */ st_select_lex *subq_lex= subq_pred->unit->first_select(); + DBUG_ASSERT(subq_lex->next_select() == NULL); nested_join->join_list.empty(); List_iterator_fast li(subq_lex->top_join_list); TABLE_LIST *tl; @@ -1706,7 +1707,8 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) if (subq_pred->left_expr->cols() == 1) { - nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr); + /* add left = select_list_element */ + nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr); /* Create Item_func_eq. Note that 1. this is done on the statement, not execution, arena @@ -1718,24 +1720,61 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) */ Item_func_eq *item_eq= new Item_func_eq(subq_pred->left_expr_orig, subq_lex->ref_pointer_array[0]); + if (!item_eq) + DBUG_RETURN(TRUE); if (subq_pred->left_expr_orig != subq_pred->left_expr) thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr); item_eq->in_equality_no= 0; sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq); } - else + else if (subq_pred->left_expr->type() == Item::ROW_ITEM) { + /* + disassemple left expression and add + left1 = select_list_element1 and left2 = select_list_element2 ... + */ for (uint i= 0; i < subq_pred->left_expr->cols(); i++) { nested_join->sj_outer_expr_list.push_back(subq_pred->left_expr-> - element_index(i)); - Item_func_eq *item_eq= - new Item_func_eq(subq_pred->left_expr->element_index(i), + addr(i)); + Item_func_eq *item_eq= + new Item_func_eq(subq_pred->left_expr_orig->element_index(i), subq_lex->ref_pointer_array[i]); + if (!item_eq) + DBUG_RETURN(TRUE); + DBUG_ASSERT(subq_pred->left_expr->element_index(i)->fixed); + if (subq_pred->left_expr_orig->element_index(i) != + subq_pred->left_expr->element_index(i)) + thd->change_item_tree(item_eq->arguments(), + subq_pred->left_expr->element_index(i)); item_eq->in_equality_no= i; sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq); } } + else + { + /* + add row operation + left = (select_list_element1, select_list_element2, ...) + */ + Item_row *row= new Item_row(subq_lex->pre_fix); + /* fix fields on subquery was call so they should be the same */ + DBUG_ASSERT(subq_pred->left_expr->cols() == row->cols()); + if (!row) + DBUG_RETURN(TRUE); + nested_join->sj_outer_expr_list.push_back(&subq_pred->left_expr); + Item_func_eq *item_eq= + new Item_func_eq(subq_pred->left_expr_orig, row); + if (!item_eq) + DBUG_RETURN(TRUE); + for (uint i= 0; i < row->cols(); i++) + { + if (row->element_index(i) != subq_lex->ref_pointer_array[i]) + thd->change_item_tree(row->addr(i), subq_lex->ref_pointer_array[i]); + } + item_eq->in_equality_no= 0; + sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq); + } /* Fix the created equality and AND @@ -3285,8 +3324,8 @@ void restore_prev_sj_state(const table_map remaining_tables, ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest, table_map remaining_tables) { - List_iterator li(sj_nest->nested_join->sj_outer_expr_list); - Item *item; + List_iterator li(sj_nest->nested_join->sj_outer_expr_list); + Item **item; uint i= 0; ulonglong res= 0; while ((item= li++)) @@ -3297,7 +3336,7 @@ ulonglong get_bound_sj_equalities(TABLE_LIST *sj_nest, class and see if there is an element that is bound? (this is an optional feature) */ - if (!(item->used_tables() & remaining_tables)) + if (!(item[0]->used_tables() & remaining_tables)) { res |= 1ULL << i; } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 7f84f35c825..c06c4fcff29 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8128,13 +8128,15 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, bool setup_fields(THD *thd, Item **ref_pointer_array, List &fields, enum_mark_columns mark_used_columns, - List *sum_func_list, bool allow_sum_func) + List *sum_func_list, List *pre_fix, + bool allow_sum_func) { reg2 Item *item; enum_mark_columns save_mark_used_columns= thd->mark_used_columns; nesting_map save_allow_sum_func= thd->lex->allow_sum_func; List_iterator it(fields); bool save_is_item_list_lookup; + bool make_pre_fix= (pre_fix && (pre_fix->elements == 0)); DBUG_ENTER("setup_fields"); DBUG_PRINT("enter", ("ref_pointer_array: %p", ref_pointer_array)); @@ -8181,6 +8183,9 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, thd->lex->current_select->cur_pos_in_select_list= 0; while ((item= it++)) { + if (make_pre_fix) + pre_fix->push_back(item, thd->stmt_arena->mem_root); + if ((!item->fixed && item->fix_fields(thd, it.ref())) || (item= *(it.ref()))->check_cols(1)) { diff --git a/sql/sql_base.h b/sql/sql_base.h index d49554d5473..0cde933afb8 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -216,7 +216,8 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List &fields, List *sum_func_list, uint wild_num); bool setup_fields(THD *thd, Item** ref_pointer_array, List &item, enum_mark_columns mark_used_columns, - List *sum_func_list, bool allow_sum_func); + List *sum_func_list, List *pre_fix, + bool allow_sum_func); void unfix_fields(List &items); bool fill_record(THD *thd, Field **field, List &values, bool ignore_errors, bool use_value); @@ -407,7 +408,7 @@ inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array, bool res; thd->lex->select_lex.no_wrap_view_item= TRUE; res= setup_fields(thd, ref_pointer_array, item, mark_used_columns, - sum_func_list, allow_sum_func); + sum_func_list, NULL, allow_sum_func); thd->lex->select_lex.no_wrap_view_item= FALSE; return res; } diff --git a/sql/sql_do.cc b/sql/sql_do.cc index 4ba887b5ab2..46bdb421b3a 100644 --- a/sql/sql_do.cc +++ b/sql/sql_do.cc @@ -28,7 +28,7 @@ bool mysql_do(THD *thd, List &values) List_iterator li(values); Item *value; DBUG_ENTER("mysql_do"); - if (setup_fields(thd, 0, values, MARK_COLUMNS_NONE, 0, 0)) + if (setup_fields(thd, 0, values, MARK_COLUMNS_NONE, 0, NULL, 0)) DBUG_RETURN(TRUE); while ((value = li++)) value->val_int(); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 70a12faafb5..267a9a6f94e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -262,7 +262,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, if (table_list->is_view()) unfix_fields(fields); - res= setup_fields(thd, 0, fields, MARK_COLUMNS_WRITE, 0, 0); + res= setup_fields(thd, 0, fields, MARK_COLUMNS_WRITE, 0, NULL, 0); /* Restore the current context. */ ctx_state.restore_state(context, table_list); @@ -373,7 +373,7 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list, } /* Check the fields we are going to modify */ - if (setup_fields(thd, 0, update_fields, MARK_COLUMNS_WRITE, 0, 0)) + if (setup_fields(thd, 0, update_fields, MARK_COLUMNS_WRITE, 0, NULL, 0)) return -1; if (insert_table_list->is_view() && @@ -810,7 +810,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter); goto abort; } - if (setup_fields(thd, 0, *values, MARK_COLUMNS_READ, 0, 0)) + if (setup_fields(thd, 0, *values, MARK_COLUMNS_READ, 0, NULL, 0)) goto abort; } its.rewind (); @@ -1452,7 +1452,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, table_list->next_local= 0; context->resolve_in_table_list_only(table_list); - res= (setup_fields(thd, 0, *values, MARK_COLUMNS_READ, 0, 0) || + res= (setup_fields(thd, 0, *values, MARK_COLUMNS_READ, 0, NULL, 0) || check_insert_fields(thd, context->table_list, fields, *values, !insert_into_view, 0, &map)); @@ -1468,7 +1468,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, } if (!res) - res= setup_fields(thd, 0, update_values, MARK_COLUMNS_READ, 0, 0); + res= setup_fields(thd, 0, update_values, MARK_COLUMNS_READ, 0, NULL, 0); if (!res && duplic == DUP_UPDATE) { @@ -3369,7 +3369,7 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) */ lex->current_select= &lex->select_lex; - res= (setup_fields(thd, 0, values, MARK_COLUMNS_READ, 0, 0) || + res= (setup_fields(thd, 0, values, MARK_COLUMNS_READ, 0, NULL, 0) || check_insert_fields(thd, table_list, *fields, values, !insert_into_view, 1, &map)); @@ -3425,7 +3425,7 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) ctx_state.get_first_name_resolution_table(); res= res || setup_fields(thd, 0, *info.update_values, - MARK_COLUMNS_READ, 0, 0); + MARK_COLUMNS_READ, 0, NULL, 0); if (!res) { /* diff --git a/sql/sql_lex.h b/sql/sql_lex.h index d283085886e..3dcf8769c14 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -758,6 +758,7 @@ public: Group_list_ptrs *group_list_ptrs; List item_list; /* list of fields & expressions */ + List pre_fix; /* above list before fix_fields */ List interval_list; bool is_item_list_lookup; /* diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 23865ab8983..5029efa7d68 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -293,15 +293,15 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, Let us also prepare SET clause, altough it is probably empty in this case. */ - if (setup_fields(thd, 0, set_fields, MARK_COLUMNS_WRITE, 0, 0) || - setup_fields(thd, 0, set_values, MARK_COLUMNS_READ, 0, 0)) + if (setup_fields(thd, 0, set_fields, MARK_COLUMNS_WRITE, 0, NULL, 0) || + setup_fields(thd, 0, set_values, MARK_COLUMNS_READ, 0, NULL, 0)) DBUG_RETURN(TRUE); } else { // Part field list /* TODO: use this conds for 'WITH CHECK OPTIONS' */ - if (setup_fields(thd, 0, fields_vars, MARK_COLUMNS_WRITE, 0, 0) || - setup_fields(thd, 0, set_fields, MARK_COLUMNS_WRITE, 0, 0) || + if (setup_fields(thd, 0, fields_vars, MARK_COLUMNS_WRITE, 0, NULL, 0) || + setup_fields(thd, 0, set_fields, MARK_COLUMNS_WRITE, 0, NULL, 0) || check_that_all_fields_are_given_values(thd, table, table_list)) DBUG_RETURN(TRUE); /* @@ -320,7 +320,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } } /* Fix the expressions in SET clause */ - if (setup_fields(thd, 0, set_values, MARK_COLUMNS_READ, 0, 0)) + if (setup_fields(thd, 0, set_values, MARK_COLUMNS_READ, 0, NULL, 0)) DBUG_RETURN(TRUE); } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 094677e150d..851e4f7b8ab 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1307,7 +1307,7 @@ static bool mysql_test_insert(Prepared_statement *stmt, my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter); goto error; } - if (setup_fields(thd, 0, *values, MARK_COLUMNS_NONE, 0, 0)) + if (setup_fields(thd, 0, *values, MARK_COLUMNS_NONE, 0, NULL, 0)) goto error; } } @@ -1397,7 +1397,7 @@ static int mysql_test_update(Prepared_statement *stmt, table_list->register_want_access(want_privilege); #endif thd->lex->select_lex.no_wrap_view_item= TRUE; - res= setup_fields(thd, 0, select->item_list, MARK_COLUMNS_READ, 0, 0); + res= setup_fields(thd, 0, select->item_list, MARK_COLUMNS_READ, 0, NULL, 0); thd->lex->select_lex.no_wrap_view_item= FALSE; if (res) goto error; @@ -1408,7 +1408,8 @@ static int mysql_test_update(Prepared_statement *stmt, (SELECT_ACL & ~table_list->table->grant.privilege); table_list->register_want_access(SELECT_ACL); #endif - if (setup_fields(thd, 0, stmt->lex->value_list, MARK_COLUMNS_NONE, 0, 0) || + if (setup_fields(thd, 0, stmt->lex->value_list, MARK_COLUMNS_NONE, 0, NULL, + 0) || check_unique_table(thd, table_list)) goto error; /* TODO: here we should send types of placeholders to the client. */ @@ -1575,7 +1576,7 @@ static bool mysql_test_do_fields(Prepared_statement *stmt, if (open_normal_and_derived_tables(thd, tables, MYSQL_OPEN_FORCE_SHARED_MDL, DT_PREPARE | DT_CREATE)) DBUG_RETURN(TRUE); - DBUG_RETURN(setup_fields(thd, 0, *values, MARK_COLUMNS_NONE, 0, 0)); + DBUG_RETURN(setup_fields(thd, 0, *values, MARK_COLUMNS_NONE, 0, NULL, 0)); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6e67bb11015..c7f547edbc0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -724,7 +724,7 @@ JOIN::prepare(Item ***rref_pointer_array, wild_num)) || select_lex->setup_ref_array(thd, real_og_num) || setup_fields(thd, (*rref_pointer_array), fields_list, MARK_COLUMNS_READ, - &all_fields, 1) || + &all_fields, &select_lex->pre_fix, 1) || setup_without_group(thd, (*rref_pointer_array), tables_list, select_lex->leaf_tables, fields_list, all_fields, &conds, order, group_list, diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 060952a589d..ede38468513 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -361,7 +361,7 @@ int mysql_update(THD *thd, table_list->grant.want_privilege= table->grant.want_privilege= (SELECT_ACL & ~table->grant.privilege); #endif - if (setup_fields(thd, 0, values, MARK_COLUMNS_READ, 0, 0)) + if (setup_fields(thd, 0, values, MARK_COLUMNS_READ, 0, NULL, 0)) { free_underlaid_joins(thd, select_lex); DBUG_RETURN(1); /* purecov: inspected */ @@ -1521,7 +1521,7 @@ int multi_update::prepare(List ¬_used_values, reference tables */ - int error= setup_fields(thd, 0, *values, MARK_COLUMNS_READ, 0, 0); + int error= setup_fields(thd, 0, *values, MARK_COLUMNS_READ, 0, NULL, 0); ti.rewind(); while ((table_ref= ti++)) diff --git a/sql/table.h b/sql/table.h index dde01a85d77..c981243f28c 100644 --- a/sql/table.h +++ b/sql/table.h @@ -33,6 +33,7 @@ /* Structs that defines the TABLE */ class Item; /* Needed by ORDER */ +typedef Item (*Item_ptr); class Item_subselect; class Item_field; class GRANT_TABLE; @@ -2348,7 +2349,7 @@ typedef struct st_nested_join table_map sj_depends_on; /* Outer non-trivially correlated tables */ table_map sj_corr_tables; - List sj_outer_expr_list; + List sj_outer_expr_list; /** True if this join nest node is completely covered by the query execution plan. This means two things. From 3b7aa3017b65dcf11d33617e954e1cb471703582 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 13 Oct 2017 18:41:38 +0200 Subject: [PATCH 23/30] Cleanup usage of DBUG_ASSERTS. --- sql/item.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/item.cc b/sql/item.cc index 3100a4e3408..a8913e97fe9 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -8075,7 +8075,6 @@ bool Item_direct_view_ref::send(Protocol *protocol, String *buffer) bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) { - DBUG_ASSERT(1); /* view fild reference must be defined */ DBUG_ASSERT(*ref); /* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */ @@ -9959,7 +9958,7 @@ void Item_direct_view_ref::update_used_tables() table_map Item_direct_view_ref::used_tables() const { - DBUG_ASSERT(null_ref_table); + DBUG_ASSERT(fixed); if (get_depended_from()) return OUTER_REF_TABLE_BIT; From d76f5774fe70c51577cfbfdddcbfb3309d51f06e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 16 Sep 2017 14:52:42 +0200 Subject: [PATCH 24/30] MDEV-13459 Warnings, when compiling with gcc-7.x mostly caused by -Wimplicit-fallthrough --- client/mysql.cc | 2 +- client/mysqldump.c | 1 + extra/my_print_defaults.c | 21 ++++--- extra/replace.c | 1 + mysys/my_new.cc | 10 +++ plugin/handler_socket/CMakeLists.txt | 6 ++ sql-common/client.c | 1 + sql/events.cc | 8 ++- sql/field.cc | 2 +- sql/ha_partition.cc | 1 + sql/item.cc | 2 +- sql/item_func.cc | 2 + sql/item_strfunc.cc | 4 +- sql/log.cc | 5 ++ sql/log_event.cc | 15 ----- sql/opt_sum.cc | 1 + sql/partition_info.cc | 2 - sql/sp_head.cc | 2 +- sql/sql_admin.cc | 1 - sql/sql_lex.cc | 4 +- sql/sql_parse.cc | 6 +- sql/sql_partition.cc | 2 +- sql/sql_plugin.cc | 74 +++++++++++------------ sql/sql_prepare.cc | 1 + sql/sql_repl.cc | 1 + sql/sql_show.cc | 1 + sql/sql_table.cc | 2 +- sql/sql_yacc.yy | 10 +-- storage/federated/ha_federated.cc | 3 + storage/federatedx/federatedx_io_mysql.cc | 9 ++- storage/federatedx/ha_federatedx.cc | 2 + storage/heap/hp_create.c | 2 +- storage/heap/hp_extra.c | 1 + storage/innobase/handler/ha_innodb.cc | 5 +- storage/innobase/include/data0type.ic | 2 +- storage/innobase/include/page0zip.ic | 2 +- storage/innobase/row/row0mysql.c | 5 +- storage/innobase/row/row0purge.c | 4 +- storage/innobase/row/row0sel.c | 1 + storage/maria/ma_extra.c | 3 +- storage/maria/ma_key_recover.c | 1 + storage/maria/ma_recovery.c | 2 +- storage/myisam/mi_extra.c | 3 +- storage/sphinx/ha_sphinx.cc | 12 ++-- storage/tokudb/CMakeLists.txt | 1 + storage/xtradb/handler/ha_innodb.cc | 5 +- storage/xtradb/include/data0type.ic | 2 +- storage/xtradb/include/page0zip.ic | 2 +- storage/xtradb/row/row0mysql.c | 4 +- storage/xtradb/row/row0purge.c | 4 +- storage/xtradb/row/row0sel.c | 1 + strings/ctype-utf8.c | 17 ++++-- strings/dtoa.c | 13 ++-- 53 files changed, 170 insertions(+), 124 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 9c76e30d96f..2a56caf23ef 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1080,7 +1080,7 @@ static ulong start_timer(void); static void end_timer(ulong start_time,char *buff); static void mysql_end_timer(ulong start_time,char *buff); static void nice_time(double sec,char *buff,bool part_second); -extern "C" sig_handler mysql_end(int sig); +extern "C" sig_handler mysql_end(int sig) __attribute__ ((noreturn)); extern "C" sig_handler handle_sigint(int sig); #if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL) static sig_handler window_resize(int sig); diff --git a/client/mysqldump.c b/client/mysqldump.c index 2e3270a2fed..4e611ed5cb2 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2012,6 +2012,7 @@ static void print_xml_comment(FILE *xml_file, size_t len, case '-': if (*(comment_string + 1) == '-') /* Only one hyphen allowed. */ break; + /* fall through */ default: fputc(*comment_string, xml_file); break; diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 7558d6d00ae..4690b29e8a5 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -97,12 +97,16 @@ static struct my_option my_long_options[] = }; -static void usage(my_bool version) +static void version() { - printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, - MACHINE_TYPE); - if (version) - return; + printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); +} + + +static void usage() __attribute__ ((noreturn)); +static void usage() +{ + version(); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Prints all arguments that is give to some program using the default files"); printf("Usage: %s [OPTIONS] [groups]\n", my_progname); @@ -126,12 +130,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), exit(0); case 'I': case '?': - usage(0); + usage(); case 'v': verbose++; break; case 'V': - usage(1); + version(); + /* fall through */ case '#': DBUG_PUSH(argument ? argument : default_dbug_option); break; @@ -179,7 +184,7 @@ int main(int argc, char **argv) nargs+= array_elements(mysqld_groups); if (nargs < 2) - usage(0); + usage(); load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME)); if (!load_default_groups) diff --git a/extra/replace.c b/extra/replace.c index 56cf02f2002..2ad4979c09e 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -174,6 +174,7 @@ register char **argv[]; break; case 'V': version=1; + /* fall through */ case 'I': case '?': help=1; /* Help text written */ diff --git a/mysys/my_new.cc b/mysys/my_new.cc index 4266452da43..a401ccff135 100644 --- a/mysys/my_new.cc +++ b/mysys/my_new.cc @@ -47,6 +47,11 @@ void* operator new[](std::size_t sz, const std::nothrow_t&) throw() return (void *) my_malloc (sz ? sz : 1, MYF(0)); } +void operator delete (void *ptr, std::size_t) +{ + my_free(ptr); +} + void operator delete (void *ptr) { my_free(ptr); @@ -57,6 +62,11 @@ void operator delete[] (void *ptr) throw () my_free(ptr); } +void operator delete[] (void *ptr, std::size_t) throw () +{ + my_free(ptr); +} + void operator delete(void* ptr, const std::nothrow_t&) throw() { my_free(ptr); diff --git a/plugin/handler_socket/CMakeLists.txt b/plugin/handler_socket/CMakeLists.txt index 358139eda1e..a0cac0015d0 100644 --- a/plugin/handler_socket/CMakeLists.txt +++ b/plugin/handler_socket/CMakeLists.txt @@ -10,6 +10,12 @@ IF(CMAKE_COMPILER_IS_GNUCXX) STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) ENDIF() +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(" -Wdeprecated-declarations" HAVE_CXX_WDEPRECATED_DECLARATIONS) +IF (HAVE_CXX_WDEPRECATED_DECLARATIONS) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +ENDIF() + INCLUDE_DIRECTORIES(libhsclient) # Handlersocket client library. We do not distribute it, diff --git a/sql-common/client.c b/sql-common/client.c index e0412fca6bc..7d92f71d69f 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1276,6 +1276,7 @@ void mysql_read_default_options(struct st_mysql_options *options, break; case OPT_pipe: options->protocol = MYSQL_PROTOCOL_PIPE; + break; case OPT_connect_timeout: case OPT_timeout: if (opt_arg) diff --git a/sql/events.cc b/sql/events.cc index 763c75e77b0..008b6223702 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -185,8 +185,8 @@ common_1_lev_code: expr= tmp_expr - (tmp_expr/60)*60; /* the code after the switch will finish */ - } break; + } case INTERVAL_HOUR_SECOND: { ulonglong tmp_expr= expr; @@ -202,8 +202,8 @@ common_1_lev_code: expr= tmp_expr - (tmp_expr/60)*60; /* the code after the switch will finish */ - } break; + } case INTERVAL_DAY_SECOND: { ulonglong tmp_expr= expr; @@ -225,8 +225,8 @@ common_1_lev_code: expr= tmp_expr - (tmp_expr/60)*60; /* the code after the switch will finish */ - } break; + } case INTERVAL_DAY_MICROSECOND: case INTERVAL_HOUR_MICROSECOND: case INTERVAL_MINUTE_MICROSECOND: @@ -240,6 +240,8 @@ common_1_lev_code: break; case INTERVAL_WEEK: expr/= 7; + close_quote= FALSE; + break; default: close_quote= FALSE; break; diff --git a/sql/field.cc b/sql/field.cc index 716d522a196..a2e0caaa50d 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9218,7 +9218,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, case MYSQL_TYPE_DATE: /* We don't support creation of MYSQL_TYPE_DATE anymore */ sql_type= MYSQL_TYPE_NEWDATE; - /* fall trough */ + /* fall through */ case MYSQL_TYPE_NEWDATE: length= MAX_DATE_WIDTH; break; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e048dbad5e6..b2c2140d4dc 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -7331,6 +7331,7 @@ void ha_partition::print_error(int error, myf errflag) m_err_rec= NULL; DBUG_VOID_RETURN; } + /* fall through */ default: { if (!(thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION)) diff --git a/sql/item.cc b/sql/item.cc index a8913e97fe9..3c633ddc9ca 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6004,7 +6004,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length) collation.collation); break; } - /* Fall through to make_string_field() */ + /* fall through */ case MYSQL_TYPE_ENUM: case MYSQL_TYPE_SET: case MYSQL_TYPE_VAR_STRING: diff --git a/sql/item_func.cc b/sql/item_func.cc index cfccd66ea8a..00006a25a8d 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -863,6 +863,7 @@ void Item_func_num1::fix_length_and_dec() break; case TIME_RESULT: cached_result_type= DECIMAL_RESULT; + /* fall through */ case DECIMAL_RESULT: decimals= args[0]->decimal_scale(); // Do not preserve NOT_FIXED_DEC max_length= args[0]->max_length; @@ -2038,6 +2039,7 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value) return decimal_value; case E_DEC_DIV_ZERO: signal_divide_by_null(); + /* fall through */ default: null_value= 1; return 0; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 756ab5152ca..939e518e386 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4430,7 +4430,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) goto null; case DYN_COL_INT: signed_value= 1; // For error message - /* fall_trough */ + /* fall through */ case DYN_COL_UINT: if (signed_value || val.x.ulong_value <= LONGLONG_MAX) { @@ -4443,7 +4443,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) } /* let double_to_datetime_with_warn() issue the warning message */ val.x.double_value= static_cast(ULONGLONG_MAX); - /* fall_trough */ + /* fall through */ case DYN_COL_DOUBLE: if (double_to_datetime_with_warn(val.x.double_value, ltime, fuzzy_date, 0 /* TODO */)) diff --git a/sql/log.cc b/sql/log.cc index f8c256e645f..5b4ba87ef52 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -7261,8 +7261,10 @@ void TC_LOG_MMAP::close() mysql_cond_destroy(&COND_pool); mysql_cond_destroy(&COND_active); mysql_cond_destroy(&COND_queue_busy); + /* fall through */ case 5: data[0]='A'; // garble the first (signature) byte, in case mysql_file_delete fails + /* fall through */ case 4: for (i=0; i < npages; i++) { @@ -7271,10 +7273,13 @@ void TC_LOG_MMAP::close() mysql_mutex_destroy(&pages[i].lock); mysql_cond_destroy(&pages[i].cond); } + /* fall through */ case 3: my_free(pages); + /* fall through */ case 2: my_munmap((char*)data, (size_t)file_length); + /* fall through */ case 1: mysql_file_close(fd, MYF(0)); } diff --git a/sql/log_event.cc b/sql/log_event.cc index d5b5b5a4870..18e4cfbf187 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6437,21 +6437,6 @@ User_var_log_event(const char* buf, uint event_len, we keep the flags set to UNDEF_F. */ uint bytes_read= ((val + val_len) - start); -#ifndef DBUG_OFF - bool old_pre_checksum_fd= description_event->is_version_before_checksum( - &description_event->server_version_split); -#endif - DBUG_ASSERT((bytes_read == data_written - - (old_pre_checksum_fd || - (description_event->checksum_alg == - BINLOG_CHECKSUM_ALG_OFF)) ? - 0 : BINLOG_CHECKSUM_LEN) - || - (bytes_read == data_written -1 - - (old_pre_checksum_fd || - (description_event->checksum_alg == - BINLOG_CHECKSUM_ALG_OFF)) ? - 0 : BINLOG_CHECKSUM_LEN)); if ((data_written - bytes_read) > 0) { flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 1a8c6be5f41..f717be5ba3f 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -1047,6 +1047,7 @@ static int maxmin_in_range(bool max_fl, Field* field, COND *cond) case Item_func::LT_FUNC: case Item_func::LE_FUNC: less_fl= 1; + /* fall through */ case Item_func::GT_FUNC: case Item_func::GE_FUNC: { diff --git a/sql/partition_info.cc b/sql/partition_info.cc index d8b901701cb..512bf296135 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -34,8 +34,6 @@ partition_info *partition_info::get_clone() { - if (!this) - return 0; List_iterator part_it(partitions); partition_element *part; partition_info *clone= new partition_info(); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 69364eaa43f..14a57914560 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -139,7 +139,7 @@ sp_get_item_value(THD *thd, Item *item, String *str) case DECIMAL_RESULT: if (item->field_type() != MYSQL_TYPE_BIT) return item->val_str(str); - else {/* Bit type is handled as binary string */} + /* fall through */ case STRING_RESULT: { String *result= item->val_str(str); diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 55effcd7002..7cddf50a896 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -54,7 +54,6 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list) if (thd->stmt_da->is_ok()) thd->stmt_da->reset_diagnostics_area(); table_list->table= NULL; - result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK; DBUG_RETURN(result_code); } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6611fd43876..6f94f1fbe63 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1147,12 +1147,14 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd) state= MY_LEX_HEX_NUMBER; break; } + /* fall through */ case MY_LEX_IDENT_OR_BIN: if (lip->yyPeek() == '\'') { // Found b'bin-number' state= MY_LEX_BIN_NUMBER; break; } + /* fall through */ case MY_LEX_IDENT: const char *start; #if defined(USE_MB) && defined(USE_MB_IDENT) @@ -1499,7 +1501,7 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd) state= MY_LEX_USER_VARIABLE_DELIMITER; break; } - /* " used for strings */ + /* fall through */ /* " used for strings */ case MY_LEX_STRING: // Incomplete text string if (!(yylval->lex_str.str = get_text(lip, 1, 1))) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ba0520de4bb..d003a13ae09 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2481,7 +2481,7 @@ case SQLCOM_PREPARE: #ifdef WITH_PARTITION_STORAGE_ENGINE { partition_info *part_info= thd->lex->part_info; - if (part_info && !(part_info= thd->lex->part_info->get_clone())) + if (part_info && !(part_info= part_info->get_clone())) { res= -1; goto end_with_restore_list; @@ -2850,8 +2850,8 @@ end_with_restore_list: /* mysql_update return 2 if we need to switch to multi-update */ if (up_result != 2) break; - /* Fall through */ } + /* fall through */ case SQLCOM_UPDATE_MULTI: { DBUG_ASSERT(first_table == all_tables && first_table != 0); @@ -2961,6 +2961,7 @@ end_with_restore_list: DBUG_PRINT("debug", ("Just after generate_incident()")); } #endif + /* fall through */ case SQLCOM_INSERT: { DBUG_ASSERT(first_table == all_tables && first_table != 0); @@ -3698,6 +3699,7 @@ end_with_restore_list: initialize this variable because RESET shares the same code as FLUSH */ lex->no_write_to_binlog= 1; + /* fall through */ case SQLCOM_FLUSH: { int write_to_binlog; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 0d9f6e6a1f5..bf34d328dc5 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4640,7 +4640,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, thd->work_part_info= thd->lex->part_info; if (thd->work_part_info && - !(thd->work_part_info= thd->lex->part_info->get_clone())) + !(thd->work_part_info= thd->work_part_info->get_clone())) DBUG_RETURN(TRUE); /* ALTER_ADMIN_PARTITION is handled in mysql_admin_table */ diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 9eecd6a1345..d1e855e272e 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1078,42 +1078,42 @@ static bool plugin_add(MEM_ROOT *tmp_root, if (!name->str && plugin_find_internal(&tmp.name, MYSQL_ANY_PLUGIN)) continue; // already installed - struct st_plugin_int *tmp_plugin_ptr; - if (*(int*)plugin->info < - min_plugin_info_interface_version[plugin->type] || - ((*(int*)plugin->info) >> 8) > - (cur_plugin_info_interface_version[plugin->type] >> 8)) - { - char buf[256]; - strxnmov(buf, sizeof(buf) - 1, "API version for ", - plugin_type_names[plugin->type].str, - " plugin ", tmp.name.str, - " not supported by this version of the server", NullS); - report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, ENOEXEC, buf); - goto err; - } - if (plugin_maturity_map[plugin->maturity] < plugin_maturity) - { - char buf[256]; - strxnmov(buf, sizeof(buf) - 1, "Loading of ", - plugin_maturity_names[plugin->maturity], - " plugin ", tmp.name.str, - " is prohibited by --plugin-maturity=", - plugin_maturity_names[plugin_maturity], - NullS); - report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, EPERM, buf); - goto err; - } - tmp.plugin= plugin; - tmp.ref_count= 0; - tmp.state= PLUGIN_IS_UNINITIALIZED; - tmp.load_option= PLUGIN_ON; + struct st_plugin_int *tmp_plugin_ptr; + if (*(int*)plugin->info < + min_plugin_info_interface_version[plugin->type] || + ((*(int*)plugin->info) >> 8) > + (cur_plugin_info_interface_version[plugin->type] >> 8)) + { + char buf[256]; + strxnmov(buf, sizeof(buf) - 1, "API version for ", + plugin_type_names[plugin->type].str, + " plugin ", tmp.name.str, + " not supported by this version of the server", NullS); + report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, ENOEXEC, buf); + goto err; + } + if (plugin_maturity_map[plugin->maturity] < plugin_maturity) + { + char buf[256]; + strxnmov(buf, sizeof(buf) - 1, "Loading of ", + plugin_maturity_names[plugin->maturity], + " plugin ", tmp.name.str, + " is prohibited by --plugin-maturity=", + plugin_maturity_names[plugin_maturity], + NullS); + report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, EPERM, buf); + goto err; + } + tmp.plugin= plugin; + tmp.ref_count= 0; + tmp.state= PLUGIN_IS_UNINITIALIZED; + tmp.load_option= PLUGIN_ON; - if (!(tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) - goto err; - if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) - tmp_plugin_ptr->state= PLUGIN_IS_FREED; - init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); + if (!(tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) + goto err; + if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) + tmp_plugin_ptr->state= PLUGIN_IS_FREED; + init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); if (name->str) DBUG_RETURN(FALSE); // all done @@ -1822,10 +1822,10 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list) case '\0': list= NULL; /* terminate the loop */ /* fall through */ + case ';': #ifndef __WIN__ case ':': /* can't use this as delimiter as it may be drive letter */ #endif - case ';': str->str[str->length]= '\0'; if (str == &name) // load all plugins in named module { @@ -1863,6 +1863,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list) str->str= p; continue; } + /* fall through */ default: str->length++; continue; @@ -3947,4 +3948,3 @@ void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root) insert_dynamic(options, (uchar*) opt); } } - diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 851e4f7b8ab..faaeaf51573 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2075,6 +2075,7 @@ static bool check_prepared_statement(Prepared_statement *stmt) if (res != 2) break; + /* fall through */ case SQLCOM_UPDATE_MULTI: res= mysql_test_multiupdate(stmt, tables, res == 2); break; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 871cb27f0d0..ca6e8d15e7a 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1139,6 +1139,7 @@ impossible position"; loop_breaker = (flags & BINLOG_DUMP_NON_BLOCK); break; } + /* fall through */ default: errmsg = "could not find next log"; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 512548b1d51..8789f0c9f24 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -931,6 +931,7 @@ public: is_handled= FALSE; break; } + /* fall through */ case ER_COLUMNACCESS_DENIED_ERROR: case ER_VIEW_NO_EXPLAIN: /* Error was anonymized, ignore all the same. */ case ER_PROCACCESS_DENIED_ERROR: diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 6ab39d7f8c6..e6490876352 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5504,7 +5504,7 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled, case LEAVE_AS_IS: if (!indexes_were_disabled) break; - /* fall-through: disabled indexes */ + /* fall-through */ case DISABLE: error= table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 35c7203ca0d..4805cd4c66a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4212,15 +4212,11 @@ size_number: switch (end_ptr[0]) { case 'g': - case 'G': - text_shift_number+=10; + case 'G': text_shift_number+=30; break; case 'm': - case 'M': - text_shift_number+=10; + case 'M': text_shift_number+=20; break; case 'k': - case 'K': - text_shift_number+=10; - break; + case 'K': text_shift_number+=10; break; default: { my_error(ER_WRONG_SIZE_NUMBER, MYF(0)); diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index adf4f0f4db2..8680c3aac25 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1421,6 +1421,7 @@ bool ha_federated::create_where_from_key(String *to, } break; } + /* fall through */ case HA_READ_KEY_OR_NEXT: DBUG_PRINT("info", ("federated HA_READ_KEY_OR_NEXT %d", i)); if (emit_key_part_name(&tmp, key_part) || @@ -1440,6 +1441,7 @@ bool ha_federated::create_where_from_key(String *to, goto err; break; } + /* fall through */ case HA_READ_KEY_OR_PREV: DBUG_PRINT("info", ("federated HA_READ_KEY_OR_PREV %d", i)); if (emit_key_part_name(&tmp, key_part) || @@ -2973,6 +2975,7 @@ int ha_federated::extra(ha_extra_function operation) break; case HA_EXTRA_PREPARE_FOR_DROP: table_will_be_deleted = TRUE; + break; default: /* do nothing */ DBUG_PRINT("info",("unhandled operation: %d", (uint) operation)); diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc index a2eaa345a18..ef3b1388200 100644 --- a/storage/federatedx/federatedx_io_mysql.cc +++ b/storage/federatedx/federatedx_io_mysql.cc @@ -263,9 +263,8 @@ ulong federatedx_io_mysql::savepoint_release(ulong sp) savept= dynamic_element(&savepoints, savepoints.elements - 1, SAVEPT *); if (savept->level < sp) break; - if ((savept->flags & (SAVEPOINT_REALIZED | - SAVEPOINT_RESTRICT)) == SAVEPOINT_REALIZED) - last= savept; + if ((savept->flags & (SAVEPOINT_REALIZED | SAVEPOINT_RESTRICT)) == SAVEPOINT_REALIZED) + last= savept; savepoints.elements--; } @@ -291,8 +290,8 @@ ulong federatedx_io_mysql::savepoint_rollback(ulong sp) while (savepoints.elements) { savept= dynamic_element(&savepoints, savepoints.elements - 1, SAVEPT *); - if (savept->level <= sp) - break; + if (savept->level <= sp) + break; savepoints.elements--; } diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index c9b07a8f3c3..bafae614fab 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1340,6 +1340,7 @@ bool ha_federatedx::create_where_from_key(String *to, } break; } + /* fall through */ case HA_READ_KEY_OR_NEXT: DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_NEXT %d", i)); if (emit_key_part_name(&tmp, key_part) || @@ -1359,6 +1360,7 @@ bool ha_federatedx::create_where_from_key(String *to, goto err; break; } + /* fall through */ case HA_READ_KEY_OR_PREV: DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_PREV %d", i)); if (emit_key_part_name(&tmp, key_part) || diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index 2b705b0e3d7..0b5dc841ada 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -94,7 +94,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, case HA_KEYTYPE_VARBINARY1: /* Case-insensitiveness is handled in coll->hash_sort */ keyinfo->seg[j].type= HA_KEYTYPE_VARTEXT1; - /* fall_through */ + /* fall through */ case HA_KEYTYPE_VARTEXT1: keyinfo->flag|= HA_VAR_LENGTH_KEY; length+= 2; diff --git a/storage/heap/hp_extra.c b/storage/heap/hp_extra.c index c83efd5af61..9a19f818d3b 100644 --- a/storage/heap/hp_extra.c +++ b/storage/heap/hp_extra.c @@ -34,6 +34,7 @@ int heap_extra(register HP_INFO *info, enum ha_extra_function function) switch (function) { case HA_EXTRA_RESET_STATE: heap_reset(info); + /* fall through */ case HA_EXTRA_NO_READCHECK: info->opt_flag&= ~READ_CHECK_USED; /* No readcheck */ break; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 780f3a6f82f..3aabfc319c6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5129,7 +5129,7 @@ ha_innobase::innobase_lock_autoinc(void) break; } } - /* Fall through to old style locking. */ + /* fall through */ case AUTOINC_OLD_STYLE_LOCKING: error = row_lock_table_autoinc_for_mysql(prebuilt); @@ -7080,7 +7080,7 @@ create_options_are_valid( case ROW_TYPE_DYNAMIC: CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE; CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE; - /* fall through since dynamic also shuns KBS */ + /* fall through */ /* since dynamic also shuns KBS */ case ROW_TYPE_COMPACT: case ROW_TYPE_REDUNDANT: if (kbs_specified) { @@ -7326,6 +7326,7 @@ ha_innobase::create( thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, "InnoDB: assuming ROW_FORMAT=COMPACT."); + /* fall through */ case ROW_TYPE_DEFAULT: case ROW_TYPE_COMPACT: flags = DICT_TF_COMPACT; diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index 410970ac50e..515b6b249ef 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -477,7 +477,7 @@ dtype_get_fixed_size_low( #else /* !UNIV_HOTBACKUP */ return(len); #endif /* !UNIV_HOTBACKUP */ - /* fall through for variable-length charsets */ + /* fall through */ /* for variable-length charsets */ case DATA_VARCHAR: case DATA_BINARY: case DATA_DECIMAL: diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic index e26fa3e3d94..a2fa13c94df 100644 --- a/storage/innobase/include/page0zip.ic +++ b/storage/innobase/include/page0zip.ic @@ -170,7 +170,7 @@ page_zip_rec_needs_ext( ignored if zip_size == 0 */ ulint zip_size) /*!< in: compressed page size in bytes, or 0 */ { - ut_ad(rec_size > comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES); + ut_ad(rec_size > (comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES)); ut_ad(ut_is_2pow(zip_size)); ut_ad(comp || !zip_size); diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 6206bef6b56..8804e2c4e03 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -3495,7 +3495,7 @@ check_next_foreign: row_mysql_handle_errors(&err, trx, NULL, NULL); - /* Fall through to raise error */ + /* fall through */ default: /* No other possible error returns */ @@ -4315,7 +4315,8 @@ loop: fputs(" InnoDB: Warning: CHECK TABLE on ", stderr); dict_index_name_print(stderr, prebuilt->trx, index); fprintf(stderr, " returned %lu\n", ret); - /* fall through (this error is ignored by CHECK TABLE) */ + /* this error is ignored by CHECK TABLE */ + /* fall through */ case DB_END_OF_INDEX: func_exit: mem_free(buf); diff --git a/storage/innobase/row/row0purge.c b/storage/innobase/row/row0purge.c index 5f3e4175544..7b25612ba4b 100644 --- a/storage/innobase/row/row0purge.c +++ b/storage/innobase/row/row0purge.c @@ -407,8 +407,8 @@ row_purge_remove_sec_if_poss_leaf( goto func_exit; } } - /* fall through (the index entry is still needed, - or the deletion succeeded) */ + /* the index entry is still needed, or the deletion succeeded */ + /* fall through */ case ROW_NOT_DELETED_REF: /* The index entry is still needed. */ case ROW_BUFFERED: diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index e027a382cee..f5f8153e116 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -2675,6 +2675,7 @@ row_sel_field_store_in_mysql_format( case DATA_SYS: /* These column types should never be shipped to MySQL. */ ut_ad(0); + /* fall through */ case DATA_CHAR: case DATA_FIXBINARY: diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index 0847f3c729c..3ee70059e6f 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -157,6 +157,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, if (info->s->data_file_type != DYNAMIC_RECORD) break; /* Remove read/write cache if dynamic rows */ + /* fall through */ case HA_EXTRA_NO_CACHE: if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) { @@ -313,7 +314,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, share->state.open_count= 1; share->changed= 1; _ma_mark_file_changed_now(share); - /* Fall trough */ + /* fall through */ case HA_EXTRA_PREPARE_FOR_RENAME: { my_bool do_flush= test(function != HA_EXTRA_PREPARE_FOR_DROP); diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c index 502ac2b8809..48f01b8f8dd 100644 --- a/storage/maria/ma_key_recover.c +++ b/storage/maria/ma_key_recover.c @@ -1169,6 +1169,7 @@ uint _ma_apply_redo_index(MARIA_HA *info, goto err; } page_length= page.size; + break; } case KEY_OP_NONE: default: diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index b2e8705b15e..75a8f4f4559 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -3059,7 +3059,7 @@ static MARIA_HA *get_MARIA_HA_from_REDO_record(const case LOGREC_REDO_INDEX: case LOGREC_REDO_INDEX_FREE_PAGE: index_page_redo_entry= 1; - /* Fall trough*/ + /* fall through*/ case LOGREC_REDO_INSERT_ROW_HEAD: case LOGREC_REDO_INSERT_ROW_TAIL: case LOGREC_REDO_PURGE_ROW_HEAD: diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index dab1f66ed6d..9c5c1ad0c0d 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -150,6 +150,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) if (info->s->data_file_type != DYNAMIC_RECORD) break; /* Remove read/write cache if dynamic rows */ + /* fall through */ case HA_EXTRA_NO_CACHE: if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) { @@ -262,7 +263,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) //share->deleting= TRUE; share->global_changed= FALSE; /* force writing changed flag */ _mi_mark_file_changed(info); - /* Fall trough */ + /* fall through */ case HA_EXTRA_PREPARE_FOR_RENAME: mysql_mutex_lock(&THR_LOCK_myisam); share->last_version= 0L; /* Impossible version */ diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 9edf6ea6570..b7a333c1715 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -1661,13 +1661,16 @@ bool CSphSEQuery::ParseField ( char * sField ) char * sLat = sValue; char * p = sValue; - if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0'; + if (!( p = strchr ( p, ',' ) )) break; + *p++ = '\0'; char * sLong = p; - if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0'; + if (!( p = strchr ( p, ',' ) )) break; + *p++ = '\0'; char * sLatVal = p; - if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0'; + if (!( p = strchr ( p, ',' ) )) break; + *p++ = '\0'; char * sLongVal = p; m_sGeoLatAttr = chop(sLat); @@ -1736,7 +1739,8 @@ bool CSphSEQuery::ParseField ( char * sField ) while ( sRest ) { char * sId = sRest; - if (!( sRest = strchr ( sRest, ':' ) )) break; *sRest++ = '\0'; + if (!( sRest = strchr ( sRest, ':' ) )) break; + *sRest++ = '\0'; if (!( sRest - sId )) break; char * sValue = sRest; diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index 2052d448a43..ab6bb0a8504 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -100,6 +100,7 @@ endmacro(append_cflags_if_supported) set_cflags_if_supported(-Wno-missing-field-initializers) append_cflags_if_supported(-Wno-vla) +append_cflags_if_supported(-Wno-implicit-fallthrough) ADD_SUBDIRECTORY(ft-index) diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 66fcc2799bb..00f345d4bc1 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -6144,7 +6144,7 @@ ha_innobase::innobase_lock_autoinc(void) break; } } - /* Fall through to old style locking. */ + /* fall through */ case AUTOINC_OLD_STYLE_LOCKING: error = row_lock_table_autoinc_for_mysql(prebuilt); @@ -8190,7 +8190,7 @@ create_options_are_valid( case ROW_TYPE_DYNAMIC: CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE; CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE; - /* fall through since dynamic also shuns KBS */ + /* fall through */ /* since dynamic also shuns KBS */ case ROW_TYPE_COMPACT: case ROW_TYPE_REDUNDANT: if (kbs_specified) { @@ -8436,6 +8436,7 @@ ha_innobase::create( thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, "InnoDB: assuming ROW_FORMAT=COMPACT."); + /* fall through */ case ROW_TYPE_DEFAULT: case ROW_TYPE_COMPACT: flags = DICT_TF_COMPACT; diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic index 410970ac50e..5848e5d6548 100644 --- a/storage/xtradb/include/data0type.ic +++ b/storage/xtradb/include/data0type.ic @@ -477,7 +477,7 @@ dtype_get_fixed_size_low( #else /* !UNIV_HOTBACKUP */ return(len); #endif /* !UNIV_HOTBACKUP */ - /* fall through for variable-length charsets */ + /* fall through */ case DATA_VARCHAR: case DATA_BINARY: case DATA_DECIMAL: diff --git a/storage/xtradb/include/page0zip.ic b/storage/xtradb/include/page0zip.ic index e26fa3e3d94..a2fa13c94df 100644 --- a/storage/xtradb/include/page0zip.ic +++ b/storage/xtradb/include/page0zip.ic @@ -170,7 +170,7 @@ page_zip_rec_needs_ext( ignored if zip_size == 0 */ ulint zip_size) /*!< in: compressed page size in bytes, or 0 */ { - ut_ad(rec_size > comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES); + ut_ad(rec_size > (comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES)); ut_ad(ut_is_2pow(zip_size)); ut_ad(comp || !zip_size); diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c index 0182752132a..5b01adf7c82 100644 --- a/storage/xtradb/row/row0mysql.c +++ b/storage/xtradb/row/row0mysql.c @@ -3635,7 +3635,7 @@ check_next_foreign: row_mysql_handle_errors(&err, trx, NULL, NULL); - /* Fall through to raise error */ + /* fall through */ /* to raise error */ default: /* No other possible error returns */ @@ -4455,7 +4455,7 @@ loop: fputs(" InnoDB: Warning: CHECK TABLE on ", stderr); dict_index_name_print(stderr, prebuilt->trx, index); fprintf(stderr, " returned %lu\n", ret); - /* fall through (this error is ignored by CHECK TABLE) */ + /* fall through */ /* this error is ignored by CHECK TABLE */ case DB_END_OF_INDEX: func_exit: mem_free(buf); diff --git a/storage/xtradb/row/row0purge.c b/storage/xtradb/row/row0purge.c index 4186da884b6..77d60edb71f 100644 --- a/storage/xtradb/row/row0purge.c +++ b/storage/xtradb/row/row0purge.c @@ -407,8 +407,8 @@ row_purge_remove_sec_if_poss_leaf( goto func_exit; } } - /* fall through (the index entry is still needed, - or the deletion succeeded) */ + /* the index entry is still needed, or the deletion succeeded */ + /* fall through */ case ROW_NOT_DELETED_REF: /* The index entry is still needed. */ case ROW_BUFFERED: diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c index 592ae963382..3b2568c6834 100644 --- a/storage/xtradb/row/row0sel.c +++ b/storage/xtradb/row/row0sel.c @@ -2678,6 +2678,7 @@ row_sel_field_store_in_mysql_format( case DATA_SYS: /* These column types should never be shipped to MySQL. */ ut_ad(0); + /* fall through */ case DATA_CHAR: case DATA_FIXBINARY: diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index f2782657bea..7d39c9127c3 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2488,14 +2488,18 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)), return MY_CS_TOOSMALLN(count); switch (count) { - /* Fall through all cases!!! */ #ifdef UNICODE_32BIT case 6: r[5] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x4000000; + /* fall through */ case 5: r[4] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x200000; + /* fall through */ case 4: r[3] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x10000; + /* fall through */ #endif case 3: r[2] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x800; + /* fall through */ case 2: r[1] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0xc0; + /* fall through */ case 1: r[0] = (uchar) wc; } return count; @@ -2521,9 +2525,10 @@ static int my_uni_utf8_no_range(CHARSET_INFO *cs __attribute__((unused)), switch (count) { - /* Fall through all cases!!! */ case 3: r[2]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x800; + /* fall through */ case 2: r[1]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0xc0; + /* fall through */ case 1: r[0]= (uchar) wc; } return count; @@ -4979,10 +4984,12 @@ my_wc_mb_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), return MY_CS_TOOSMALLN(count); switch (count) { - /* Fall through all cases!!! */ case 4: r[3] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x10000; + /* fall through */ case 3: r[2] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x800; + /* fall through */ case 2: r[1] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0xc0; + /* fall through */ case 1: r[0] = (uchar) wc; } return count; @@ -5011,10 +5018,12 @@ my_wc_mb_utf8mb4_no_range(CHARSET_INFO *cs __attribute__((unused)), switch (count) { - /* Fall through all cases!!! */ case 4: r[3]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x10000; + /* fall through */ case 3: r[2]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x800; + /* fall through */ case 2: r[1]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0xc0; + /* fall through */ case 1: r[0]= (uchar) wc; } return count; diff --git a/strings/dtoa.c b/strings/dtoa.c index 6b216056f66..5f50e10c9bf 100644 --- a/strings/dtoa.c +++ b/strings/dtoa.c @@ -1377,7 +1377,7 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s switch (*s) { case '-': sign= 1; - /* no break */ + /* fall through */ case '+': s++; goto break2; @@ -1465,10 +1465,9 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s esign= 0; if (++s < end) switch (c= *s) { - case '-': - esign= 1; - case '+': - c= *++s; + case '-': esign= 1; + /* fall through */ + case '+': c= *++s; } if (s < end && c >= '0' && c <= '9') { @@ -2360,7 +2359,7 @@ static char *dtoa(double dd, int mode, int ndigits, int *decpt, int *sign, break; case 2: leftright= 0; - /* no break */ + /* fall through */ case 4: if (ndigits <= 0) ndigits= 1; @@ -2368,7 +2367,7 @@ static char *dtoa(double dd, int mode, int ndigits, int *decpt, int *sign, break; case 3: leftright= 0; - /* no break */ + /* fall through */ case 5: i= ndigits + k + 1; ilim= i; From 52516706c86f9f66c76836eabde7e2477694bac3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 13 Oct 2017 20:53:55 +0200 Subject: [PATCH 25/30] cleanup mysql_install_db 1. detect resolveip location, don' assume it's in $basedir/bin 2. don't guess $scriptdir to (incorrectly) construct the $0 path 3. rename find_in_basedir -> find_in_dirs, don't prepend $basedir automatically. This allows to use identical path lists in find_in_dirs and in cannot_find_file. 4. move search path lists to CMakeLists.txt to avoid specifying the same path list twice (in find_in_dirs and in cannot_find_file). --- scripts/CMakeLists.txt | 5 ++++ scripts/mysql_install_db.sh | 48 +++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index b4bd930029d..4f5ecccc159 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -205,6 +205,11 @@ ELSE() SET(localstatedir ${MYSQL_DATADIR}) ENDIF() +SET(resolveip_locations "$basedir/bin") +SET(mysqld_locations "$basedir/libexec $basedir/sbin $basedir/bin") +SET(errmsg_locations "$basedir/share/english $basedir/share/mysql/english") +SET(pkgdata_locations "$basedir/share $basedir/share/mysql") + IF(UNIX) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index aefcc1a8384..00cf77d5780 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -159,7 +159,7 @@ parse_arguments() # Try to find a specific file within --basedir which can either be a binary # release or installed source directory and return the path. -find_in_basedir() +find_in_dirs() { case "$1" in --dir) @@ -171,13 +171,13 @@ find_in_basedir() for dir in "$@" do - if test -f "$basedir/$dir/$file" + if test -f "$dir/$file" then if test -n "$return_dir" then - echo "$basedir/$dir" + echo "$dir" else - echo "$basedir/$dir/$file" + echo "$dir/$file" fi break fi @@ -239,7 +239,7 @@ then print_defaults="$builddir/extra/my_print_defaults" elif test -n "$basedir" then - print_defaults=`find_in_basedir my_print_defaults bin extra` + print_defaults=`find_in_dirs my_print_defaults $basedir/bin $basedir/extra` if test -z "$print_defaults" then cannot_find_file my_print_defaults $basedir/bin $basedir/extra @@ -265,41 +265,43 @@ if test -n "$srcdir" then basedir="$builddir" bindir="$basedir/client" - extra_bindir="$basedir/extra" + resolveip="$basedir/extra/resolveip" mysqld="$basedir/sql/mysqld" langdir="$basedir/sql/share/english" pkgdatadir="$srcdir/scripts" - scriptdir="$srcdir/scripts" elif test -n "$basedir" then - bindir="$basedir/bin" - extra_bindir="$bindir" - mysqld=`find_in_basedir mysqld libexec sbin bin` + bindir="$basedir/bin" # only used in the help text + resolveip=`find_in_dirs resolveip @resolveip_locations@` + if test -z "$resolveip" + then + cannot_find_file resolveip @resolveip_locations@ + exit 1 + fi + mysqld=`find_in_dirs mysqld @mysqld_locations@` if test -z "$mysqld" then - cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin + cannot_find_file mysqld @mysqld_locations@ exit 1 fi - langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english` + langdir=`find_in_dirs --dir errmsg.sys @errmsg_locations@` if test -z "$langdir" then - cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english + cannot_find_file errmsg.sys @errmsg_locations@ exit 1 fi - pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql` + pkgdatadir=`find_in_dirs --dir fill_help_tables.sql @pkgdata_locations@` if test -z "$pkgdatadir" then - cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql + cannot_find_file fill_help_tables.sql @pkgdata_locations@ exit 1 fi - scriptdir="$basedir/scripts" else basedir="@prefix@" bindir="@bindir@" - extra_bindir="$bindir" + resolveip="$bindir/resolveip" mysqld="@libexecdir@/mysqld" pkgdatadir="@pkgdatadir@" - scriptdir="@scriptdir@" fi # Set up paths to SQL scripts required for bootstrap @@ -342,14 +344,14 @@ hostname=`@HOSTNAME@` # Check if hostname is valid if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 then - resolved=`"$extra_bindir/resolveip" $hostname 2>&1` + resolved=`"$resolveip" $hostname 2>&1` if test $? -ne 0 then - resolved=`"$extra_bindir/resolveip" localhost 2>&1` + resolved=`"$resolveip" localhost 2>&1` if test $? -ne 0 then echo "Neither host '$hostname' nor 'localhost' could be looked up with" - echo "'$extra_bindir/resolveip'" + echo "'$resolveip'" echo "Please configure the 'hostname' command to return a correct" echo "hostname." echo "If you want to solve this at a later stage, restart this script" @@ -357,7 +359,7 @@ then link_to_help exit 1 fi - echo "WARNING: The host '$hostname' could not be looked up with resolveip." + echo "WARNING: The host '$hostname' could not be looked up with $resolveip." echo "This probably means that your libc libraries are not 100 % compatible" echo "with this binary MariaDB version. The MariaDB daemon, mysqld, should work" echo "normally with the exception that host name resolving will not work." @@ -436,7 +438,7 @@ else echo "The problem could be conflicting information in an external" echo "my.cnf files. You can ignore these by doing:" echo - echo " shell> $scriptdir/scripts/mysql_install_db --defaults-file=~/.my.cnf" + echo " shell> $0 --defaults-file=~/.my.cnf" echo echo "You can also try to start the mysqld daemon with:" echo From 93144b9e92d3d4fee3247895c1e06e8e7cfedcaa Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 13 Oct 2017 21:26:30 +0200 Subject: [PATCH 26/30] MDEV-13440 mysql_install_db fails with hard-coded langdir always search in compile-time specified paths INSTALL_BINDIR, INSTALL_SBINDIR, INSTALL_MYSQLSHAREDIR. User can set them to arbitrary values, it's not enough to search only in their usual values of bin, sbin and libexec, share and share/mysql. --- scripts/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 4f5ecccc159..93ee3e9d2ac 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -205,10 +205,10 @@ ELSE() SET(localstatedir ${MYSQL_DATADIR}) ENDIF() -SET(resolveip_locations "$basedir/bin") -SET(mysqld_locations "$basedir/libexec $basedir/sbin $basedir/bin") -SET(errmsg_locations "$basedir/share/english $basedir/share/mysql/english") -SET(pkgdata_locations "$basedir/share $basedir/share/mysql") +SET(resolveip_locations "$basedir/${INSTALL_BINDIR} $basedir/bin") +SET(mysqld_locations "$basedir/${INSTALL_SBINDIR} $basedir/libexec $basedir/sbin $basedir/bin") +SET(errmsg_locations "$basedir/${INSTALL_MYSQLSHAREDIR}/english $basedir/share/english $basedir/share/mysql/english") +SET(pkgdata_locations "$basedir/${INSTALL_MYSQLSHAREDIR} $basedir/share $basedir/share/mysql") IF(UNIX) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh From 421716391b8bafe9af853b1ee3f83d521b69db6e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 14 Oct 2017 15:03:43 +0200 Subject: [PATCH 27/30] MDEV-13912 Can't refer the same column twice in one ALTER TABLE backport ce6c0e584e3 MDEV-8960: Can't refer the same column twice in one ALTER TABLE Problem was that if column was created in alter table when it was refered again it was not tried to find from list of current columns. mysql_prepare_alter_table: There is two cases (1) If alter table adds a new column and then later alter changes the field definition, there was no check from list of new columns, instead an incorrect error was given. (2) If alter table adds a new column and then later alter changes the default, there was no check from list of new columns, instead an incorrect error was given. --- mysql-test/r/alter_table.result | 52 +++++++++++++++++++++++++++++++++ mysql-test/t/alter_table.test | 41 ++++++++++++++++++++++++++ sql/sql_table.cc | 45 ++++++++++++++++++++++++++-- 3 files changed, 135 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 624cc7afa98..8e61031f8ac 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1340,3 +1340,55 @@ rename table t2 to t1; execute stmt1; deallocate prepare stmt1; drop table t2; +# +# MDEV-8960 Can't refer the same column twice in one ALTER TABLE +# +CREATE TABLE t1 ( +`a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL, +ALTER COLUMN `consultant_id` DROP DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `consultant_id` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +DROP TABLE t1; +CREATE TABLE t1 ( +`a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL, +ALTER COLUMN `consultant_id` SET DEFAULT 2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `consultant_id` int(11) NOT NULL DEFAULT '2' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +DROP TABLE t1; +CREATE TABLE t1 ( +`a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2, +ALTER COLUMN `consultant_id` DROP DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `consultant_id` int(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +DROP TABLE t1; +CREATE TABLE t1 ( +`a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2, +ALTER COLUMN `consultant_id` DROP DEFAULT, +MODIFY COLUMN `consultant_id` BIGINT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `consultant_id` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +DROP TABLE t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index eade7ba721e..ee9616e233d 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1231,3 +1231,44 @@ execute stmt1; deallocate prepare stmt1; drop table t2; +--echo # +--echo # MDEV-8960 Can't refer the same column twice in one ALTER TABLE +--echo # + +CREATE TABLE t1 ( + `a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; + +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL, +ALTER COLUMN `consultant_id` DROP DEFAULT; + +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + `a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; + +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL, +ALTER COLUMN `consultant_id` SET DEFAULT 2; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + `a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; + +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2, +ALTER COLUMN `consultant_id` DROP DEFAULT; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + `a` int(11) DEFAULT NULL +) DEFAULT CHARSET=utf8; + +ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2, +ALTER COLUMN `consultant_id` DROP DEFAULT, +MODIFY COLUMN `consultant_id` BIGINT; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e6490876352..19093d9b2ca 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5739,9 +5739,25 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, { if (def->change && ! def->field) { - my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, - table->s->table_name.str); - goto err; + /* + Check if there is modify for newly added field. + */ + Create_field *find; + find_it.rewind(); + while((find=find_it++)) + { + if (!my_strcasecmp(system_charset_info,find->field_name, def->field_name)) + break; + } + + if (find && !find->field) + find_it.remove(); + else + { + my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, + table->s->table_name.str); + goto err; + } } /* Check that the DATE/DATETIME not null field we are going to add is @@ -5793,6 +5809,29 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, */ alter_info->change_level= ALTER_TABLE_DATA_CHANGED; } + /* + Check if there is alter for newly added field. + */ + alter_it.rewind(); + Alter_column *alter; + while ((alter=alter_it++)) + { + if (!my_strcasecmp(system_charset_info,def->field_name, alter->name)) + break; + } + if (alter) + { + if (def->sql_type == MYSQL_TYPE_BLOB) + { + my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change); + goto err; + } + if ((def->def=alter->def)) // Use new default + def->flags&= ~NO_DEFAULT_VALUE_FLAG; + else + def->flags|= NO_DEFAULT_VALUE_FLAG; + alter_it.remove(); + } } if (alter_info->alter_list.elements) { From 19a702a85c69d241e360d1d5a040378928a3fdca Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 14 Oct 2017 15:59:54 +0200 Subject: [PATCH 28/30] MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option if it's a DROP TABLE, we cannot detect whether a table is temporary by looking in thd->temporary_tables - because the table might simply not exist at all. --- mysql-test/r/read_only.result | 3 +++ mysql-test/t/read_only.test | 5 +++++ sql/sql_parse.cc | 41 ++++++++++++++--------------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index 807dc426696..2d0f9d730fd 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -47,6 +47,9 @@ delete t1 from t1,t3 where t1.a=t3.a; drop table t1; insert into t1 values(1); ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +drop temporary table if exists t1; +Warnings: +Note 1051 Unknown table 't1' connection default; set global read_only=0; lock table t1 write; diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test index a0bd7b49273..eb9bea803c2 100644 --- a/mysql-test/t/read_only.test +++ b/mysql-test/t/read_only.test @@ -114,6 +114,11 @@ drop table t1; --error ER_OPTION_PREVENTS_STATEMENT insert into t1 values(1); +# +# MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option +# +drop temporary table if exists t1; + # # Bug#11733 COMMITs should not happen if read-only is set # diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d003a13ae09..9f8a625325f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -811,8 +811,7 @@ out: @retval FALSE The statement isn't updating any relevant tables. */ -static my_bool deny_updates_if_read_only_option(THD *thd, - TABLE_LIST *all_tables) +static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables) { DBUG_ENTER("deny_updates_if_read_only_option"); @@ -821,11 +820,7 @@ static my_bool deny_updates_if_read_only_option(THD *thd, LEX *lex= thd->lex; - const my_bool user_is_super= - ((ulong)(thd->security_ctx->master_access & SUPER_ACL) == - (ulong)SUPER_ACL); - - if (user_is_super) + if (thd->security_ctx->master_access & SUPER_ACL) DBUG_RETURN(FALSE); if (!(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA)) @@ -835,30 +830,26 @@ static my_bool deny_updates_if_read_only_option(THD *thd, if (lex->sql_command == SQLCOM_UPDATE_MULTI) DBUG_RETURN(FALSE); + if (lex->sql_command == SQLCOM_CREATE_DB || + lex->sql_command == SQLCOM_DROP_DB) + DBUG_RETURN(TRUE); + /* a table-to-be-created is not in the temp table list yet, so CREATE TABLE needs a special treatment */ - const bool update_real_tables= - lex->sql_command == SQLCOM_CREATE_TABLE - ? !(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) - : some_non_temp_table_to_be_updated(thd, all_tables); + if (lex->sql_command == SQLCOM_CREATE_TABLE) + DBUG_RETURN(!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)); - const bool create_or_drop_databases= - (lex->sql_command == SQLCOM_CREATE_DB) || - (lex->sql_command == SQLCOM_DROP_DB); + /* + a table-to-be-dropped might not exist (DROP TEMPORARY TABLE IF EXISTS), + cannot use the temp table list either. + */ + if (lex->sql_command == SQLCOM_DROP_TABLE && lex->drop_temporary) + DBUG_RETURN(FALSE); - if (update_real_tables || create_or_drop_databases) - { - /* - An attempt was made to modify one or more non-temporary tables. - */ - DBUG_RETURN(TRUE); - } - - - /* Assuming that only temporary tables are modified. */ - DBUG_RETURN(FALSE); + /* Now, check thd->temporary_tables list */ + DBUG_RETURN(some_non_temp_table_to_be_updated(thd, all_tables)); } /** From b036b6b59464524d7dd54a4c9a75b5ee8a14dbe0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 16 Oct 2017 12:34:17 +0200 Subject: [PATCH 29/30] MDEV-13937 Aria engine: Internal Error 160 after partition handling Partition wasn't setting HA_OPTION_PACK_RECORD on ALTER TABLE if the row format was PAGE. (so one bit in the null bitmap was reserved for a deleted bit - see make_empty_rec - and all actual null bits were one off) --- .../suite/parts/r/partition_alter_maria.result | 18 ++++++++++++++++++ .../suite/parts/t/partition_alter_maria.test | 18 ++++++++++++++++++ sql/sql_partition.cc | 3 ++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/parts/r/partition_alter_maria.result create mode 100644 mysql-test/suite/parts/t/partition_alter_maria.test diff --git a/mysql-test/suite/parts/r/partition_alter_maria.result b/mysql-test/suite/parts/r/partition_alter_maria.result new file mode 100644 index 00000000000..6343566e408 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_alter_maria.result @@ -0,0 +1,18 @@ +create table t1 ( +pk bigint not null auto_increment, +dt datetime default null, +unique (pk, dt) +) engine=aria row_format=dynamic +partition by range columns(dt) ( +partition `p20171231` values less than ('2017-12-31'), +partition `p20181231` values less than ('2018-12-31') +); +insert into t1 values (1,'2017-09-28 15:12:00'); +select * from t1; +pk dt +1 2017-09-28 15:12:00 +alter table t1 drop partition p20181231; +select * from t1; +pk dt +1 2017-09-28 15:12:00 +drop table t1; diff --git a/mysql-test/suite/parts/t/partition_alter_maria.test b/mysql-test/suite/parts/t/partition_alter_maria.test new file mode 100644 index 00000000000..db249591158 --- /dev/null +++ b/mysql-test/suite/parts/t/partition_alter_maria.test @@ -0,0 +1,18 @@ +# +# MDEV-13937 Aria engine: Internal Error 160 after partition handling +# +source include/have_partition.inc; +create table t1 ( + pk bigint not null auto_increment, + dt datetime default null, + unique (pk, dt) +) engine=aria row_format=dynamic + partition by range columns(dt) ( + partition `p20171231` values less than ('2017-12-31'), + partition `p20181231` values less than ('2018-12-31') +); +insert into t1 values (1,'2017-09-28 15:12:00'); +select * from t1; +alter table t1 drop partition p20181231; +select * from t1; +drop table t1; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index bf34d328dc5..cb01f8e339f 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6672,7 +6672,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, lpt->alter_info= alter_info; lpt->create_info= create_info; lpt->db_options= create_info->table_options; - if (create_info->row_type == ROW_TYPE_DYNAMIC) + if (create_info->row_type != ROW_TYPE_FIXED && + create_info->row_type != ROW_TYPE_DEFAULT) lpt->db_options|= HA_OPTION_PACK_RECORD; lpt->table= fast_alter_table; lpt->old_table= table; From b000e169562697aa072600695d4f0c0412f94f4f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 17 Oct 2017 10:57:51 +0200 Subject: [PATCH 30/30] Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL)) based on: commit f7316aa0c9a Author: Ajo Robert Date: Thu Aug 24 17:03:21 2017 +0530 Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL)) Backport of Bug#19143243 fix. NAME_CONST item can return NULL_ITEM type in case of incorrect arguments. NULL_ITEM has special processing in Item_func_in function. In Item_func_in::fix_length_and_dec an array of possible comparators is created. Since NAME_CONST function has NULL_ITEM type, corresponding array element is empty. Then NAME_CONST is wrapped to ITEM_CACHE. ITEM_CACHE can not return proper type(NULL_ITEM) in Item_func_in::val_int(), so the NULL_ITEM is attempted compared with an empty comparator. The fix is to disable the caching of Item_name_const item. --- mysql-test/r/func_in.result | 6 ++++++ mysql-test/t/func_in.test | 8 ++++++++ sql/item.cc | 1 + 3 files changed, 15 insertions(+) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index fc56660ac62..03ddbf5402b 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -812,3 +812,9 @@ EXECUTE s; 1 DROP TABLE t1; # End of 5.3 tests +create table t1 (a int); +insert t1 values (1),(2),(3); +select * from t1 where 1 in (a, name_const('a', null)); +a +1 +drop table t1; diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 1e695142d90..439f9868ec8 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -606,3 +606,11 @@ EXECUTE s; DROP TABLE t1; --echo # End of 5.3 tests + +# +# Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL)) +# +create table t1 (a int); +insert t1 values (1),(2),(3); +select * from t1 where 1 in (a, name_const('a', null)); +drop table t1; diff --git a/sql/item.cc b/sql/item.cc index 3c633ddc9ca..fa2e52bfd4a 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6726,6 +6726,7 @@ bool Item::cache_const_expr_analyzer(uchar **arg) */ if (const_item() && !(basic_const_item() || item->basic_const_item() || + item->type() == Item::NULL_ITEM || /* Item_name_const hack */ item->type() == Item::FIELD_ITEM || item->type() == SUBSELECT_ITEM || /*