List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:January 10 2011 3:13pm
Subject:bzr commit into mysql-5.5 branch (mattias.jonsson:3227)
View as plain text  
#At file:///Users/mattiasj/mysql-bzr/topush-5.5/ based on revid:mattias.jonsson@stripped

 3227 Mattias Jonsson	2011-01-10 [merge]
      merge

    modified:
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/partition_range.result
      mysql-test/r/union.result
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/partition_range.test
      mysql-test/t/union.test
      mysys/my_getopt.c
      sql/sql_admin.cc
      sql/sql_yacc.yy
=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result	2010-06-25 07:07:18 +0000
+++ b/mysql-test/r/innodb_mysql_sync.result	2011-01-10 13:12:23 +0000
@@ -66,3 +66,27 @@ SELECT ((@id := id) - id) FROM t2;
 KILL @id;
 SET DEBUG_SYNC= "now SIGNAL killed";
 DROP TABLE t1, t2;
+SET DEBUG_SYNC= "RESET";
+#
+# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
+#           OPTIMIZE TABLE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+# Connection con1
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
+# Sending:
+OPTIMIZE TABLE t1;
+# Connection default
+SET DEBUG_SYNC= 'now WAIT_FOR waiting';
+KILL QUERY ID;
+SET DEBUG_SYNC= 'now SIGNAL killed';
+# Connection con1
+# Reaping: OPTIMIZE TABLE t1
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
+test.t1	optimize	status	Operation failed
+# Connection default
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/r/partition_range.result'
--- a/mysql-test/r/partition_range.result	2010-09-13 13:56:56 +0000
+++ b/mysql-test/r/partition_range.result	2011-01-10 15:13:12 +0000
@@ -13,16 +13,16 @@ EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	a	a	5	NULL	4	Using where; Using index
 DROP TABLE t1;
