MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:September 29 2009 8:55am
Subject:bzr push into mysql-pe branch (mattias.jonsson:3628 to 3629)
View as plain text  
 3629 Mattias Jonsson	2009-09-29 [merge]
      merge

    added:
      mysql-test/include/have_not_innodb_plugin.inc
      mysql-test/r/not_true.require
      mysql-test/r/partition_innodb_builtin.result
      mysql-test/r/partition_innodb_plugin.result
      mysql-test/t/partition_innodb_builtin.test
      mysql-test/t/partition_innodb_plugin.test
    modified:
      mysql-test/t/disabled.def
      sql/mysql_priv.h
      sql/sql_table.cc
 3628 Sergey Glukhov	2009-09-29 [merge]
      5.1-bugteam->mysql-pe merge
     @ mysql-test/t/join.test
        5.1-bugteam->mysql-pe merge
     @ sql/item.cc
        5.1-bugteam->mysql-pe merge

    modified:
      mysql-test/r/join.result
      mysql-test/t/join.test
      sql/item.cc
=== added file 'mysql-test/include/have_not_innodb_plugin.inc'
--- a/mysql-test/include/have_not_innodb_plugin.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_not_innodb_plugin.inc	2009-09-25 09:26:49 +0000
@@ -0,0 +1,4 @@
+disable_query_log;
+--require r/not_true.require
+select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB';
+enable_query_log;

=== added file 'mysql-test/r/not_true.require'
--- a/mysql-test/r/not_true.require	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/not_true.require	2009-09-25 09:26:49 +0000
@@ -0,0 +1,2 @@
+TRUE
+NULL

