List:Commits« Previous MessageNext Message »
From:marko.makela Date:June 28 2011 12:40pm
Subject:bzr push into mysql-trunk branch (marko.makela:3238 to 3239)
View as plain text  
 3239 Marko Mäkelä	2011-06-28 [merge]
      Merge mysql-5.5 to mysql-trunk.

    modified:
      mysql-test/suite/innodb/r/innodb-use-sys-malloc.result
      mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt
      mysql-test/suite/innodb/t/innodb-use-sys-malloc.test
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/db0err.h
      storage/innobase/row/row0mysql.c
      storage/innobase/ut/ut0ut.c
 3238 Marko Mäkelä	2011-06-28 [merge]
      Merge mysql-5.5 to mysql-trunk.

    modified:
      storage/innobase/page/page0zip.c
=== modified file 'mysql-test/suite/innodb/r/innodb-use-sys-malloc.result'
--- a/mysql-test/suite/innodb/r/innodb-use-sys-malloc.result	revid:marko.makela@stripped093032-gq5gwkdq2py6aaos
+++ b/mysql-test/suite/innodb/r/innodb-use-sys-malloc.result	revid:marko.makela@stripped-20110628123614-di9ixvbj3jrnzycj
@@ -9,40 +9,45 @@ SELECT @@GLOBAL.innodb_use_sys_malloc;
 @@GLOBAL.innodb_use_sys_malloc
 1
 1 Expected
-drop table if exists t1;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
+create table t1(a int not null,key(a,a)) engine=innodb DEFAULT CHARSET=latin1;
+ERROR 42S21: Duplicate column name 'a'
+create table t1(a int,b text,key(b(768))) engine=innodb DEFAULT CHARSET=latin1;
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
+create table t1(a int not null,b text) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
+create index t1aa on t1(a,a);
+ERROR 42S21: Duplicate column name 'a'
+create index t1b on t1(b(768));
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  `b` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
 select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
-drop table t1;
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-SET @@GLOBAL.innodb_use_sys_malloc=0;
-ERROR HY000: Variable 'innodb_use_sys_malloc' is a read only variable
-Expected error 'Read only variable'
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-drop table if exists t1;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
+a	b
+1	
+2	
+3	
+4	
+5	
+6	
+7	
 drop table t1;
+CREATE TABLE t2(a int primary key, b text) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
+CREATE INDEX t2aa on t2(a,a);
+ERROR 42S21: Duplicate column name 'a'
+CREATE INDEX t2b on t2(b(768));
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
+SELECT * FROM t2;
+a	b
+1	
+2	
+3	
+4	
+5	
+6	
+7	
+DROP TABLE t2;

=== modified file 'mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt'
--- a/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt	revid:marko.makela@strippedaos
+++ b/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt	revid:marko.makela@strippeddi9ixvbj3jrnzycj
@@ -1,3 +1,2 @@
---default-storage-engine=MyISAM
---loose-innodb-use-sys-malloc=true
---loose-innodb-use-sys-malloc=true
+--innodb-use-sys-malloc=true
+--innodb-large-prefix=true

=== modified file 'mysql-test/suite/innodb/t/innodb-use-sys-malloc.test'
--- a/mysql-test/suite/innodb/t/innodb-use-sys-malloc.test	revid:marko.makela@stripped
+++ b/mysql-test/suite/innodb/t/innodb-use-sys-malloc.test	revid:marko.makela@stripped
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+-- source include/have_innodb.inc
 
 #display current value of innodb_use_sys_malloc
 SELECT @@GLOBAL.innodb_use_sys_malloc;
@@ -13,36 +13,33 @@ SELECT @@GLOBAL.innodb_use_sys_malloc;
 --echo 1 Expected
 
 
-#do some stuff to see if it works.
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
+# Do some stuff to see if it works.
+# Also, test the code paths of
+# Bug #12699505 MEMORY LEAK IN ROW_CREATE_INDEX_FOR_MYSQL()
+# (the leak would only be triggered if
+# ha_innobase::max_supported_key_part_length() were set
+# higher than the limit used in row_create_index_for_mysql())
+
+--error ER_DUP_FIELDNAME
+create table t1(a int not null,key(a,a)) engine=innodb DEFAULT CHARSET=latin1;
+# thanks to --innodb-large-prefix=1 this will not be truncated to b(767)
+-- error ER_INDEX_COLUMN_TOO_LONG
+create table t1(a int,b text,key(b(768))) engine=innodb DEFAULT CHARSET=latin1;
+create table t1(a int not null,b text) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
+--error ER_DUP_FIELDNAME
+create index t1aa on t1(a,a);
+-- error ER_INDEX_COLUMN_TOO_LONG
+create index t1b on t1(b(768));
+SHOW CREATE TABLE t1;
 select * from t1;
-drop table t1;
---source include/have_innodb.inc
 