-create table t1 (a int)
-partition by range (a)
+create table t1 (a DATETIME)
+partition by range (TO_DAYS(a))
 subpartition by hash(to_seconds(a))
 (partition p0 values less than (1));
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` int(11) DEFAULT NULL
+  `a` datetime DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50500 PARTITION BY RANGE (a)
+/*!50500 PARTITION BY RANGE (TO_DAYS(a))
 SUBPARTITION BY HASH (to_seconds(a))
 (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */
 drop table t1;

=== modified file 'mysql-test/r/union.result'
--- a/mysql-test/r/union.result	2010-08-18 09:35:41 +0000
+++ b/mysql-test/r/union.result	2011-01-10 12:43:12 +0000
@@ -1644,3 +1644,128 @@ b
 2
 DROP TABLE t1,t2;
 End of 5.1 tests
+#
+# Bug#57986 ORDER BY clause is not used after a UNION, 
+#           if embedded in a SELECT
+#
+CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
+CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
+INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1);
+INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1);
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1;
+c1	c2
+t1a	1
+t1b	1
+t2a	1
+t2b	1
+t1a	2
+t1b	2
+t2a	2
+t2b	2
+t1a	3
+t2a	3
+SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1;
+c1	c2
+t1a	1
+t1b	1
+t2a	1
+t2b	1
+t1a	2
+t1b	2
+t2a	2
+t2b	2
+t1a	3
+t2a	3
+SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1);
+c1	c2
+t1a	1
+t1a	2
+t1a	3
+t1b	2
+t1b	1
+t2a	1
+t2a	2
+t2a	3
+t2b	2
+t2b	1
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+(SELECT c1, c2 FROM t2)
+ORDER BY c2, c1
+) AS res;
+c1	c2
+t1a	1
+t1b	1
+t2a	1
+t2b	1
+t1a	2
+t1b	2
+t2a	2
+t2b	2
+t1a	3
+t2a	3
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+(SELECT c1, c2 FROM t2)
+ORDER BY c2 DESC, c1 LIMIT 1
+) AS res;
+c1	c2
+t1a	3
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+(SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1)
+) AS res;
+c1	c2
+t1a	1
+t1a	2
+t1a	3
+t1b	2
+t1b	1
+t2a	3
+SELECT c1, c2 FROM (
+SELECT c1, c2 FROM t1
+UNION
+SELECT c1, c2 FROM t2 
+ORDER BY c2 DESC, c1 DESC LIMIT 1
+) AS res;
+c1	c2
+t2a	3
+SELECT c1, c2 FROM (
+(
+(SELECT c1, c2 FROM t1)
+UNION
+(SELECT c1, c2 FROM t2)
+)
+ORDER BY c2 DESC, c1 ASC LIMIT 1
+) AS res;
+c1	c2
+t1a	3
+DROP TABLE t1, t2;
+#
+# Bug #58970 Problem Subquery (without referencing a table) 
+#            and Order By
+#
+SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC  LIMIT 1) AS dev;
+dev
+0
+SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev;
+dev
+1
+SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC  LIMIT 1) AS dev;
+dev
+0
+SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+dev
+1
+SELECT(SELECT 1 AS a ORDER BY a) AS dev;
+dev
+1
+SELECT(SELECT 1 AS a LIMIT 1) AS dev;
+dev
+1
+SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+dev
+1

=== modified file 'mysql-test/t/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test	2010-06-25 07:07:18 +0000
+++ b/mysql-test/t/innodb_mysql_sync.test	2011-01-10 13:12:23 +0000
@@ -104,6 +104,47 @@ SELECT ((@id := id) - id) FROM t2; 
 KILL @id;
 SET DEBUG_SYNC= "now SIGNAL killed";
 DROP TABLE t1, t2;
+disconnect con1;
+--source include/wait_until_count_sessions.inc
+SET DEBUG_SYNC= "RESET";
+
+
+--echo #
+--echo # Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
+--echo #           OPTIMIZE TABLE
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+
+--echo # Connection con1
+connect (con1,localhost,root);
+let $ID= `SELECT connection_id()`;
+SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
+--echo # Sending:
+--send OPTIMIZE TABLE t1
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR waiting';
+--replace_result $ID ID
+eval KILL QUERY $ID;
+SET DEBUG_SYNC= 'now SIGNAL killed';
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: OPTIMIZE TABLE t1
+--reap
+
+--echo # Connection default
+connection default;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+disconnect con1;
 
 
 # Check that all connections opened by test cases in this file are really

=== modified file 'mysql-test/t/partition_range.test'
--- a/mysql-test/t/partition_range.test	2010-08-11 15:55:07 +0000
+++ b/mysql-test/t/partition_range.test	2011-01-10 15:13:12 +0000
@@ -30,8 +30,8 @@ DROP TABLE t1;
 #
 #BUG#49591, Add proper version number to SHOW CREATE TABLE
 #
-create table t1 (a int)
-partition by range (a)
+create table t1 (a DATETIME)
+partition by range (TO_DAYS(a))
 subpartition by hash(to_seconds(a))
 (partition p0 values less than (1));
 show create table t1;

=== modified file 'mysql-test/t/union.test'
--- a/mysql-test/t/union.test	2010-11-06 18:21:12 +0000
+++ b/mysql-test/t/union.test	2011-01-10 12:43:12 +0000
@@ -1117,3 +1117,70 @@ DROP TABLE t1,t2;
 
 
 --echo End of 5.1 tests
+
+--echo #
+--echo # Bug#57986 ORDER BY clause is not used after a UNION, 
+--echo #           if embedded in a SELECT
+--echo #
+
+CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
+CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
+
+
+INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1);
+INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1);
+
+SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1;
+SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1;
+SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1);
+
+SELECT c1, c2 FROM (
+  SELECT c1, c2 FROM t1
+  UNION
+  (SELECT c1, c2 FROM t2)
+  ORDER BY c2, c1
+) AS res;
+
+SELECT c1, c2 FROM (
+  SELECT c1, c2 FROM t1
+  UNION
+  (SELECT c1, c2 FROM t2)
+  ORDER BY c2 DESC, c1 LIMIT 1
+) AS res;
+
+SELECT c1, c2 FROM (
+  SELECT c1, c2 FROM t1
+  UNION
+  (SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1)
+) AS res;
+
+SELECT c1, c2 FROM (
+  SELECT c1, c2 FROM t1
+  UNION
+  SELECT c1, c2 FROM t2 
+  ORDER BY c2 DESC, c1 DESC LIMIT 1
+) AS res;
+
+SELECT c1, c2 FROM (
+  (
+   (SELECT c1, c2 FROM t1)
+   UNION
+   (SELECT c1, c2 FROM t2)
+  )
+  ORDER BY c2 DESC, c1 ASC LIMIT 1
+) AS res;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug #58970 Problem Subquery (without referencing a table) 
+--echo #            and Order By
+--echo #
+
+SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC  LIMIT 1) AS dev;
+SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev;
+SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC  LIMIT 1) AS dev;
+SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
+SELECT(SELECT 1 AS a ORDER BY a) AS dev;
+SELECT(SELECT 1 AS a LIMIT 1) AS dev;
+SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2010-10-25 12:30:07 +0000
+++ b/mysys/my_getopt.c	2011-01-10 14:18:20 +0000
@@ -602,6 +602,24 @@ static char *check_struct_option(char *c
   }
 }
 
+/**
+   Parse a boolean command line argument
+
+   "ON", "TRUE" and "1" will return true,
+   other values will return false.
+
+   @param[in] argument The value argument
+   @return boolean value
+*/
+static my_bool get_bool_argument(const char *argument)
+{
+  if (!my_strcasecmp(&my_charset_latin1, argument, "true") ||
+      !my_strcasecmp(&my_charset_latin1, argument, "on"))
+    return 1;
+  else
+    return (my_bool) atoi(argument);
+}
+
 /*
   function: setval
 
@@ -629,7 +647,7 @@ static int setval(const struct my_option
 
     switch ((opts->var_type & GET_TYPE_MASK)) {
     case GET_BOOL: /* If argument differs from 0, enable option, else disable */
-      *((my_bool*) value)= (my_bool) atoi(argument) != 0;
+      *((my_bool*) value)= get_bool_argument(argument);
       break;
     case GET_INT:
       *((int*) value)= (int) getopt_ll(argument, opts, &err);

=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc	2010-11-11 17:11:05 +0000
+++ b/sql/sql_admin.cc	2011-01-10 13:12:23 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2011 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
@@ -728,7 +728,7 @@ send_result_message:
       protocol->store(operator_name, system_charset_info);
       if (result_code) // either mysql_recreate_table or analyze failed
       {
-        DBUG_ASSERT(thd->is_error());
+        DBUG_ASSERT(thd->is_error() || thd->killed);
         if (thd->is_error())
         {
           const char *err_msg= thd->stmt_da->message();

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2010-11-11 17:11:05 +0000
+++ b/sql/sql_yacc.yy	2011-01-10 12:43:12 +0000
@@ -9396,7 +9396,7 @@ table_factor:
         ;
 
 select_derived_union:
-          select_derived opt_order_clause opt_limit_clause
+          select_derived opt_union_order_or_limit
         | select_derived_union
           UNION_SYM
           union_option
@@ -9412,7 +9412,7 @@ select_derived_union:
              */
             Lex->pop_context();
           }
-          opt_order_clause opt_limit_clause
+          opt_union_order_or_limit
         ;
 
 /* The equivalent of select_init2 for nested queries. */
@@ -13862,6 +13862,11 @@ union_opt:
         | union_order_or_limit { $$= 1; }
         ;
 
+opt_union_order_or_limit:
+	  /* Empty */
+	| union_order_or_limit
+	;
+
 union_order_or_limit:
           {
             THD *thd= YYTHD;
@@ -13909,7 +13914,7 @@ query_specification:
         ;
 
 query_expression_body:
-          query_specification
+          query_specification opt_union_order_or_limit
         | query_expression_body
           UNION_SYM union_option 
           {
@@ -13917,6 +13922,7 @@ query_expression_body:
               MYSQL_YYABORT;
           }
           query_specification
+          opt_union_order_or_limit
           {
             Lex->pop_context();
             $$= $1;

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-5.5 branch (mattias.jonsson:3227) Mattias Jonsson10 Jan