From 65cfc5873e8a9d528451d741b512d12a77eff81f Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Fri, 26 Oct 2018 04:00:00 -0400 Subject: [PATCH 1/6] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 4acb69e9e07..34a2418fde1 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=62 +MYSQL_VERSION_PATCH=63 MYSQL_VERSION_EXTRA= From 6ced789186fabd7dce97b3d6d171ff9e5ddc5f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 30 Oct 2018 13:29:19 +0200 Subject: [PATCH 2/6] MDEV-12023 Assertion failure sym_node->table != NULL on startup row_drop_table_for_mysql(): Avoid accessing non-existing dictionary tables. dict_create_or_check_foreign_constraint_tables(): Add debug instrumentation for creating and dropping a table before the creation of any non-core dictionary tables. trx_purge_add_update_undo_to_history(): Adjust a debug assertion, so that it will not fail due to the test instrumentation. --- mysql-test/include/maybe_debug.combinations | 5 + mysql-test/include/maybe_debug.inc | 3 + mysql-test/suite.pm | 3 + .../suite/innodb/r/table_flags,4k,debug.rdiff | 128 ++++++++++++++ ...,4k.rdiff => table_flags,4k,release.rdiff} | 0 .../suite/innodb/r/table_flags,8k,debug.rdiff | 128 ++++++++++++++ ...,8k.rdiff => table_flags,8k,release.rdiff} | 0 .../suite/innodb/r/table_flags,debug.rdiff | 128 ++++++++++++++ mysql-test/suite/innodb/t/table_flags.test | 4 + storage/innobase/dict/dict0crea.cc | 16 ++ storage/innobase/row/row0mysql.cc | 163 +++++++++--------- storage/innobase/trx/trx0purge.cc | 2 +- storage/xtradb/dict/dict0crea.cc | 17 +- storage/xtradb/row/row0mysql.cc | 163 +++++++++--------- storage/xtradb/trx/trx0purge.cc | 2 +- 15 files changed, 588 insertions(+), 174 deletions(-) create mode 100644 mysql-test/include/maybe_debug.combinations create mode 100644 mysql-test/include/maybe_debug.inc create mode 100644 mysql-test/suite/innodb/r/table_flags,4k,debug.rdiff rename mysql-test/suite/innodb/r/{table_flags,4k.rdiff => table_flags,4k,release.rdiff} (100%) create mode 100644 mysql-test/suite/innodb/r/table_flags,8k,debug.rdiff rename mysql-test/suite/innodb/r/{table_flags,8k.rdiff => table_flags,8k,release.rdiff} (100%) create mode 100644 mysql-test/suite/innodb/r/table_flags,debug.rdiff diff --git a/mysql-test/include/maybe_debug.combinations b/mysql-test/include/maybe_debug.combinations new file mode 100644 index 00000000000..5ee57c0bfd8 --- /dev/null +++ b/mysql-test/include/maybe_debug.combinations @@ -0,0 +1,5 @@ +[debug] +--enable-gdb + +[release] +--disable-gdb diff --git a/mysql-test/include/maybe_debug.inc b/mysql-test/include/maybe_debug.inc new file mode 100644 index 00000000000..2f6c2848f9f --- /dev/null +++ b/mysql-test/include/maybe_debug.inc @@ -0,0 +1,3 @@ +# include file for test files that can be run with and without debug +# having debug and non-debug tests. +let $have_debug=`select version() like '%debug%'`; diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index 199cfba3b8f..52025801974 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -23,6 +23,9 @@ sub skip_combinations { # don't run tests for the wrong platform $skip{'include/platform.combinations'} = [ (IS_WINDOWS) ? 'unix' : 'win' ]; + $skip{'include/maybe_debug.combinations'} = + [ defined $::mysqld_variables{'debug-dbug'} ? 'release' : 'debug' ]; + # as a special case, disable certain include files as a whole $skip{'include/not_embedded.inc'} = 'Not run for embedded server' if $::opt_embedded_server; diff --git a/mysql-test/suite/innodb/r/table_flags,4k,debug.rdiff b/mysql-test/suite/innodb/r/table_flags,4k,debug.rdiff new file mode 100644 index 00000000000..83e40b2d3fd --- /dev/null +++ b/mysql-test/suite/innodb/r/table_flags,4k,debug.rdiff @@ -0,0 +1,128 @@ +--- suite/innodb/r/table_flags.result ++++ suite/innodb/r/table_flags,4k,debug.reject +@@ -10,81 +10,81 @@ + CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + SYS_TABLES clustered index root page (8): + N_RECS=9; LEVEL=0; INDEX_ID=0x0000000000000001 +-header=0x01000003016e (NAME=0x696e66696d756d00) +-header=0x00002815008d (NAME='SYS_DATAFILES', +- DB_TRX_ID=0x000000000301, +- DB_ROLL_PTR=0x81000001320194, +- ID=0x000000000000000e, ++header=0x0100000301bf (NAME=0x696e66696d756d00) ++header=0x0000301500de (NAME='SYS_DATAFILES', ++ DB_TRX_ID=0x000000000302, ++ DB_ROLL_PTR=0x81000003270194, ++ ID=0x000000000000000f, + N_COLS=0x00000002, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x0000101500d5 (NAME='SYS_FOREIGN', ++header=0x000018150126 (NAME='SYS_FOREIGN', + DB_TRX_ID=0x000000000300, +- DB_ROLL_PTR=0x800000012d0110, +- ID=0x000000000000000b, ++ DB_ROLL_PTR=0x8000000320016f, ++ ID=0x000000000000000c, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x000018150122 (NAME='SYS_FOREIGN_COLS', ++header=0x000020150173 (NAME='SYS_FOREIGN_COLS', + DB_TRX_ID=0x000000000300, +- DB_ROLL_PTR=0x800000012d0201, +- ID=0x000000000000000c, ++ DB_ROLL_PTR=0x80000003200260, ++ ID=0x000000000000000d, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x0400201501fc (NAME='SYS_TABLESPACES', +- DB_TRX_ID=0x000000000301, +- DB_ROLL_PTR=0x81000001320110, +- ID=0x000000000000000d, ++header=0x040028150209 (NAME='SYS_TABLESPACES', ++ DB_TRX_ID=0x000000000302, ++ DB_ROLL_PTR=0x81000003270110, ++ ID=0x000000000000000e, + N_COLS=0x00000003, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x000038150240 (NAME='test/tc', +- DB_TRX_ID=0x000000000303, +- DB_ROLL_PTR=0x83000001360110, +- ID=0x0000000000000010, ++header=0x00003815024d (NAME='test/tc', ++ DB_TRX_ID=0x000000000304, ++ DB_ROLL_PTR=0x830000032c0110, ++ ID=0x0000000000000011, + N_COLS=0x80000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000002) +-header=0x0000401502c8 (NAME='test/td', +- DB_TRX_ID=0x000000000304, +- DB_ROLL_PTR=0x84000001370110, +- ID=0x0000000000000011, ++header=0x0000401502d5 (NAME='test/td', ++ DB_TRX_ID=0x000000000305, ++ DB_ROLL_PTR=0x840000032d0110, ++ ID=0x0000000000000012, + N_COLS=0x80000001, + TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000003) +-header=0x0000501501b8 (NAME='test/tp', +- DB_TRX_ID=0x000000000306, +- DB_ROLL_PTR=0x86000001390110, +- ID=0x0000000000000013, ++header=0x00005015008d (NAME='test/tp', ++ DB_TRX_ID=0x000000000307, ++ DB_ROLL_PTR=0x86000003300110, ++ ID=0x0000000000000014, + N_COLS=0x80000001, + TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000005) +-header=0x000030150284 (NAME='test/tr', +- DB_TRX_ID=0x000000000302, +- DB_ROLL_PTR=0x82000001350110, +- ID=0x000000000000000f, ++header=0x000010150291 (NAME='test/tr', ++ DB_TRX_ID=0x000000000303, ++ DB_ROLL_PTR=0x820000032b0110, ++ ID=0x0000000000000010, + N_COLS=0x00000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, +@@ -92,9 +92,9 @@ + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000001) + header=0x000048150074 (NAME='test/tz', +- DB_TRX_ID=0x000000000305, +- DB_ROLL_PTR=0x85000001380110, +- ID=0x0000000000000012, ++ DB_TRX_ID=0x000000000306, ++ DB_ROLL_PTR=0x850000032e0110, ++ ID=0x0000000000000013, + N_COLS=0x80000001, + TYPE=0x00000023, + MIX_ID=0x0000000000000000, diff --git a/mysql-test/suite/innodb/r/table_flags,4k.rdiff b/mysql-test/suite/innodb/r/table_flags,4k,release.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/table_flags,4k.rdiff rename to mysql-test/suite/innodb/r/table_flags,4k,release.rdiff diff --git a/mysql-test/suite/innodb/r/table_flags,8k,debug.rdiff b/mysql-test/suite/innodb/r/table_flags,8k,debug.rdiff new file mode 100644 index 00000000000..14fa7509c19 --- /dev/null +++ b/mysql-test/suite/innodb/r/table_flags,8k,debug.rdiff @@ -0,0 +1,128 @@ +--- suite/innodb/r/table_flags.result ++++ suite/innodb/r/table_flags,8k,debug.reject +@@ -10,81 +10,81 @@ + CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + SYS_TABLES clustered index root page (8): + N_RECS=9; LEVEL=0; INDEX_ID=0x0000000000000001 +-header=0x01000003016e (NAME=0x696e66696d756d00) +-header=0x00002815008d (NAME='SYS_DATAFILES', +- DB_TRX_ID=0x000000000301, +- DB_ROLL_PTR=0x81000001320194, +- ID=0x000000000000000e, ++header=0x0100000301bf (NAME=0x696e66696d756d00) ++header=0x0000301500de (NAME='SYS_DATAFILES', ++ DB_TRX_ID=0x000000000302, ++ DB_ROLL_PTR=0x81000001d80194, ++ ID=0x000000000000000f, + N_COLS=0x00000002, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x0000101500d5 (NAME='SYS_FOREIGN', ++header=0x000018150126 (NAME='SYS_FOREIGN', + DB_TRX_ID=0x000000000300, +- DB_ROLL_PTR=0x800000012d0110, +- ID=0x000000000000000b, ++ DB_ROLL_PTR=0x80000001d1016f, ++ ID=0x000000000000000c, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x000018150122 (NAME='SYS_FOREIGN_COLS', ++header=0x000020150173 (NAME='SYS_FOREIGN_COLS', + DB_TRX_ID=0x000000000300, +- DB_ROLL_PTR=0x800000012d0201, +- ID=0x000000000000000c, ++ DB_ROLL_PTR=0x80000001d10260, ++ ID=0x000000000000000d, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x0400201501fc (NAME='SYS_TABLESPACES', +- DB_TRX_ID=0x000000000301, +- DB_ROLL_PTR=0x81000001320110, +- ID=0x000000000000000d, ++header=0x040028150209 (NAME='SYS_TABLESPACES', ++ DB_TRX_ID=0x000000000302, ++ DB_ROLL_PTR=0x81000001d80110, ++ ID=0x000000000000000e, + N_COLS=0x00000003, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x000038150240 (NAME='test/tc', +- DB_TRX_ID=0x000000000303, +- DB_ROLL_PTR=0x83000001360110, +- ID=0x0000000000000010, ++header=0x00003815024d (NAME='test/tc', ++ DB_TRX_ID=0x000000000304, ++ DB_ROLL_PTR=0x83000001dc0110, ++ ID=0x0000000000000011, + N_COLS=0x80000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000002) +-header=0x0000401502c8 (NAME='test/td', +- DB_TRX_ID=0x000000000304, +- DB_ROLL_PTR=0x84000001370110, +- ID=0x0000000000000011, ++header=0x0000401502d5 (NAME='test/td', ++ DB_TRX_ID=0x000000000305, ++ DB_ROLL_PTR=0x84000001dd0110, ++ ID=0x0000000000000012, + N_COLS=0x80000001, + TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000003) +-header=0x0000501501b8 (NAME='test/tp', +- DB_TRX_ID=0x000000000306, +- DB_ROLL_PTR=0x86000001390110, +- ID=0x0000000000000013, ++header=0x00005015008d (NAME='test/tp', ++ DB_TRX_ID=0x000000000307, ++ DB_ROLL_PTR=0x86000001df0110, ++ ID=0x0000000000000014, + N_COLS=0x80000001, + TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000005) +-header=0x000030150284 (NAME='test/tr', +- DB_TRX_ID=0x000000000302, +- DB_ROLL_PTR=0x82000001350110, +- ID=0x000000000000000f, ++header=0x000010150291 (NAME='test/tr', ++ DB_TRX_ID=0x000000000303, ++ DB_ROLL_PTR=0x82000001db0110, ++ ID=0x0000000000000010, + N_COLS=0x00000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, +@@ -92,9 +92,9 @@ + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000001) + header=0x000048150074 (NAME='test/tz', +- DB_TRX_ID=0x000000000305, +- DB_ROLL_PTR=0x85000001380110, +- ID=0x0000000000000012, ++ DB_TRX_ID=0x000000000306, ++ DB_ROLL_PTR=0x85000001de0110, ++ ID=0x0000000000000013, + N_COLS=0x80000001, + TYPE=0x00000023, + MIX_ID=0x0000000000000000, diff --git a/mysql-test/suite/innodb/r/table_flags,8k.rdiff b/mysql-test/suite/innodb/r/table_flags,8k,release.rdiff similarity index 100% rename from mysql-test/suite/innodb/r/table_flags,8k.rdiff rename to mysql-test/suite/innodb/r/table_flags,8k,release.rdiff diff --git a/mysql-test/suite/innodb/r/table_flags,debug.rdiff b/mysql-test/suite/innodb/r/table_flags,debug.rdiff new file mode 100644 index 00000000000..d038515ffe5 --- /dev/null +++ b/mysql-test/suite/innodb/r/table_flags,debug.rdiff @@ -0,0 +1,128 @@ +--- suite/innodb/r/table_flags.result ++++ suite/innodb/r/table_flags,debug.reject +@@ -10,81 +10,81 @@ + CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + SYS_TABLES clustered index root page (8): + N_RECS=9; LEVEL=0; INDEX_ID=0x0000000000000001 +-header=0x01000003016e (NAME=0x696e66696d756d00) +-header=0x00002815008d (NAME='SYS_DATAFILES', +- DB_TRX_ID=0x000000000301, +- DB_ROLL_PTR=0x81000001320194, +- ID=0x000000000000000e, ++header=0x0100000301bf (NAME=0x696e66696d756d00) ++header=0x0000301500de (NAME='SYS_DATAFILES', ++ DB_TRX_ID=0x000000000302, ++ DB_ROLL_PTR=0x81000001330194, ++ ID=0x000000000000000f, + N_COLS=0x00000002, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x0000101500d5 (NAME='SYS_FOREIGN', ++header=0x000018150126 (NAME='SYS_FOREIGN', + DB_TRX_ID=0x000000000300, +- DB_ROLL_PTR=0x800000012d0110, +- ID=0x000000000000000b, ++ DB_ROLL_PTR=0x800000012d016f, ++ ID=0x000000000000000c, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x000018150122 (NAME='SYS_FOREIGN_COLS', ++header=0x000020150173 (NAME='SYS_FOREIGN_COLS', + DB_TRX_ID=0x000000000300, +- DB_ROLL_PTR=0x800000012d0201, +- ID=0x000000000000000c, ++ DB_ROLL_PTR=0x800000012d0260, ++ ID=0x000000000000000d, + N_COLS=0x00000004, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x0400201501fc (NAME='SYS_TABLESPACES', +- DB_TRX_ID=0x000000000301, +- DB_ROLL_PTR=0x81000001320110, +- ID=0x000000000000000d, ++header=0x040028150209 (NAME='SYS_TABLESPACES', ++ DB_TRX_ID=0x000000000302, ++ DB_ROLL_PTR=0x81000001330110, ++ ID=0x000000000000000e, + N_COLS=0x00000003, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000040, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000000) +-header=0x000038150240 (NAME='test/tc', +- DB_TRX_ID=0x000000000303, +- DB_ROLL_PTR=0x83000001360110, +- ID=0x0000000000000010, ++header=0x00003815024d (NAME='test/tc', ++ DB_TRX_ID=0x000000000304, ++ DB_ROLL_PTR=0x83000001370110, ++ ID=0x0000000000000011, + N_COLS=0x80000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000002) +-header=0x0000401502c8 (NAME='test/td', +- DB_TRX_ID=0x000000000304, +- DB_ROLL_PTR=0x84000001370110, +- ID=0x0000000000000011, ++header=0x0000401502d5 (NAME='test/td', ++ DB_TRX_ID=0x000000000305, ++ DB_ROLL_PTR=0x84000001380110, ++ ID=0x0000000000000012, + N_COLS=0x80000001, + TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000003) +-header=0x0000501501b8 (NAME='test/tp', +- DB_TRX_ID=0x000000000306, +- DB_ROLL_PTR=0x86000001390110, +- ID=0x0000000000000013, ++header=0x00005015008d (NAME='test/tp', ++ DB_TRX_ID=0x000000000307, ++ DB_ROLL_PTR=0x860000013a0110, ++ ID=0x0000000000000014, + N_COLS=0x80000001, + TYPE=0x00000021, + MIX_ID=0x0000000000000000, + MIX_LEN=0x00000050, + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000005) +-header=0x000030150284 (NAME='test/tr', +- DB_TRX_ID=0x000000000302, +- DB_ROLL_PTR=0x82000001350110, +- ID=0x000000000000000f, ++header=0x000010150291 (NAME='test/tr', ++ DB_TRX_ID=0x000000000303, ++ DB_ROLL_PTR=0x82000001360110, ++ ID=0x0000000000000010, + N_COLS=0x00000001, + TYPE=0x00000001, + MIX_ID=0x0000000000000000, +@@ -92,9 +92,9 @@ + CLUSTER_NAME=NULL(0 bytes), + SPACE=0x00000001) + header=0x000048150074 (NAME='test/tz', +- DB_TRX_ID=0x000000000305, +- DB_ROLL_PTR=0x85000001380110, +- ID=0x0000000000000012, ++ DB_TRX_ID=0x000000000306, ++ DB_ROLL_PTR=0x85000001390110, ++ ID=0x0000000000000013, + N_COLS=0x80000001, + TYPE=0x00000023, + MIX_ID=0x0000000000000000, diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test index 4d3afcb2dec..59ae0a69ae6 100644 --- a/mysql-test/suite/innodb/t/table_flags.test +++ b/mysql-test/suite/innodb/t/table_flags.test @@ -1,6 +1,7 @@ --source include/innodb_page_size.inc # Embedded server tests do not support restarting --source include/not_embedded.inc +--source include/maybe_debug.inc --disable_query_log call mtr.add_suppression("InnoDB: New log files created, LSN="); @@ -22,6 +23,9 @@ let bugdir= $MYSQLTEST_VARDIR/tmp/table_flags; --let $d=--innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir --let $d=$d --innodb-data-file-path=ibdata1:10M:autoextend --let $d=$d --innodb-undo-tablespaces=0 +if ($have_debug) { +--let $d=$d --debug=d,create_and_drop_garbage +} --let $restart_parameters=$d --innodb-stats-persistent=0 --innodb-file-format=1 --source include/restart_mysqld.inc diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 583b679428a..2388b50b72b 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, MariaDB Corporation. 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 the Free Software @@ -1360,6 +1361,21 @@ dict_create_or_check_foreign_constraint_tables(void) row_mysql_lock_data_dictionary(trx); + DBUG_EXECUTE_IF( + "create_and_drop_garbage", + err = que_eval_sql( + NULL, + "PROCEDURE CREATE_GARBAGE_TABLE_PROC () IS\n" + "BEGIN\n" + "CREATE TABLE\n" + "\"test/#sql-ib-garbage\"(ID CHAR);\n" + "CREATE UNIQUE CLUSTERED INDEX PRIMARY" + " ON \"test/#sql-ib-garbage\"(ID);\n" + "END;\n", FALSE, trx); + ut_ad(err == DB_SUCCESS); + row_drop_table_for_mysql("test/#sql-ib-garbage", + trx, TRUE, TRUE);); + /* Check which incomplete table definition to drop. */ if (sys_foreign_err == DB_CORRUPTION) { diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index ae3f99fac68..d9e18a99201 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -45,6 +45,7 @@ Created 9/17/2000 Heikki Tuuri #include "dict0dict.h" #include "dict0crea.h" #include "dict0load.h" +#include "dict0priv.h" #include "dict0boot.h" #include "dict0stats.h" #include "dict0stats_bg.h" @@ -4137,95 +4138,87 @@ row_drop_table_for_mysql( info = pars_info_create(); - pars_info_add_str_literal(info, "table_name", name); + pars_info_add_str_literal(info, "name", name); - err = que_eval_sql(info, - "PROCEDURE DROP_TABLE_PROC () IS\n" - "sys_foreign_id CHAR;\n" - "table_id CHAR;\n" - "index_id CHAR;\n" - "foreign_id CHAR;\n" - "space_id INT;\n" - "found INT;\n" + if (strcmp(name, "SYS_FOREIGN") && strcmp(name, "SYS_FOREIGN_COLS") + && dict_table_get_low("SYS_FOREIGN") + && dict_table_get_low("SYS_FOREIGN_COLS")) { + err = que_eval_sql( + info, + "PROCEDURE DROP_FOREIGN_PROC () IS\n" + "fid CHAR;\n" - "DECLARE CURSOR cur_fk IS\n" - "SELECT ID FROM SYS_FOREIGN\n" - "WHERE FOR_NAME = :table_name\n" - "AND TO_BINARY(FOR_NAME)\n" - " = TO_BINARY(:table_name)\n" - "LOCK IN SHARE MODE;\n" + "DECLARE CURSOR fk IS\n" + "SELECT ID FROM SYS_FOREIGN\n" + "WHERE FOR_NAME = :name\n" + "AND TO_BINARY(FOR_NAME) = TO_BINARY(:name)\n" + "FOR UPDATE;\n" - "DECLARE CURSOR cur_idx IS\n" - "SELECT ID FROM SYS_INDEXES\n" - "WHERE TABLE_ID = table_id\n" - "LOCK IN SHARE MODE;\n" + "BEGIN\n" + "OPEN fk;\n" + "WHILE 1 = 1 LOOP\n" + " FETCH fk INTO fid;\n" + " IF (SQL % NOTFOUND) THEN RETURN; END IF;\n" + " DELETE FROM SYS_FOREIGN_COLS WHERE ID = fid;\n" + " DELETE FROM SYS_FOREIGN WHERE ID = fid;\n" + "END LOOP;\n" + "CLOSE fk;\n" + "END;\n", FALSE, trx); + if (err == DB_SUCCESS) { + info = pars_info_create(); + pars_info_add_str_literal(info, "name", name); + goto do_drop; + } + } else { +do_drop: + err = que_eval_sql( + info, + "PROCEDURE DROP_TABLE_PROC () IS\n" + "table_id CHAR;\n" + "index_id CHAR;\n" - "BEGIN\n" - "SELECT ID INTO table_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = :table_name\n" - "LOCK IN SHARE MODE;\n" - "IF (SQL % NOTFOUND) THEN\n" - " RETURN;\n" - "END IF;\n" - "SELECT SPACE INTO space_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = :table_name;\n" - "IF (SQL % NOTFOUND) THEN\n" - " RETURN;\n" - "END IF;\n" - "found := 1;\n" - "SELECT ID INTO sys_foreign_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = 'SYS_FOREIGN'\n" - "LOCK IN SHARE MODE;\n" - "IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - "END IF;\n" - "IF (:table_name = 'SYS_FOREIGN') THEN\n" - " found := 0;\n" - "END IF;\n" - "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" - " found := 0;\n" - "END IF;\n" - "OPEN cur_fk;\n" - "WHILE found = 1 LOOP\n" - " FETCH cur_fk INTO foreign_id;\n" - " IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - " ELSE\n" - " DELETE FROM SYS_FOREIGN_COLS\n" - " WHERE ID = foreign_id;\n" - " DELETE FROM SYS_FOREIGN\n" - " WHERE ID = foreign_id;\n" - " END IF;\n" - "END LOOP;\n" - "CLOSE cur_fk;\n" - "found := 1;\n" - "OPEN cur_idx;\n" - "WHILE found = 1 LOOP\n" - " FETCH cur_idx INTO index_id;\n" - " IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - " ELSE\n" - " DELETE FROM SYS_FIELDS\n" - " WHERE INDEX_ID = index_id;\n" - " DELETE FROM SYS_INDEXES\n" - " WHERE ID = index_id\n" - " AND TABLE_ID = table_id;\n" - " END IF;\n" - "END LOOP;\n" - "CLOSE cur_idx;\n" - "DELETE FROM SYS_TABLESPACES\n" - "WHERE SPACE = space_id;\n" - "DELETE FROM SYS_DATAFILES\n" - "WHERE SPACE = space_id;\n" - "DELETE FROM SYS_COLUMNS\n" - "WHERE TABLE_ID = table_id;\n" - "DELETE FROM SYS_TABLES\n" - "WHERE NAME = :table_name;\n" - "END;\n" - , FALSE, trx); + "DECLARE CURSOR cur_idx IS\n" + "SELECT ID FROM SYS_INDEXES\n" + "WHERE TABLE_ID = table_id\n" + "FOR UPDATE;\n" + + "BEGIN\n" + "SELECT ID INTO table_id\n" + "FROM SYS_TABLES WHERE NAME = :name FOR UPDATE;\n" + "IF (SQL % NOTFOUND) THEN RETURN; END IF;\n" + "OPEN cur_idx;\n" + "WHILE 1 = 1 LOOP\n" + " FETCH cur_idx INTO index_id;\n" + " IF (SQL % NOTFOUND) THEN EXIT; END IF;\n" + " DELETE FROM SYS_FIELDS\n" + " WHERE INDEX_ID = index_id;\n" + " DELETE FROM SYS_INDEXES\n" + " WHERE ID = index_id AND TABLE_ID = table_id;\n" + "END LOOP;\n" + "CLOSE cur_idx;\n" + + "DELETE FROM SYS_COLUMNS WHERE TABLE_ID = table_id;\n" + "DELETE FROM SYS_TABLES WHERE NAME = :name;\n" + + "END;\n", FALSE, trx); + + if (err == DB_SUCCESS && table->space + && dict_table_get_low("SYS_TABLESPACES") + && dict_table_get_low("SYS_DATAFILES")) { + info = pars_info_create(); + pars_info_add_int4_literal(info, "id", + lint(table->space)); + err = que_eval_sql( + info, + "PROCEDURE DROP_SPACE_PROC () IS\n" + "BEGIN\n" + "DELETE FROM SYS_TABLESPACES\n" + "WHERE SPACE = :id;\n" + "DELETE FROM SYS_DATAFILES\n" + "WHERE SPACE = :id;\n" + "END;\n", FALSE, trx); + } + } switch (err) { ibool is_temp; diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 2605bf29d25..acb916e1760 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -251,7 +251,7 @@ trx_purge_add_update_undo_to_history( in fast shutdown, we may roll back transactions (trx->undo_no==0) in THD::cleanup() invoked from unlink_thd(). */ ut_ad(srv_undo_sources - || ((srv_startup_is_before_trx_rollback_phase + || ((srv_is_being_started || trx_rollback_or_clean_is_active) && purge_sys->state == PURGE_STATE_INIT) || (trx->undo_no == 0 && srv_fast_shutdown)); diff --git a/storage/xtradb/dict/dict0crea.cc b/storage/xtradb/dict/dict0crea.cc index 9a4040421d7..9d1312dc685 100644 --- a/storage/xtradb/dict/dict0crea.cc +++ b/storage/xtradb/dict/dict0crea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, MariaDB Corporation. 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 the Free Software @@ -1361,6 +1361,21 @@ dict_create_or_check_foreign_constraint_tables(void) row_mysql_lock_data_dictionary(trx); + DBUG_EXECUTE_IF( + "create_and_drop_garbage", + err = que_eval_sql( + NULL, + "PROCEDURE CREATE_GARBAGE_TABLE_PROC () IS\n" + "BEGIN\n" + "CREATE TABLE\n" + "\"test/#sql-ib-garbage\"(ID CHAR);\n" + "CREATE UNIQUE CLUSTERED INDEX PRIMARY" + " ON \"test/#sql-ib-garbage\"(ID);\n" + "END;\n", FALSE, trx); + ut_ad(err == DB_SUCCESS); + row_drop_table_for_mysql("test/#sql-ib-garbage", + trx, TRUE, TRUE);); + /* Check which incomplete table definition to drop. */ if (sys_foreign_err == DB_CORRUPTION) { diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index 6a32a988e30..cb6e6bbcb1f 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -4162,95 +4162,87 @@ row_drop_table_for_mysql( info = pars_info_create(); - pars_info_add_str_literal(info, "table_name", name); + pars_info_add_str_literal(info, "name", name); - err = que_eval_sql(info, - "PROCEDURE DROP_TABLE_PROC () IS\n" - "sys_foreign_id CHAR;\n" - "table_id CHAR;\n" - "index_id CHAR;\n" - "foreign_id CHAR;\n" - "space_id INT;\n" - "found INT;\n" + if (strcmp(name, "SYS_FOREIGN") && strcmp(name, "SYS_FOREIGN_COLS") + && dict_table_get_low("SYS_FOREIGN") + && dict_table_get_low("SYS_FOREIGN_COLS")) { + err = que_eval_sql( + info, + "PROCEDURE DROP_FOREIGN_PROC () IS\n" + "fid CHAR;\n" - "DECLARE CURSOR cur_fk IS\n" - "SELECT ID FROM SYS_FOREIGN\n" - "WHERE FOR_NAME = :table_name\n" - "AND TO_BINARY(FOR_NAME)\n" - " = TO_BINARY(:table_name)\n" - "LOCK IN SHARE MODE;\n" + "DECLARE CURSOR fk IS\n" + "SELECT ID FROM SYS_FOREIGN\n" + "WHERE FOR_NAME = :name\n" + "AND TO_BINARY(FOR_NAME) = TO_BINARY(:name)\n" + "FOR UPDATE;\n" - "DECLARE CURSOR cur_idx IS\n" - "SELECT ID FROM SYS_INDEXES\n" - "WHERE TABLE_ID = table_id\n" - "LOCK IN SHARE MODE;\n" + "BEGIN\n" + "OPEN fk;\n" + "WHILE 1 = 1 LOOP\n" + " FETCH fk INTO fid;\n" + " IF (SQL % NOTFOUND) THEN RETURN; END IF;\n" + " DELETE FROM SYS_FOREIGN_COLS WHERE ID = fid;\n" + " DELETE FROM SYS_FOREIGN WHERE ID = fid;\n" + "END LOOP;\n" + "CLOSE fk;\n" + "END;\n", FALSE, trx); + if (err == DB_SUCCESS) { + info = pars_info_create(); + pars_info_add_str_literal(info, "name", name); + goto do_drop; + } + } else { +do_drop: + err = que_eval_sql( + info, + "PROCEDURE DROP_TABLE_PROC () IS\n" + "table_id CHAR;\n" + "index_id CHAR;\n" - "BEGIN\n" - "SELECT ID INTO table_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = :table_name\n" - "LOCK IN SHARE MODE;\n" - "IF (SQL % NOTFOUND) THEN\n" - " RETURN;\n" - "END IF;\n" - "SELECT SPACE INTO space_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = :table_name;\n" - "IF (SQL % NOTFOUND) THEN\n" - " RETURN;\n" - "END IF;\n" - "found := 1;\n" - "SELECT ID INTO sys_foreign_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = 'SYS_FOREIGN'\n" - "LOCK IN SHARE MODE;\n" - "IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - "END IF;\n" - "IF (:table_name = 'SYS_FOREIGN') THEN\n" - " found := 0;\n" - "END IF;\n" - "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n" - " found := 0;\n" - "END IF;\n" - "OPEN cur_fk;\n" - "WHILE found = 1 LOOP\n" - " FETCH cur_fk INTO foreign_id;\n" - " IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - " ELSE\n" - " DELETE FROM SYS_FOREIGN_COLS\n" - " WHERE ID = foreign_id;\n" - " DELETE FROM SYS_FOREIGN\n" - " WHERE ID = foreign_id;\n" - " END IF;\n" - "END LOOP;\n" - "CLOSE cur_fk;\n" - "found := 1;\n" - "OPEN cur_idx;\n" - "WHILE found = 1 LOOP\n" - " FETCH cur_idx INTO index_id;\n" - " IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - " ELSE\n" - " DELETE FROM SYS_FIELDS\n" - " WHERE INDEX_ID = index_id;\n" - " DELETE FROM SYS_INDEXES\n" - " WHERE ID = index_id\n" - " AND TABLE_ID = table_id;\n" - " END IF;\n" - "END LOOP;\n" - "CLOSE cur_idx;\n" - "DELETE FROM SYS_TABLESPACES\n" - "WHERE SPACE = space_id;\n" - "DELETE FROM SYS_DATAFILES\n" - "WHERE SPACE = space_id;\n" - "DELETE FROM SYS_COLUMNS\n" - "WHERE TABLE_ID = table_id;\n" - "DELETE FROM SYS_TABLES\n" - "WHERE NAME = :table_name;\n" - "END;\n" - , FALSE, trx); + "DECLARE CURSOR cur_idx IS\n" + "SELECT ID FROM SYS_INDEXES\n" + "WHERE TABLE_ID = table_id\n" + "FOR UPDATE;\n" + + "BEGIN\n" + "SELECT ID INTO table_id\n" + "FROM SYS_TABLES WHERE NAME = :name FOR UPDATE;\n" + "IF (SQL % NOTFOUND) THEN RETURN; END IF;\n" + "OPEN cur_idx;\n" + "WHILE 1 = 1 LOOP\n" + " FETCH cur_idx INTO index_id;\n" + " IF (SQL % NOTFOUND) THEN EXIT; END IF;\n" + " DELETE FROM SYS_FIELDS\n" + " WHERE INDEX_ID = index_id;\n" + " DELETE FROM SYS_INDEXES\n" + " WHERE ID = index_id AND TABLE_ID = table_id;\n" + "END LOOP;\n" + "CLOSE cur_idx;\n" + + "DELETE FROM SYS_COLUMNS WHERE TABLE_ID = table_id;\n" + "DELETE FROM SYS_TABLES WHERE NAME = :name;\n" + + "END;\n", FALSE, trx); + + if (err == DB_SUCCESS && table->space + && dict_table_get_low("SYS_TABLESPACES") + && dict_table_get_low("SYS_DATAFILES")) { + info = pars_info_create(); + pars_info_add_int4_literal(info, "id", + lint(table->space)); + err = que_eval_sql( + info, + "PROCEDURE DROP_SPACE_PROC () IS\n" + "BEGIN\n" + "DELETE FROM SYS_TABLESPACES\n" + "WHERE SPACE = :id;\n" + "DELETE FROM SYS_DATAFILES\n" + "WHERE SPACE = :id;\n" + "END;\n", FALSE, trx); + } + } switch (err) { ibool is_temp; @@ -4395,7 +4387,6 @@ row_drop_table_for_mysql( case DB_OUT_OF_FILE_SPACE: err = DB_MUST_GET_MORE_FILE_SPACE; - trx->error_state = err; row_mysql_handle_errors(&err, trx, NULL, NULL); diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc index 57bd11bacc3..09a5f0591b0 100644 --- a/storage/xtradb/trx/trx0purge.cc +++ b/storage/xtradb/trx/trx0purge.cc @@ -255,7 +255,7 @@ trx_purge_add_update_undo_to_history( in fast shutdown, we may roll back transactions (trx->undo_no==0) in THD::cleanup() invoked from unlink_thd(). */ ut_ad(srv_undo_sources - || ((srv_startup_is_before_trx_rollback_phase + || ((srv_is_being_started || trx_rollback_or_clean_is_active) && purge_sys->state == PURGE_STATE_INIT) || (trx->undo_no == 0 && srv_fast_shutdown)); From 57898316b6fb8920cb68a473c33edbb583da4d89 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 30 Oct 2018 18:15:41 +0400 Subject: [PATCH 3/6] MDEV-17256 Decimal field multiplication bug. We should clear trailing zeroes in frac part. Otherwise that tail is growing quickly and forces unnecessary truncating of arguments. --- mysql-test/r/type_newdecimal.result | 42 +++++++++++++++++++++++++++ mysql-test/t/type_newdecimal.test | 44 +++++++++++++++++++++++++++++ strings/decimal.c | 35 ++++++++++++----------- 3 files changed, 105 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 3cd5028f858..81d1637947c 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1997,3 +1997,45 @@ select 0.0000000001 mod 1; select 0.01 mod 1; 0.01 mod 1 0.01 +CREATE TABLE t1 ( +`FLD1` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD2` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD3` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD4` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD5` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD6` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD7` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD8` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD9` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD10` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD11` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD12` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD13` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD14` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD15` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD16` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD17` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD18` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD19` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD20` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD21` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD22` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD23` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000 +); +INSERT INTO t1 VALUES (001.0760,000.9500,001.0000,001.0000,001.0000, +001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.5949,001.0194, +001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.9220,001.1890,001.2130,327.2690); +select FLD1*FLD2*FLD3*FLD4*FLD5*FLD6*FLD7*FLD8*FLD9*FLD10*FLD11*FLD12*FLD13*FLD14*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD23 as calc1 from t1; +calc1 +269.775757576440530322187032000000 +select FLD23*FLD2*FLD1*FLD4*FLD5*FLD11*FLD12*FLD13*FLD3*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD14*FLD6*FLD7*FLD8*FLD9*FLD10 as calc2 from t1; +calc2 +269.775757576440530322187032000000 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT 1.0 * 2.000; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `1.0 * 2.000` decimal(6,4) NOT NULL DEFAULT '0.0000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index bb5a61d84ec..adc8eb77198 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1581,3 +1581,47 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1; select 0.0000000001 mod 1; select 0.01 mod 1; +# +# MDEV-17256 Decimal field multiplication bug +# + +CREATE TABLE t1 ( + `FLD1` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD2` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD3` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD4` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD5` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD6` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD7` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD8` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD9` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD10` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD11` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD12` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD13` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD14` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD15` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD16` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD17` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD18` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD19` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD20` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD21` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD22` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD23` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000 +); + +INSERT INTO t1 VALUES (001.0760,000.9500,001.0000,001.0000,001.0000, + 001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.5949,001.0194, + 001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.9220,001.1890,001.2130,327.2690); + +select FLD1*FLD2*FLD3*FLD4*FLD5*FLD6*FLD7*FLD8*FLD9*FLD10*FLD11*FLD12*FLD13*FLD14*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD23 as calc1 from t1; +select FLD23*FLD2*FLD1*FLD4*FLD5*FLD11*FLD12*FLD13*FLD3*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD14*FLD6*FLD7*FLD8*FLD9*FLD10 as calc2 from t1; + +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT 1.0 * 2.000; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + diff --git a/strings/decimal.c b/strings/decimal.c index 3d90a58ea8a..05546aa77a3 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -2077,26 +2077,21 @@ int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to) } } - /* Now we have to check for -0.000 case */ - if (to->sign) + /* Remove trailing zero words in frac part */ + frac0= ROUND_UP(to->frac); + + if (frac0 > 0 && to->buf[intg0 + frac0 - 1] == 0) { - dec1 *buf= to->buf; - dec1 *end= to->buf + intg0 + frac0; - DBUG_ASSERT(buf != end); - for (;;) + do { - if (*buf) - break; - if (++buf == end) - { - /* We got decimal zero */ - decimal_make_zero(to); - break; - } - } + frac0--; + } while (frac0 > 0 && to->buf[intg0 + frac0 - 1] == 0); + to->frac= DIG_PER_DEC1 * frac0; } + + /* Remove heading zero words in intg part */ buf1= to->buf; - d_to_move= intg0 + ROUND_UP(to->frac); + d_to_move= intg0 + frac0; while (!*buf1 && (to->intg > DIG_PER_DEC1)) { buf1++; @@ -2109,6 +2104,14 @@ int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to) for (; d_to_move--; cur_d++, buf1++) *cur_d= *buf1; } + + /* Now we have to check for -0.000 case */ + if (to->sign && to->frac == 0 && to->buf[0] == 0) + { + DBUG_ASSERT(to->intg <= DIG_PER_DEC1); + /* We got decimal zero */ + decimal_make_zero(to); + } return error; } From a737135ae39dafe8b1136386ce23dfa8bed877f9 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Tue, 30 Oct 2018 18:15:58 +0200 Subject: [PATCH 4/6] List of unstable tests for 10.0.37 release --- mysql-test/unstable-tests | 82 +++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index e8bb02f51e0..6725e2ae9ff 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,9 +23,9 @@ # ############################################################################## -# Based on 10.0 e52315a4a2c7e752e786f9fcf63b0b5685b0d474 +# Based on 10.0 6ced789186fabd7dce97b3d6d171ff9e5ddc5f48 -main.alter_table : Modified in 10.0.36 +main.alter_table : Modified in 10.0.37 main.assign_key_cache : Added in 10.0.36 main.assign_key_cache_debug : Added in 10.0.36 main.auto_increment : Modified in 10.0.36 @@ -33,39 +33,45 @@ main.bootstrap : Modified in 10.0.36 main.connect_debug : Added in 10.0.36 main.count_distinct2 : MDEV-11768 - timeout main.create_delayed : MDEV-10605 - failed with timeout -main.create_or_replace : Modified in 10.0.36 -ctype_binary : Modified in 10.0.36 -ctype_eucjpms : Modified in 10.0.36 -ctype_euckr : Modified in 10.0.36 -ctype_gbk : Modified in 10.0.36 -ctype_latin1 : Modified in 10.0.36 -ctype_ucs : Modified in 10.0.36 -ctype_ujis : Modified in 10.0.36 -ctype_utf16le : Modified in 10.0.36 -ctype_utf16 : Modified in 10.0.36 -ctype_utf32 : Modified in 10.0.36 -ctype_utf8mb4 : Modified in 10.0.36 -ctype_utf8 : Modified in 10.0.36 +main.create_or_replace : Modified in 10.0.37 +main.ctype_binary : Modified in 10.0.36 +main.ctype_eucjpms : Modified in 10.0.36 +main.ctype_euckr : Modified in 10.0.36 +main.ctype_gbk : Modified in 10.0.36 +main.ctype_latin1 : Modified in 10.0.36 +main.ctype_uca : Modified in 10.0.37 +main.ctype_ucs : Modified in 10.0.36 +main.ctype_ujis : Modified in 10.0.36 +main.ctype_utf16le : Modified in 10.0.36 +main.ctype_utf16 : Modified in 10.0.36 +main.ctype_utf32 : Modified in 10.0.36 +main.ctype_utf8mb4 : Modified in 10.0.36 +main.ctype_utf8 : Modified in 10.0.36 main.debug_sync : MDEV-10607 - internal error main.derived : Modified in 10.0.36 -main.derived_opt : MDEV-11768 - timeout +main.derived_opt : MDEV-11768 - timeout; modified in 10.0.37 main.events_slowlog : MDEV-12821 - wrong result -main.gis : MDEV-13411 - wrong result on P8 -main.grant : Modified in 10.0.36 +main.func_concat : Modified in 10.0.37 +main.func_isnull : Modified in 10.0.37 +main.func_time : Modified in 10.0.37 +main.gis : MDEV-13411 - wrong result on P8; modified in 10.0.37 +main.grant : Modified in 10.0.37 main.grant2 : Modified in 10.0.36 main.grant_not_windows : Added in 10.0.36 +main.group_min_max : Modified in 10.0.37 main.having : Modified in 10.0.36 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - wrong result main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure main.insert_select : Modified in 10.0.36 -main.join : Modified in 10.0.36 +main.join : Modified in 10.0.37 main.join_cache : Modified in 10.0.36 main.join_outer : Modified in 10.0.36 main.kill_processlist-6619 : MDEV-10793 - wrong result main.limit : Modified in 10.0.36 main.log_tables-big : MDEV-13408 - wrong result +main.lowercase_fs_off : Modified in 10.0.37 main.mdev-504 : MDEV-10607 - sporadic "can't connect" main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" @@ -77,26 +83,32 @@ main.mysqlhotcopy_myisam : MDEV-10995 - test hangs on debug build main.mysqlslap : Modified in 10.0.36 main.mysqltest : MDEV-9269 - fails on Alpha main.mysql_client_test_nonblock : MDEV-15096 - exec failed +main.order_by_zerolength-4285 : Modified in 10.0.37 +main.partition_explicit_prune : Modified in 10.0.37 main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count main.rename : Modified in 10.0.36 main.query_cache_debug : MDEV-15281 - resize or similar command in progress -main.selectivity : Modified in 10.0.36 +main.selectivity : Modified in 10.0.37 main.show_explain : MDEV-10674 - wrong result +main.sp : Modified in 10.0.37 main.sp-innodb : Modified in 10.0.36 main.sp_notembedded : MDEV-10607 - internal error -main.sp-security : MDEV-10607 - sporadic "can't connect" +main.sp-security : MDEV-10607 - sporadic "can't connect"; modified in 10.0.37 main.statistics : Modified in 10.0.36 main.statistics_close : Added in 10.0.36 -main.stat_tables : Modified in 10.0.36 +main.stat_tables : Modified in 10.0.37 main.stat_tables_par_innodb : MDEV-14155 - wrong rounding main.subselect : Modified in 10.0.36 +main.subselect_extra_no_semijoin : Modified in 10.0.37 main.subselect_innodb : MDEV-10614 - sporadic wrong results main.subselect_sj : Modified in 10.0.36 main.subselect_sj_mat : Modified in 10.0.36 main.subselect_sj2_mat : Modified in 10.0.36 main.subselect4 : Modified in 10.0.36 main.tc_heuristic_recover : MDEV-15200 - wrong error on mysqld_stub_cmd -main.type_datetime : MDEV-14322 - wrong result +main.type_datetime : Modified in 10.0.37 +main.type_float : Modified in 10.0.37 +main.type_year : Modified in 10.0.37 main.union : Modified in 10.0.36 main.xa : MDEV-11769 - lock wait timeout @@ -148,14 +160,19 @@ handler.ps : Added in 10.0.36 #---------------------------------------------------------------- heap.heap_auto_increment : Modified in 10.0.36 +heap.heap_btree : Modified in 10.0.37 #---------------------------------------------------------------- +innodb.alter_inplace_perfschema : Added in 10.0.37 innodb.alter_partitioned_xa : Added in 10.0.36 innodb.binlog_consistent : MDEV-10618 - Server fails to start +innodb.foreign-keys : Modified in 10.0.37 +innodb.foreign_key : Added in 10.0.37 innodb.group_commit_crash : MDEV-11770 - checksum mismatch innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - checksum mismatch innodb.innodb-alter : Modified in 10.0.36 +innodb.innodb-alter-debug : Modified in 10.0.37 innodb.innodb-alter-table : MDEV-10619 - Testcase timeout innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan innodb.innodb_bug48024 : MDEV-14352 - Assertion failure @@ -167,9 +184,11 @@ innodb.log_file_size : MDEV-15668 - Not found pattern innodb.recovery_shutdown : MDEV-15671 - Warning: database page corruption innodb.rename_table : Added in 10.0.36 innodb.table_definition_cache_debug : MDEV-14206 - Unexpected warning +innodb.table_flags : Modified in 10.0.37 innodb.xa_recovery : MDEV-15279 - mysqld got exception innodb_fts.basic : Added in 10.0.36 +innodb_fts.fts_kill_query : Modified in 10.0.37 innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.sync_ddl : Added in 10.0.36 @@ -177,8 +196,10 @@ innodb_fts.sync_ddl : Added in 10.0.36 #---------------------------------------------------------------- maria.alter : Modified in 10.0.36 +maria.create : Added in 10.0.37 +maria.fulltext2 : Added in 10.0.37 maria.lock : Modified in 10.0.36 -maria.maria : MDEV-14430 - Wrong result; modified in 10.0.36 +maria.maria : MDEV-14430 - Wrong result; modified in 10.0.37 #---------------------------------------------------------------- @@ -205,9 +226,11 @@ parts.partition_auto_increment_archive : MDEV-16491 - Table marked as crashed parts.partition_auto_increment_maria : MDEV-14430 - wrong result parts.partition_exch_qa_10 : MDEV-11765 - wrong result parts.truncate_locked : Added in 10.0.36 +parts.update_and_cache : Added in 10.0.37 #---------------------------------------------------------------- +perfschema.connect_attrs : MDEV-17283 - Wrong result perfschema.func_file_io : MDEV-5708 - fails for s390x perfschema.func_mutex : MDEV-5708 - fails for s390x perfschema.hostcache_ipv6_ssl : MDEV-10696 - crash on shutdown @@ -219,7 +242,6 @@ perfschema_stress.* : MDEV-10996 - tests not maintained #---------------------------------------------------------------- plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url, MDEV-11118 - wrong result -plugins.processlist : MDEV-16818 - Added in 10.0.36 plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.0.36 plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc, MDEV-14295 - wrong result @@ -231,11 +253,13 @@ roles.create_and_grant_role : MDEV-11772 - wrong result rpl.last_insert_id : MDEV-10625 - warnings in error log rpl.rename : Added in 10.0.36 +rpl.rpl_15919 : Added in 10.0.37 rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master rpl.rpl_ddl : MDEV-10417 - Fails on Mips +rpl.rpl_foreign_key_innodb : Modified in 10.0.37 rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown rpl.rpl_gtid_until : MDEV-10625 - warnings in error log @@ -244,6 +268,7 @@ rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips +rpl.rpl_lcase_tblnames_rewrite_db : Added in 10.0.37 rpl.rpl_mdev6020 : MDEV-10417 - Timeouts, fails on Mips rpl.rpl_mixed_implicit_commit_binlog : Included file modified in 10.0.36 rpl.rpl_parallel : MDEV-10653 - Timeouts @@ -254,13 +279,16 @@ rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start rpl.rpl_row_implicit_commit_binlog : Included file modified in 10.0.36 rpl.rpl_row_index_choice : MDEV-13409 - Server crash +rpl.rpl_row_lcase_tblnames : Added in 10.0.37 rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_row_spatial : Added in 10.0.37 rpl.rpl_semi_sync : MDEV-11220 - Wrong result rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status rpl.rpl_show_slave_hosts : MDEV-12171 - Server failed to start rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock rpl.rpl_stm_implicit_commit_binlog : Included file modified in 10.0.36 +rpl.rpl_stm_lcase_tblnames : Added in 10.0.37 rpl.rpl_sync : MDEV-10633 - Database page corruption rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries @@ -294,6 +322,8 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout #---------------------------------------------------------------- sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x +sys_vars.innodb_ft_result_cache_limit_32 : Added in 10.0.37 +sys_vars.innodb_ft_result_cache_limit_64 : Added in 10.0.37 sys_vars.thread_cache_size_func : MDEV-11775 - wrong result #---------------------------------------------------------------- @@ -314,6 +344,8 @@ tokudb.savepoint-5 : MDEV-15280 - wrong result tokudb_backup.* : MDEV-11001 - tests don't work +tokudb_bugs.PS-3773 : Added in 10.0.37 +tokudb_bugs.alter_table_comment_rebuild_data : Added in 10.0.37 tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output tokudb_bugs.frm_store : MDEV-12823 - Valgrind From 250c5aa02cd6d0dd68b5ae3f1ddc35be951c1349 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 30 Oct 2018 20:13:15 +0100 Subject: [PATCH 5/6] ./mtr --gdb='b mysql_parse;r' --gdb now accepts an argument, it will be passed to gdb as a command. multiple commands can be separated by a (non-standard and not escapable) delimiter - semicolon (;). Old usage with a bare --gdb continues to work too, of course. Cherry-picked c47c0ca50c4 5441bbd3b1f 339b9055791 --- mysql-test/mysql-test-run.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ade3f99104e..8253af5fbbd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1140,7 +1140,7 @@ sub command_line_setup { 'debug' => \$opt_debug, 'debug-common' => \$opt_debug_common, 'debug-server' => \$opt_debug_server, - 'gdb' => \$opt_gdb, + 'gdb=s' => \$opt_gdb, 'client-gdb' => \$opt_client_gdb, 'manual-gdb' => \$opt_manual_gdb, 'manual-lldb' => \$opt_manual_lldb, @@ -1234,6 +1234,9 @@ sub command_line_setup { 'skip-test-list=s' => \@opt_skip_test_list ); + # fix options (that take an optional argument and *only* after = sign + my %fixopt = ( '--gdb' => '--gdb=#' ); + @ARGV = map { $fixopt{$_} or $_ } @ARGV; GetOptions(%options) or usage("Can't read options"); usage("") if $opt_usage; list_options(\%options) if $opt_list_options; @@ -5992,7 +5995,9 @@ sub gdb_arguments { # Put $args into a single string $input = $input ? "< $input" : ""; - if ($type ne 'client' and $opt_valgrind_mysqld) { + if ($type eq 'client') { + mtr_tofile($gdb_init_file, "set args @$$args $input"); + } elsif ($opt_valgrind_mysqld) { my $v = $$exe; my $vargs = []; valgrind_arguments($vargs, \$v); @@ -6002,7 +6007,11 @@ shell sleep 1 target remote | /usr/lib64/valgrind/../../bin/vgdb EOF } else { - mtr_tofile($gdb_init_file, "set args @$$args $input\n"); + mtr_tofile($gdb_init_file, + join("\n", + "set args @$$args $input", + split /;/, $opt_gdb || "" + )); } if ( $opt_manual_gdb ) From 31f1fe223e3ca0f2a44f7e55df05f096552ae61e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 30 Oct 2018 20:19:56 +0100 Subject: [PATCH 6/6] don't try to build with OpenSSL 1.1+ --- cmake/ssl.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index 6f7bd92c777..0c6cde31299 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -79,7 +79,8 @@ MACRO (MYSQL_CHECK_SSL) HAVE_ERR_remove_thread_state) SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_LIBRARIES) - IF(OPENSSL_FOUND AND CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH) + IF(OPENSSL_FOUND AND OPENSSL_VERSION VERSION_LESS "1.1.0" AND + CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH) SET(SSL_SOURCES "") SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY}) SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})