From ae12a723605f5059d73ee9284fd78ecc7583fac2 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Thu, 18 Feb 2010 10:48:15 +0200 Subject: [PATCH 1/3] Bug #51049: main.bug39022 fails in mysql-trunk-merge Fixed the test to behave correctly with ps-protocol and binlog format row. --- mysql-test/include/not_binlog_format_row.inc | 4 ++++ mysql-test/r/bug39022.result | 2 +- mysql-test/t/bug39022.test | 13 +++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 mysql-test/include/not_binlog_format_row.inc diff --git a/mysql-test/include/not_binlog_format_row.inc b/mysql-test/include/not_binlog_format_row.inc new file mode 100644 index 00000000000..f9354e7cd33 --- /dev/null +++ b/mysql-test/include/not_binlog_format_row.inc @@ -0,0 +1,4 @@ +if (`SELECT @@binlog_format = 'ROW'`) +{ + skip Test cannot run with binlog_format row; +} diff --git a/mysql-test/r/bug39022.result b/mysql-test/r/bug39022.result index 1c02d7873e4..5963709aa2a 100644 --- a/mysql-test/r/bug39022.result +++ b/mysql-test/r/bug39022.result @@ -28,5 +28,5 @@ SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d); ERROR 40001: Deadlock found when trying to get lock; try restarting transaction # in thread2 d -# in default +# in thread1; DROP TABLE t1,t2; diff --git a/mysql-test/t/bug39022.test b/mysql-test/t/bug39022.test index 1a1d10f5592..268b207e0e5 100644 --- a/mysql-test/t/bug39022.test +++ b/mysql-test/t/bug39022.test @@ -1,5 +1,6 @@ -- source include/have_log_bin.inc -- source include/have_innodb.inc +-- source include/not_binlog_format_row.inc --echo # --echo # Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees @@ -49,10 +50,14 @@ connection thread2; --echo # in thread2 REAP; -connection default; ---echo # in default - -disconnect thread1; disconnect thread2; +--source include/wait_until_disconnected.inc + +connection thread1; +--echo # in thread1; +disconnect thread1; +--source include/wait_until_disconnected.inc + +connection default; DROP TABLE t1,t2; From 13d7179a1921baa9a233d936b09087f40f38fe8d Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 19 Feb 2010 13:45:25 +0100 Subject: [PATCH 2/3] Fixed incomplete merge of 48878, embedded tests fail on Windows --- mysql-test/lib/My/ConfigFactory.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index c4d68e7127c..41b595c80e8 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -357,11 +357,14 @@ sub post_check_client_group { if (IS_WINDOWS) { - # Shared memory base may or may not be defined (e.g not defined in embedded) - my $shm = $group_to_copy_from->option("shared-memory-base-name"); - if (defined $shm) + if (! $self->{ARGS}->{embedded}) { - $config->insert($client_group_name,"shared-memory-base-name", $shm->value()); + # Shared memory base may or may not be defined (e.g not defined in embedded) + my $shm = $group_to_copy_from->option("shared-memory-base-name"); + if (defined $shm) + { + $config->insert($client_group_name,"shared-memory-base-name", $shm->value()); + } } } } From 3678457d3c707b341a7461d4d2c0e4d71e75e4f9 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Fri, 19 Feb 2010 15:16:43 +0000 Subject: [PATCH 3/3] Bug#49487: crash with explain extended and group_concat in a derived table When EXPLAIN EXTENDED tries to print column names, it checks whether the referenced table is CONST (in which case, the column's value rather than its name will be printed). If no proper table is reference (i.e. because a derived table was used that has since gone out of scope), this will fail spectacularly. This ports an equivalent of the fix for Bug 43354. --- mysql-test/r/func_gconcat.result | 17 +++++++++++++++++ mysql-test/t/func_gconcat.test | 15 +++++++++++++++ sql/item_sum.cc | 4 +++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 4dddc35e8a8..d69a340cddb 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -972,4 +972,21 @@ GROUP BY t1.a 1 1 DROP TABLE t1, t2; +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (),(); +EXPLAIN EXTENDED SELECT 1 FROM +(SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY system NULL NULL NULL NULL 1 +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort; Distinct +2 DERIVED td ALL NULL NULL NULL NULL 2 Distinct +Warnings: +Note 1003 select 1 AS `1` from (select distinct group_concat(`test`.`td`.`f1` separator ',') AS `GROUP_CONCAT(td.f1)` from `test`.`t1` join `test`.`t1` `td` group by `test`.`td`.`f1`) `d` join `test`.`t1` +SELECT 1 FROM +(SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; +1 +1 +1 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 816ac9c2959..1cbf045e95d 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -693,4 +693,19 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN DROP TABLE t1, t2; +# +# Bug #49487: crash with explain extended and group_concat in a derived table +# + +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (),(); + +EXPLAIN EXTENDED SELECT 1 FROM + (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; + +SELECT 1 FROM + (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; + +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/sql/item_sum.cc b/sql/item_sum.cc index dde8fe29e5a..4c2bde90100 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3538,6 +3538,8 @@ String* Item_func_group_concat::val_str(String* str) void Item_func_group_concat::print(String *str) { + /* orig_args is not filled with valid values until fix_fields() */ + Item **pargs= fixed ? orig_args : args; str->append(STRING_WITH_LEN("group_concat(")); if (distinct) str->append(STRING_WITH_LEN("distinct ")); @@ -3545,7 +3547,7 @@ void Item_func_group_concat::print(String *str) { if (i) str->append(','); - args[i]->print(str); + pargs[i]->print(str); } if (arg_count_order) {