=== added file 'mysql-test/r/partition_innodb_builtin.result'
--- a/mysql-test/r/partition_innodb_builtin.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_innodb_builtin.result	2009-09-25 09:26:49 +0000
@@ -0,0 +1,39 @@
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+(SUBPARTITION `sp0``\""e`,
+SUBPARTITION `sp1``\""e`),
+PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+(SUBPARTITION `sp2``\""e`,
+SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+# con1
+SET NAMES utf8;
+START TRANSACTION;
+# default connection
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+# con1
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+# default connection
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+# First table reported in 'SHOW ENGINE InnoDB STATUS'
+SHOW ENGINE InnoDB STATUS;
+Type	Name	Status
+InnoDB		index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+SHOW ENGINE InnoDB STATUS;
+Type	Name	Status
+InnoDB		index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @@sql_mode = @old_sql_mode;
+# con1
+ROLLBACK;
+# default connection
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;

=== added file 'mysql-test/r/partition_innodb_plugin.result'
--- a/mysql-test/r/partition_innodb_plugin.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_innodb_plugin.result	2009-09-25 09:26:49 +0000
@@ -0,0 +1,50 @@
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+(SUBPARTITION `sp0``\""e`,
+SUBPARTITION `sp1``\""e`),
+PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+(SUBPARTITION `sp2``\""e`,
+SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+# con1
+SET NAMES utf8;
+START TRANSACTION;
+# default connection
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+# con1
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+# default connection
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+lock_table	COUNT(*)
+`test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */	2
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+lock_table	COUNT(*)
+"test"."t`\""""e" /* Partition "p0`\""""e", Subpartition "sp0`\""""e" */	2
+set @@sql_mode = @old_sql_mode;
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+# First table reported in 'SHOW ENGINE InnoDB STATUS'
+SHOW ENGINE InnoDB STATUS;
+Type	Name	Status
+InnoDB		index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+SHOW ENGINE InnoDB STATUS;
+Type	Name	Status
+InnoDB		index `PRIMARY` of table `test`.`t``\""e` /* Partition `p0``\""e`, Subpartition `sp0``\""e` */
+set @@sql_mode = @old_sql_mode;
+# con1
+ROLLBACK;
+# default connection
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2009-09-23 08:41:13 +0000
+++ b/mysql-test/t/disabled.def	2009-09-29 08:40:52 +0000
@@ -15,3 +15,5 @@ query_cache_28249    : Bug#43861 2009-03
 information_schema   : Bug#42893 2009-03-26 alik main.information_schema times out sporadically
 skip_name_resolve    : Bug#43006 2009-06-25 alik main.skip_name_resolve fails on Windows in PB2
 mysql_locale_posix   : Bug#46131 2009-07-11 alik main.mysql_locale_posix fais, thus disabled
+partition_innodb_builtin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
+partition_innodb_plugin  : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes

=== added file 'mysql-test/t/partition_innodb_builtin.test'
--- a/mysql-test/t/partition_innodb_builtin.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_innodb_builtin.test	2009-09-25 09:26:49 +0000
@@ -0,0 +1,67 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+--source include/have_not_innodb_plugin.inc
+
+#
+# Bug#32430 - show engine innodb status causes errors
+#
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+ (SUBPARTITION `sp0``\""e`,
+  SUBPARTITION `sp1``\""e`),
+ PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+ (SUBPARTITION `sp2``\""e`,
+  SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+--echo # con1
+connect(con1,localhost,root,,);
+SET NAMES utf8;
+START TRANSACTION;
+--echo # default connection
+connection default;
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+--echo # con1
+connection con1;
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+let $id_1= `SELECT CONNECTION_ID()`;
+SEND;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+--echo # default connection
+connection default;
+let $wait_timeout= 2;
+let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE ID = $id_1 AND STATE = 'Searching rows for update';
+--source include/wait_condition.inc
+#--echo # tested wait condition $wait_condition_reps times
+--error ER_LOCK_DEADLOCK
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+--echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
+# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
+# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
+# trx id 0 775
+# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
+# on big texts, removing a lot of text before + after makes it much faster.
+#/.*in (.*) trx.*/\1/
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+# INNODB_LOCKS only exists in innodb_plugin
+#SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @@sql_mode = @old_sql_mode;
+--echo # con1
+connection con1;
+REAP;
+ROLLBACK;
+disconnect con1;
+--echo # default connection
+connection default;
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;

=== added file 'mysql-test/t/partition_innodb_plugin.test'
--- a/mysql-test/t/partition_innodb_plugin.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_innodb_plugin.test	2009-09-25 09:26:49 +0000
@@ -0,0 +1,75 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+--source suite/innodb/include/have_innodb_plugin.inc
+
+#
+# Bug#32430 - show engine innodb status causes errors
+#
+SET NAMES utf8;
+CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
+ENGINE=InnoDB
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION `p0``\""e` VALUES LESS THAN (100)
+ (SUBPARTITION `sp0``\""e`,
+  SUBPARTITION `sp1``\""e`),
+ PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
+ (SUBPARTITION `sp2``\""e`,
+  SUBPARTITION `sp3``\""e`));
+INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
+START TRANSACTION;
+--echo # con1
+connect(con1,localhost,root,,);
+SET NAMES utf8;
+START TRANSACTION;
+--echo # default connection
+connection default;
+UPDATE `t``\""e` SET a = 16 WHERE a = 0;
+--echo # con1
+connection con1;
+UPDATE `t``\""e` SET a = 8 WHERE a = 22;
+let $id_1= `SELECT CONNECTION_ID()`;
+SEND;
+UPDATE `t``\""e` SET a = 12 WHERE a = 0;
+--echo # default connection
+connection default;
+let $wait_timeout= 2;
+let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE ID = $id_1 AND STATE = 'Searching rows for update';
+--source include/wait_condition.inc
+#--echo # tested wait condition $wait_condition_reps times
+# INNODB_LOCKS only exists in innodb_plugin
+--sorted_result
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+--sorted_result
+SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
+GROUP BY lock_table;
+set @@sql_mode = @old_sql_mode;
+--error ER_LOCK_DEADLOCK
+UPDATE `t``\""e` SET a = 4 WHERE a = 22;
+--echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
+# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
+# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
+# trx id 0 775
+# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
+# on big texts, removing a lot of text before + after makes it much faster.
+#/.*in (.*) trx.*/\1/
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @old_sql_mode = @@sql_mode;
+set sql_mode = 'ANSI_QUOTES';
+--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
+SHOW ENGINE InnoDB STATUS;
+set @@sql_mode = @old_sql_mode;
+--echo # con1
+connection con1;
+REAP;
+ROLLBACK;
+disconnect con1;
+--echo # default connection
+connection default;
+DROP TABLE `t``\""e`;
+SET NAMES DEFAULT;

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-09-16 08:23:16 +0000
+++ b/sql/mysql_priv.h	2009-09-29 08:40:52 +0000
@@ -2285,10 +2285,9 @@ enum enum_explain_filename_mode
 {
   EXPLAIN_ALL_VERBOSE= 0,
   EXPLAIN_PARTITIONS_VERBOSE,
-  EXPLAIN_PARTITIONS_AS_COMMENT,
-  EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING
+  EXPLAIN_PARTITIONS_AS_COMMENT
 };
-uint explain_filename(const char *from, char *to, uint to_length,
+uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
                       enum_explain_filename_mode explain_mode);
 uint filename_to_tablename(const char *from, char *to, uint to_length);
 uint tablename_to_filename(const char *from, char *to, uint to_length);

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2009-09-28 02:27:49 +0000
+++ b/sql/sql_table.cc	2009-09-29 08:40:52 +0000
@@ -72,15 +72,21 @@ static void wait_for_kill_signal(THD *th
 
 /**
   @brief Helper function for explain_filename
+  @param thd          Thread handle
+  @param to_p         Explained name in system_charset_info
+  @param end_p        End of the to_p buffer
+  @param name         Name to be converted
+  @param name_len     Length of the name, in bytes
 */
-static char* add_identifier(char *to_p, const char * end_p,
-                           const char* name, uint name_len, bool add_quotes)
+static char* add_identifier(THD* thd, char *to_p, const char * end_p,
+                            const char* name, uint name_len)
 {
   uint res;
   uint errors;
   const char *conv_name;
   char tmp_name[FN_REFLEN];
   char conv_string[FN_REFLEN];
+  int quote;
 
   DBUG_ENTER("add_identifier");
   if (!name[name_len])
@@ -104,19 +110,21 @@ static char* add_identifier(char *to_p, 
     conv_name= conv_string;
   }
 
-  if (add_quotes && (end_p - to_p > 2))
+  quote = thd ? get_quote_char_for_identifier(thd, conv_name, res - 1) : '"';
+
+  if (quote != EOF && (end_p - to_p > 2))
   {
-    *(to_p++)= '`';
+    *(to_p++)= (char) quote;
     while (*conv_name && (end_p - to_p - 1) > 0)
     {
       uint length= my_mbcharlen(system_charset_info, *conv_name);
       if (!length)
         length= 1;
-      if (length == 1 && *conv_name == '`')
+      if (length == 1 && *conv_name == (char) quote)
       { 
         if ((end_p - to_p) < 3)
           break;
-        *(to_p++)= '`';
+        *(to_p++)= (char) quote;
         *(to_p++)= *(conv_name++);
       }
       else if (((long) length) < (end_p - to_p))
@@ -127,7 +135,11 @@ static char* add_identifier(char *to_p, 
       else
         break;                               /* string already filled */
     }
-    to_p= strnmov(to_p, "`", end_p - to_p);
+    if (end_p > to_p) {
+      *(to_p++)= (char) quote;
+      if (end_p > to_p)
+	*to_p= 0; /* terminate by NUL, but do not include it in the count */
+    }
   }
   else
     to_p= strnmov(to_p, conv_name, end_p - to_p);
@@ -147,6 +159,7 @@ static char* add_identifier(char *to_p, 
   diagnostic, error etc. when it would be useful to know what a particular
   file [and directory] means. Such as SHOW ENGINE STATUS, error messages etc.
 
+   @param      thd          Thread handle
    @param      from         Path name in my_charset_filename
                             Null terminated in my_charset_filename, normalized
                             to use '/' as directory separation character.
@@ -163,13 +176,12 @@ static char* add_identifier(char *to_p, 
                             [,[ Temporary| Renamed] Partition `p`
                             [, Subpartition `sp`]] *|
                             (| is really a /, and it is all in one line)
-                            EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING ->
-                            same as above but no quotes are added.
 
    @retval     Length of returned string
 */
 
-uint explain_filename(const char *from,
+uint explain_filename(THD* thd,
+		      const char *from,
                       char *to,
                       uint to_length,
                       enum_explain_filename_mode explain_mode)
@@ -283,14 +295,12 @@ uint explain_filename(const char *from,
     {
       to_p= strnmov(to_p, ER(ER_DATABASE_NAME), end_p - to_p);
       *(to_p++)= ' ';
-      to_p= add_identifier(to_p, end_p, db_name, db_name_len, 1);
+      to_p= add_identifier(thd, to_p, end_p, db_name, db_name_len);
       to_p= strnmov(to_p, ", ", end_p - to_p);
     }
     else
     {
-      to_p= add_identifier(to_p, end_p, db_name, db_name_len,
-                           (explain_mode !=
-                            EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+      to_p= add_identifier(thd, to_p, end_p, db_name, db_name_len);
       to_p= strnmov(to_p, ".", end_p - to_p);
     }
   }
@@ -298,16 +308,13 @@ uint explain_filename(const char *from,
   {
     to_p= strnmov(to_p, ER(ER_TABLE_NAME), end_p - to_p);
     *(to_p++)= ' ';
-    to_p= add_identifier(to_p, end_p, table_name, table_name_len, 1);
+    to_p= add_identifier(thd, to_p, end_p, table_name, table_name_len);
   }
   else
-    to_p= add_identifier(to_p, end_p, table_name, table_name_len,
-                         (explain_mode !=
-                          EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+    to_p= add_identifier(thd, to_p, end_p, table_name, table_name_len);
   if (part_name)
   {
-    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT ||
-        explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)
+    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT)
       to_p= strnmov(to_p, " /* ", end_p - to_p);
     else if (explain_mode == EXPLAIN_PARTITIONS_VERBOSE)
       to_p= strnmov(to_p, " ", end_p - to_p);
@@ -323,20 +330,15 @@ uint explain_filename(const char *from,
     }
     to_p= strnmov(to_p, ER(ER_PARTITION_NAME), end_p - to_p);
     *(to_p++)= ' ';
-    to_p= add_identifier(to_p, end_p, part_name, part_name_len,
-                         (explain_mode !=
-                          EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+    to_p= add_identifier(thd, to_p, end_p, part_name, part_name_len);
     if (subpart_name)
     {
       to_p= strnmov(to_p, ", ", end_p - to_p);
       to_p= strnmov(to_p, ER(ER_SUBPARTITION_NAME), end_p - to_p);
       *(to_p++)= ' ';
-      to_p= add_identifier(to_p, end_p, subpart_name, subpart_name_len,
-                           (explain_mode !=
-                            EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING));
+      to_p= add_identifier(thd, to_p, end_p, subpart_name, subpart_name_len);
     }
-    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT ||
-        explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT_NO_QUOTING)
+    if (explain_mode == EXPLAIN_PARTITIONS_AS_COMMENT)
       to_p= strnmov(to_p, " */", end_p - to_p);
   }
   DBUG_PRINT("exit", ("to '%s'", to));


Attachment: [text/bzr-bundle]
Thread
bzr push into mysql-pe branch (mattias.jonsson:3628 to 3629)Mattias Jonsson29 Sep