packages (MYSQL_5_1): mysql/mysql-innodb_bug60788.patch (NEW), mysql/mysql-...

arekm arekm at pld-linux.org
Mon Jun 13 09:02:50 CEST 2011


Author: arekm                        Date: Mon Jun 13 07:02:50 2011 GMT
Module: packages                      Tag: MYSQL_5_1
---- Log message:
- up to 5.1.57

---- Files affected:
packages/mysql:
   mysql-innodb_bug60788.patch (NONE -> 1.1.2.1)  (NEW), mysql-innodb_expand_fast_index_creation.patch (NONE -> 1.1.2.1)  (NEW)

---- Diffs:

================================================================
Index: packages/mysql/mysql-innodb_bug60788.patch
diff -u /dev/null packages/mysql/mysql-innodb_bug60788.patch:1.1.2.1
--- /dev/null	Mon Jun 13 09:02:50 2011
+++ packages/mysql/mysql-innodb_bug60788.patch	Mon Jun 13 09:02:42 2011
@@ -0,0 +1,124 @@
+# name       : innodb_bug60788.patch
+# maintainer : Alexey
+#
+# Fix for MySQL bug #60788: InnoDB crashes with an assertion failure when 
+#                           receiving a signal on pwrite()
+#
+# Changes InnoDB IO code so that fsync(), pread() and pwrite() are restarted
+# when interrupted by a signal.
+#
+diff -ruN a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c
+--- a/storage/innodb_plugin/os/os0file.c	2011-04-18 13:21:07.000000000 +0400
++++ b/storage/innodb_plugin/os/os0file.c	2011-04-18 17:38:21.000000000 +0400
+@@ -1978,6 +1978,9 @@
+ 			failures++;
+ 
+ 			retry = TRUE;
++		} else if (ret == -1 && errno == EINTR) {
++			/* Handle signal interruptions correctly */
++			retry = TRUE;
+ 		} else {
+ 
+ 			retry = FALSE;
+@@ -2109,6 +2112,7 @@
+ 	off_t	offs;
+ #if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
+ 	ssize_t	n_bytes;
++	ssize_t n_read;
+ #endif /* HAVE_PREAD && !HAVE_BROKEN_PREAD */
+ 	ulint		sec;
+ 	ulint		ms;
+@@ -2149,7 +2153,18 @@
+ 	os_n_pending_reads++;
+ 	os_mutex_exit(os_file_count_mutex);
+ 
+-	n_bytes = pread(file, buf, (ssize_t)n, offs);
++	/* Handle signal interruptions correctly */
++	for (n_bytes = 0; n_bytes < (ssize_t) n; ) {
++		n_read = pread(file, buf, (ssize_t)n, offs);
++		if (n_read > 0) {
++			n_bytes += n_read;
++			offs += n_read;
++		} else if (n_read == -1 && errno == EINTR) {
++			continue;
++		} else {
++			break;
++		}
++	}
+ 
+ 	os_mutex_enter(os_file_count_mutex);
+ 	os_file_n_pending_preads--;
+@@ -2168,6 +2183,7 @@
+ 	{
+ 		off_t	ret_offset;
+ 		ssize_t	ret;
++		ssize_t n_read;
+ #ifndef UNIV_HOTBACKUP
+ 		ulint	i;
+ #endif /* !UNIV_HOTBACKUP */
+@@ -2188,7 +2204,17 @@
+ 		if (ret_offset < 0) {
+ 			ret = -1;
+ 		} else {
+-			ret = read(file, buf, (ssize_t)n);
++			/* Handle signal interruptions correctly */
++			for (ret = 0; ret < (ssize_t) n; ) {
++				n_read = read(file, buf, (ssize_t)n);
++				if (n_read > 0) {
++					ret += n_read;
++				} else if (n_read == -1 && errno == EINTR) {
++					continue;
++				} else {
++					break;
++				}
++			}
+ 		}
+ 
+ #ifndef UNIV_HOTBACKUP
+@@ -2227,6 +2253,7 @@
+ 				offset */
+ {
+ 	ssize_t	ret;
++	ssize_t n_written;
+ 	off_t	offs;
+ 
+ 	ut_a((offset & 0xFFFFFFFFUL) == offset);
+@@ -2254,7 +2281,18 @@
+ 	os_n_pending_writes++;
+ 	os_mutex_exit(os_file_count_mutex);
+ 
+-	ret = pwrite(file, buf, (ssize_t)n, offs);
++	/* Handle signal interruptions correctly */
++	for (ret = 0; ret < (ssize_t) n; ) {
++		n_written = pwrite(file, buf, (ssize_t)n, offs);
++		if (n_written > 0) {
++			ret += n_written;
++			offs += n_written;
++		} else if (n_written == -1 && errno == EINTR) {
++			continue;
++		} else {
++			break;
++		}
++	}
+ 
+ 	os_mutex_enter(os_file_count_mutex);
+ 	os_file_n_pending_pwrites--;
+@@ -2301,7 +2339,17 @@
+ 			goto func_exit;
+ 		}
+ 
+-		ret = write(file, buf, (ssize_t)n);
++		/* Handle signal interruptions correctly */
++		for (ret = 0; ret < (ssize_t) n; ) {
++			n_written = write(file, buf, (ssize_t)n);
++			if (n_written > 0) {
++				ret += n_written;
++			} else if (n_written == -1 && errno == EINTR) {
++				continue;
++			} else {
++				break;
++			}
++		}
+ 
+ # ifdef UNIV_DO_FLUSH
+ 		if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC

================================================================
Index: packages/mysql/mysql-innodb_expand_fast_index_creation.patch
diff -u /dev/null packages/mysql/mysql-innodb_expand_fast_index_creation.patch:1.1.2.1
--- /dev/null	Mon Jun 13 09:02:50 2011
+++ packages/mysql/mysql-innodb_expand_fast_index_creation.patch	Mon Jun 13 09:02:42 2011
@@ -0,0 +1,742 @@
+# name       : innodb_expand_fast_index_creation.patch
+# maintainer : Alexey
+#
+# Expands the applicability of InnoDB fast index creation to mysqldump,
+# ALTER TABLE and OPTIMIZE TABLE.
+#
+diff -ruN a/client/client_priv.h b/client/client_priv.h
+--- a/client/client_priv.h	2011-04-11 23:22:54.000000000 +0400
++++ b/client/client_priv.h	2011-04-11 23:22:55.000000000 +0400
+@@ -97,5 +97,6 @@
+   OPT_FIRST_SLAVE,
+   OPT_ALL,
+   OPT_NO_REMOVE_EOL_CARRET,
++  OPT_INNODB_OPTIMIZE_KEYS,
+   OPT_MAX_CLIENT_OPTION
+ };
+diff -ruN a/client/mysqldump.c b/client/mysqldump.c
+--- a/client/mysqldump.c	2011-04-11 23:22:49.000000000 +0400
++++ b/client/mysqldump.c	2011-04-11 23:22:55.000000000 +0400
+@@ -45,6 +45,7 @@
+ #include <m_ctype.h>
+ #include <hash.h>
+ #include <stdarg.h>
++#include <my_list.h>
+ 
+ #include "client_priv.h"
+ #include "mysql.h"
+@@ -134,6 +135,8 @@
+ 
+ static my_bool server_supports_sql_no_fcache= FALSE;
+ 
++static my_bool opt_innodb_optimize_keys= FALSE;
++
+ /*
+ Dynamic_string wrapper functions. In this file use these
+ wrappers, they will terminate the process if there is
+@@ -179,6 +182,8 @@
+ 
+ HASH ignore_table;
+ 
++LIST *skipped_keys_list;
++
+ static struct my_option my_long_options[] =
+ {
+   {"all", OPT_ALL, "Deprecated. Use --create-options instead.",
+@@ -325,6 +330,11 @@
+    "be specified with both database and table names, e.g., "
+    "--ignore-table=database.table.",
+    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
++  {"innodb-optimize-keys", OPT_INNODB_OPTIMIZE_KEYS,
++   "Use InnoDB fast index creation by creating secondary indexes after "
++   "dumping the data.",
++   &opt_innodb_optimize_keys, &opt_innodb_optimize_keys, 0, GET_BOOL, NO_ARG,
++   0, 0, 0, 0, 0, 0},
+   {"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
+    &opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
+    0, 0},
+@@ -2246,6 +2256,77 @@
+ }
+ 
+ /*
++  Remove secondary/foreign key definitions from a given SHOW CREATE TABLE string
++  and store them into a temporary list to be used later.
++
++  SYNOPSIS
++    skip_secondary_keys()
++    create_str                SHOW CREATE TABLE output
++
++
++  DESCRIPTION
++
++    Stores all lines starting with "KEY" or "UNIQUE KEY" or "CONSTRAINT"
++    into skipped_keys_list and removes them from the input string.
++    Ignoring FOREIGN KEYS constraints when creating the table is ok, because
++    mysqldump sets foreign_key_checks to 0 anyway.
++*/
++
++static void skip_secondary_keys(char *create_str)
++{
++  char *ptr, *strend;
++  char *last_comma = NULL;
++
++  strend= create_str + strlen(create_str);
++
++  ptr= create_str;
++  while (*ptr)
++  {
++    char *tmp, *orig_ptr;
++
++    orig_ptr= ptr;
++    /* Skip leading whitespace */
++    while (*ptr && my_isspace(charset_info, *ptr))
++      ptr++;
++
++    /* Read the next line */
++    for (tmp= ptr; *tmp != '\n' && *tmp != '\0'; tmp++);
++
++    /* Is it a secondary index definition? */
++    if (*tmp == '\n' &&
++        (!strncmp(ptr, "UNIQUE KEY ", sizeof("UNIQUE KEY ") - 1) ||
++         !strncmp(ptr, "KEY ", sizeof("KEY ") - 1) ||
++         !strncmp(ptr, "CONSTRAINT ", sizeof("CONSTRAINT ") - 1)))
++    {
++      char *data, *end= tmp - 1;
++
++      /* Remove the trailing comma */
++      if (*end == ',')
++        end--;
++      data= my_strndup(ptr, end - ptr + 1, MYF(MY_FAE));
++      skipped_keys_list= list_cons(data, skipped_keys_list);
++
++      memmove(orig_ptr, tmp + 1, strend - tmp);
++      ptr= orig_ptr;
++      strend-= tmp + 1 - ptr;
++
++      /* Remove the comma on the previos line */
++      if (last_comma != NULL)
++      {
++        *last_comma= ' ';
++        last_comma = NULL;
++      }
++    }
++    else
++    {
++      if (tmp[-1] == ',')
++        last_comma= tmp - 1;
++      ptr= (*tmp == '\0') ? tmp : tmp + 1;
++    }
++  }
++}
++
++/*
+   get_table_structure -- retrievs database structure, prints out corresponding
+   CREATE statement and fills out insert_pat if the table is the type we will
+   be dumping.
+@@ -2486,6 +2567,9 @@
+ 
+       row= mysql_fetch_row(result);
+ 
++      if (opt_innodb_optimize_keys && !strcmp(table_type, "InnoDB"))
++        skip_secondary_keys(row[1]);
++
+       fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
+               "/*!40101 SET @saved_cs_client     = @@character_set_client */;\n"
+               "/*!40101 SET character_set_client = utf8 */;\n"
+@@ -3578,6 +3662,27 @@
+       goto err;
+     }
+ 
++    /* Perform delayed secondary index creation for --innodb-optimize-keys */
++    if (skipped_keys_list)
++    {
++      uint keys;
++      skipped_keys_list= list_reverse(skipped_keys_list);
++      fprintf(md_result_file, "ALTER TABLE %s ", opt_quoted_table);
++      for (keys= list_length(skipped_keys_list); keys > 0; keys--)
++      {
++        LIST *node= skipped_keys_list;
++        char *def= node->data;
++
++        fprintf(md_result_file, "ADD %s%s", def, (keys > 1) ? ", " : ";\n");
++
++        skipped_keys_list= list_delete(skipped_keys_list, node);
++        my_free(def, MYF(0));
++        my_free(node, MYF(0));
++      }
++
++      DBUG_ASSERT(skipped_keys_list == NULL);
++    }
++
+     /* Moved enable keys to before unlock per bug 15977 */
+     if (opt_disable_keys)
+     {
+diff -ruN /dev/null b/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result	2011-04-11 23:22:55.000000000 +0400
+@@ -0,0 +1,109 @@
++#
++# Test the --innodb-optimize-keys option.
++#
++CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, KEY(b)) ENGINE=MyISAM;
++######################################
++
++/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
++/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
++/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
++/*!40101 SET NAMES utf8 */;
++/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
++/*!40103 SET TIME_ZONE='+00:00' */;
++/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
++/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
++/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
++/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
++DROP TABLE IF EXISTS `t1`;
++/*!40101 SET @saved_cs_client     = @@character_set_client */;
++/*!40101 SET character_set_client = utf8 */;
++CREATE TABLE `t1` (
++  `a` int(11) NOT NULL,
++  `b` int(11) DEFAULT NULL,
++  PRIMARY KEY (`a`),
++  KEY `b` (`b`)
++) ENGINE=MyISAM DEFAULT CHARSET=latin1;
++/*!40101 SET character_set_client = @saved_cs_client */;
++
++LOCK TABLES `t1` WRITE;
++/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
++/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
++UNLOCK TABLES;
++/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
++
++/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
++/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
++/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
++/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
++/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
++/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
++/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
++
++######################################
++DROP TABLE t1;
++CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
++INSERT INTO t2 VALUES (0), (1), (2);
++CREATE TABLE t1 (
++id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
++a INT, b VARCHAR(255), c DECIMAL(10,3),
++KEY (b),
++UNIQUE KEY uniq(c,a),
++FOREIGN KEY (a) REFERENCES t2(a) ON DELETE CASCADE
++) ENGINE=InnoDB;
++INSERT INTO t1(a,b,c) VALUES (0, "0", 0.0), (1, "1", 1.1), (2, "2", 2.2);
++######################################
++
++/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
++/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
++/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
++/*!40101 SET NAMES utf8 */;
++/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
++/*!40103 SET TIME_ZONE='+00:00' */;
++/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
++/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
++/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
++/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
++DROP TABLE IF EXISTS `t1`;
++/*!40101 SET @saved_cs_client     = @@character_set_client */;
++/*!40101 SET character_set_client = utf8 */;
++CREATE TABLE `t1` (
++  `id` int(11) NOT NULL AUTO_INCREMENT,
++  `a` int(11) DEFAULT NULL,
++  `b` varchar(255) DEFAULT NULL,
++  `c` decimal(10,3) DEFAULT NULL,
++  PRIMARY KEY (`id`) 
++) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
++/*!40101 SET character_set_client = @saved_cs_client */;
++
++LOCK TABLES `t1` WRITE;
++/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
++INSERT INTO `t1` VALUES (1,0,'0','0.000'),(2,1,'1','1.100'),(3,2,'2','2.200');
++ALTER TABLE `t1` ADD UNIQUE KEY `uniq` (`c`,`a`), ADD KEY `b` (`b`), ADD KEY `a` (`a`), ADD CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`) ON DELETE CASCADE;
++/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
++UNLOCK TABLES;
++DROP TABLE IF EXISTS `t2`;
++/*!40101 SET @saved_cs_client     = @@character_set_client */;
++/*!40101 SET character_set_client = utf8 */;
++CREATE TABLE `t2` (
++  `a` int(11) NOT NULL,
++  PRIMARY KEY (`a`)
++) ENGINE=InnoDB DEFAULT CHARSET=latin1;
++/*!40101 SET character_set_client = @saved_cs_client */;
++
++LOCK TABLES `t2` WRITE;
++/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
++INSERT INTO `t2` VALUES (0),(1),(2);
++/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
++UNLOCK TABLES;
++/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
++
++/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
++/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
++/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
++/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
++/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
++/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
++/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
++
++######################################
++DROP TABLE t1, t2;
+diff -ruN a/mysql-test/suite/innodb_plugin/r/innodb.result b/mysql-test/suite/innodb_plugin/r/innodb.result
+--- a/mysql-test/suite/innodb_plugin/r/innodb.result	2011-02-11 22:49:37.000000000 +0300
++++ b/mysql-test/suite/innodb_plugin/r/innodb.result	2011-04-11 23:22:55.000000000 +0400
+@@ -1679,7 +1679,7 @@
+ 71
+ SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
+ variable_value - @innodb_rows_inserted_orig
+-1067
++1109
+ SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
+ variable_value - @innodb_rows_updated_orig
+ 866
+diff -ruN a/mysql-test/suite/innodb_plugin/t/innodb-index.test b/mysql-test/suite/innodb_plugin/t/innodb-index.test
+--- a/mysql-test/suite/innodb_plugin/t/innodb-index.test	2011-02-11 22:49:34.000000000 +0300
++++ b/mysql-test/suite/innodb_plugin/t/innodb-index.test	2011-04-11 23:22:55.000000000 +0400
+@@ -38,6 +38,11 @@
+ show create table t1;
+ --error ER_MULTIPLE_PRI_KEY
+ alter table t1 add primary key (c);
++# Suppress the error log messages occuring on duplicate key error
++# during ALTER TABLE when using fast index creation
++--disable_query_log
++call mtr.add_suppression("Cannot find index PRIMARY in InnoDB index translation table.");
++--enable_query_log
+ --error ER_DUP_ENTRY
+ alter table t1 drop primary key, add primary key (b);
+ create unique index c on t1 (c);
+diff -ruN a/mysql-test/suite/innodb_plugin/t/innodb.test b/mysql-test/suite/innodb_plugin/t/innodb.test
+--- a/mysql-test/suite/innodb_plugin/t/innodb.test	2011-02-11 22:49:35.000000000 +0300
++++ b/mysql-test/suite/innodb_plugin/t/innodb.test	2011-04-11 23:22:55.000000000 +0400
+@@ -15,6 +15,12 @@
+ 
+ -- source include/have_innodb_plugin.inc
+ 
++# Suppress the error log message occuring on duplicate key error
++# during ALTER TABLE when using fast index creation
++--disable_query_log
++call mtr.add_suppression("Cannot find index v_2 in InnoDB index translation table.");
++--enable_query_log
++
+ let $MYSQLD_DATADIR= `select @@datadir`;
+ 
+ # Save the original values of some variables in order to be able to
+diff -ruN /dev/null b/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ b/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test	2011-04-11 23:22:55.000000000 +0400
+@@ -0,0 +1,62 @@
++# Embedded server doesn't support external clients
++--source include/not_embedded.inc
++
++# Fast index creation is only available in InnoDB plugin
++--source include/have_innodb_plugin.inc
++
++# Save the initial number of concurrent sessions
++--source include/count_sessions.inc
++
++--echo #
++--echo # Test the --innodb-optimize-keys option.
++--echo #
++
++--let $file=$MYSQLTEST_VARDIR/tmp/t1.sql
++
++# First test that the option has no effect on non-InnoDB tables
++
++CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b INT, KEY(b)) ENGINE=MyISAM;
++
++--exec $MYSQL_DUMP --skip-comments --innodb-optimize-keys test t1 >$file
++
++--echo ######################################
++--cat_file $file
++--echo ######################################
++
++--remove_file $file
++
++DROP TABLE t1;
++
++
++# Check that for InnoDB tables secondary and foreign keys are created
++# after the data is dumped
++
++CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
++INSERT INTO t2 VALUES (0), (1), (2);
++
++CREATE TABLE t1 (
++  id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
++  a INT, b VARCHAR(255), c DECIMAL(10,3),
++  KEY (b),
++  UNIQUE KEY uniq(c,a),
++  FOREIGN KEY (a) REFERENCES t2(a) ON DELETE CASCADE
++) ENGINE=InnoDB;
++
++INSERT INTO t1(a,b,c) VALUES (0, "0", 0.0), (1, "1", 1.1), (2, "2", 2.2);
++
++--exec $MYSQL_DUMP --skip-comments --innodb-optimize-keys test t1 t2 >$file
++
++--echo ######################################
++--cat_file $file
++--echo ######################################
++
++# Check that the resulting dump can be imported back
++
++--exec $MYSQL test < $file
++
++--remove_file $file
++
++DROP TABLE t1, t2;
++
++# Wait till we reached the initial number of concurrent sessions
++--source include/wait_until_count_sessions.inc
+diff -ruN a/sql/sql_lex.cc b/sql/sql_lex.cc
+--- a/sql/sql_lex.cc	2011-04-11 23:22:49.000000000 +0400
++++ b/sql/sql_lex.cc	2011-04-11 23:22:55.000000000 +0400
+@@ -1494,6 +1494,9 @@
+   alter_list(rhs.alter_list, mem_root),
+   key_list(rhs.key_list, mem_root),
+   create_list(rhs.create_list, mem_root),
++  delayed_key_list(rhs.delayed_key_list, mem_root),
++  delayed_key_info(rhs.delayed_key_info),
++  delayed_key_count(rhs.delayed_key_count),
+   flags(rhs.flags),
+   keys_onoff(rhs.keys_onoff),
+   tablespace_op(rhs.tablespace_op),
+@@ -1516,6 +1519,7 @@
+   list_copy_and_replace_each_value(alter_list, mem_root);
+   list_copy_and_replace_each_value(key_list, mem_root);
+   list_copy_and_replace_each_value(create_list, mem_root);
++  list_copy_and_replace_each_value(delayed_key_list, mem_root);
+   /* partition_names are not deeply copied currently */
+ }
+ 
+diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h
+--- a/sql/sql_lex.h	2011-04-11 23:22:50.000000000 +0400
++++ b/sql/sql_lex.h	2011-04-11 23:22:55.000000000 +0400
+@@ -896,6 +896,9 @@
+   List<Alter_column>            alter_list;
+   List<Key>                     key_list;
+   List<Create_field>            create_list;
++  List<Key>                     delayed_key_list;
++  KEY                           *delayed_key_info;
++  uint                          delayed_key_count;
+   uint                          flags;
+   enum enum_enable_or_disable   keys_onoff;
+   enum tablespace_op_type       tablespace_op;
+@@ -907,6 +910,8 @@
+ 
+ 
+   Alter_info() :
++    delayed_key_info(NULL),
++    delayed_key_count(0),
+     flags(0),
+     keys_onoff(LEAVE_AS_IS),
+     tablespace_op(NO_TABLESPACE_OP),
+@@ -922,6 +927,9 @@
+     alter_list.empty();
+     key_list.empty();
+     create_list.empty();
++    delayed_key_list.empty();
++    delayed_key_info= NULL;
++    delayed_key_count= 0;
+     flags= 0;
+     keys_onoff= LEAVE_AS_IS;
+     tablespace_op= NO_TABLESPACE_OP;
+diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
+--- a/sql/sql_table.cc	2011-04-11 23:22:40.000000000 +0400
++++ b/sql/sql_table.cc	2011-04-11 23:44:23.000000000 +0400
+@@ -2559,7 +2559,7 @@
+       file                      The handler for the new table.
+       key_info_buffer     OUT   An array of KEY structs for the indexes.
+       key_count           OUT   The number of elements in the array.
+-      select_field_count        The number of fields coming from a select table.
++      select_field_count        The number of fields coming from a select table. 
+ 
+   DESCRIPTION
+     Prepares the table and key structures for table creation.
+@@ -2914,7 +2914,6 @@
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list