-#display current value of innodb_use_sys_malloc
-SELECT @@GLOBAL.innodb_use_sys_malloc;
---echo 1 Expected
-
-#try changing it. Should fail.
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.innodb_use_sys_malloc=0;
---echo Expected error 'Read only variable'
-
-SELECT @@GLOBAL.innodb_use_sys_malloc;
---echo 1 Expected
-
-
-#do some stuff to see if it works.
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
 drop table t1;
+CREATE TABLE t2(a int primary key, b text) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
+--error ER_DUP_FIELDNAME
+CREATE INDEX t2aa on t2(a,a);
+-- error ER_INDEX_COLUMN_TOO_LONG
+CREATE INDEX t2b on t2(b(768));
+SELECT * FROM t2;
+DROP TABLE t2;

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@strippedos
+++ b/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@stripped
@@ -1155,7 +1155,6 @@ convert_error_code_to_mysql(
 						misleading, a new MySQL error
 						code should be introduced */
 
-	case DB_COL_APPEARS_TWICE_IN_INDEX:
 	case DB_CORRUPTION:
 		return(HA_ERR_CRASHED);
 

=== modified file 'storage/innobase/include/db0err.h'
--- a/storage/innobase/include/db0err.h	revid:marko.makela@stripped8093032-gq5gwkdq2py6aaos
+++ b/storage/innobase/include/db0err.h	revid:marko.makela@strippedxvbj3jrnzycj
@@ -64,8 +64,6 @@ enum db_err {
 	DB_CANNOT_ADD_CONSTRAINT,	/* adding a foreign key constraint
 					to a table failed */
 	DB_CORRUPTION,			/* data structure corruption noticed */
-	DB_COL_APPEARS_TWICE_IN_INDEX,	/* InnoDB cannot handle an index
-					where same column appears twice */
 	DB_CANNOT_DROP_CONSTRAINT,	/* dropping a foreign key constraint
 					from a table failed */
 	DB_NO_SAVEPOINT,		/* no savepoint exists with the given

=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c	revid:marko.makela@oracle.com-20110628093032-gq5gwkdq2py6aaos
+++ b/storage/innobase/row/row0mysql.c	revid:marko.makela@stripped28123614-di9ixvbj3jrnzycj
@@ -2028,41 +2028,13 @@ row_create_index_for_mysql(
 
 	trx_start_if_not_started_xa(trx);
 
-	/* Check that the same column does not appear twice in the index.
-	Starting from 4.0.14, InnoDB should be able to cope with that, but
-	safer not to allow them. */
-
-	for (i = 0; i < dict_index_get_n_fields(index); i++) {
-		ulint		j;
-
-		for (j = 0; j < i; j++) {
-			if (0 == ut_strcmp(
-				    dict_index_get_nth_field(index, j)->name,
-				    dict_index_get_nth_field(index, i)->name)) {
-				ut_print_timestamp(stderr);
-
-				fputs("  InnoDB: Error: column ", stderr);
-				ut_print_name(stderr, trx, FALSE,
-					      dict_index_get_nth_field(
-						      index, i)->name);
-				fputs(" appears twice in ", stderr);
-				dict_index_name_print(stderr, trx, index);
-				fputs("\n"
-				      "InnoDB: This is not allowed"
-				      " in InnoDB.\n", stderr);
-
-				err = DB_COL_APPEARS_TWICE_IN_INDEX;
-
-				goto error_handling;
-			}
-		}
-
-		/* Check also that prefix_len and actual length
-		is less than that from DICT_MAX_FIELD_LEN_BY_FORMAT() */
+	for (i = 0; i < index->n_def; i++) {
+		/* Check that prefix_len and actual length
+		< DICT_MAX_INDEX_COL_LEN */
 
 		len = dict_index_get_nth_field(index, i)->prefix_len;
 
-		if (field_lengths) {
+		if (field_lengths && field_lengths[i]) {
 			len = ut_max(len, field_lengths[i]);
 		}
 
@@ -2070,6 +2042,7 @@ row_create_index_for_mysql(
 		if (len > (ulint) DICT_MAX_FIELD_LEN_BY_FORMAT(table)) {
 			err = DB_TOO_BIG_INDEX_COL;
 
+			dict_mem_index_free(index);
 			goto error_handling;
 		}
 	}

=== modified file 'storage/innobase/ut/ut0ut.c'
--- a/storage/innobase/ut/ut0ut.c	revid:marko.makela@stripped28093032-gq5gwkdq2py6aaos
+++ b/storage/innobase/ut/ut0ut.c	revid:marko.makela@strippedjrnzycj
@@ -674,8 +674,6 @@ ut_strerr(
 		return("Cannot add constraint");
 	case DB_CORRUPTION:
 		return("Data structure corruption");
-	case DB_COL_APPEARS_TWICE_IN_INDEX:
-		return("Column appears twice in index");
 	case DB_CANNOT_DROP_CONSTRAINT:
 		return("Cannot drop constraint");
 	case DB_NO_SAVEPOINT:

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marko.makela:3238 to 3239) marko.makela29 Jun