List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:November 6 2009 3:46pm
Subject:bzr push into mysql-5.5-next-mr branch (alik:2932 to 2935)
View as plain text  
 2935 Alexander Nozdrin	2009-11-06 [merge]
      Auto-merge from mysql-trunk-merge.

    modified:
      extra/yassl/taocrypt/src/random.cpp
      mysql-test/lib/My/SafeProcess/safe_process_win.cc
 2934 Alexander Nozdrin	2009-11-06 [merge]
      Auto-merge from mysql-trunk-merge.

    modified:
      sql/sp_head.cc
      sql/sql_cache.cc
      sql/sql_cursor.cc
      sql/sql_parse.cc
      sql/sql_prepare.cc
      sql/sql_select.cc
 2933 Alexander Nozdrin	2009-11-06 [merge]
      Manual merge from mysql-trunk-merge.

    added:
      mysql-test/r/innodb_bug47777.result
      mysql-test/t/innodb_bug47777.test
    modified:
      mysql-test/collections/default.experimental
      mysql-test/r/innodb-autoinc.result
      mysql-test/r/innodb_bug46000.result
      mysql-test/suite/innodb/r/innodb-zip.result
      mysql-test/suite/innodb/t/disabled.def
      mysql-test/suite/innodb/t/innodb-analyze.test
      mysql-test/suite/innodb/t/innodb-zip.test
      mysql-test/suite/innodb/t/innodb_bug36169.test
      mysql-test/suite/innodb/t/innodb_bug36172.test
      mysql-test/suite/innodb/t/innodb_information_schema.test
      mysql-test/t/disabled.def
      mysql-test/t/innodb-autoinc.test
      mysql-test/t/innodb.test
      mysql-test/t/innodb_bug39438.test
      mysql-test/t/innodb_bug44369.test
      mysql-test/t/innodb_bug46000.test
      storage/innobase/ChangeLog
      storage/innobase/buf/buf0buf.c
      storage/innobase/buf/buf0flu.c
      storage/innobase/buf/buf0lru.c
      storage/innobase/fil/fil0fil.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innobase/handler/handler0alter.cc
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0buf.ic
      storage/innobase/include/page0page.ic
      storage/innobase/include/row0mysql.h
      storage/innobase/include/univ.i
      storage/innobase/os/os0file.c
      storage/innobase/os/os0proc.c
      storage/innobase/row/row0ins.c
      storage/innobase/row/row0mysql.c
      storage/innobase/srv/srv0start.c
 2932 Alexander Nozdrin	2009-11-06 [merge]
      Manual merge from mysql-trunk-merge.

    added:
      mysql-test/include/have_case_insensitive_fs.inc
      mysql-test/r/case_insensitive_fs.require
      mysql-test/r/grant_lowercase_fs.result
      mysql-test/r/sp-bugs.result
      mysql-test/suite/binlog/r/binlog_delete_and_flush_index.result
      mysql-test/suite/binlog/r/binlog_stm_do_db.result
      mysql-test/suite/binlog/t/binlog_delete_and_flush_index.test
      mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
      mysql-test/suite/binlog/t/binlog_stm_do_db.test
      mysql-test/suite/rpl/t/rpl_get_master_version_and_clock-slave.opt
      mysql-test/t/grant_lowercase_fs.test
      mysql-test/t/sp-bugs.test
    renamed:
      mysql-test/r/bug40113.result => mysql-test/r/innodb_lock_wait_timeout_1.result
      mysql-test/t/bug40113-master.opt => mysql-test/t/innodb_lock_wait_timeout_1-master.opt
      mysql-test/t/bug40113.test => mysql-test/t/innodb_lock_wait_timeout_1.test
    modified:
      Makefile.am
      client/mysql.cc
      client/mysqlbinlog.cc
      client/mysqltest.cc
      include/myisam.h
      include/mysql.h
      include/mysql.h.pp
      include/violite.h
      libmysql/libmysql.c
      libmysql/libmysql.def
      libmysqld/libmysqld.def
      mysql-test/collections/default.experimental
      mysql-test/extra/binlog_tests/drop_temp_table.test
      mysql-test/extra/rpl_tests/rpl_loaddata.test
      mysql-test/extra/rpl_tests/rpl_stm_000001.test
      mysql-test/lib/My/ConfigFactory.pm
      mysql-test/r/alter_table.result
      mysql-test/r/analyse.result
      mysql-test/r/ctype_ldml.result
      mysql-test/r/explain.result
      mysql-test/r/gis-rtree.result
      mysql-test/r/gis.result
      mysql-test/r/grant.result
      mysql-test/r/grant3.result
      mysql-test/r/join.result
      mysql-test/r/lowercase_fs_off.result
      mysql-test/r/myisam.result
      mysql-test/r/myisam_crash_before_flush_keys.result
      mysql-test/r/olap.result
      mysql-test/r/ps_grant.result
      mysql-test/r/query_cache.result
      mysql-test/r/range.result
      mysql-test/r/select.result
      mysql-test/r/sp-error.result
      mysql-test/r/subselect.result
      mysql-test/r/subselect3.result
      mysql-test/r/system_mysql_db.result
      mysql-test/r/type_newdecimal.result
      mysql-test/r/update.result
      mysql-test/r/xa.result
      mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
      mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/funcs_1/r/is_statistics.result
      mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
      mysql-test/suite/rpl/r/rpl_loaddata.result
      mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
      mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
      mysql-test/t/alter_table.test
      mysql-test/t/analyse.test
      mysql-test/t/ctype_ldml.test
      mysql-test/t/explain.test
      mysql-test/t/flush_read_lock_kill.test
      mysql-test/t/gis-rtree.test
      mysql-test/t/gis.test
      mysql-test/t/grant3.test
      mysql-test/t/join.test
      mysql-test/t/kill.test
      mysql-test/t/lowercase_fs_off.test
      mysql-test/t/myisam.test
      mysql-test/t/myisam_crash_before_flush_keys.test
      mysql-test/t/named_pipe.test
      mysql-test/t/olap.test
      mysql-test/t/query_cache.test
      mysql-test/t/range.test
      mysql-test/t/select.test
      mysql-test/t/sp-error.test
      mysql-test/t/subselect.test
      mysql-test/t/subselect3.test
      mysql-test/t/type_newdecimal.test
      mysql-test/t/update.test
      mysql-test/t/xa.test
      mysys/my_getopt.c
      mysys/typelib.c
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_fix.sql
      sql-common/client.c
      sql/field.cc
      sql/field.h
      sql/handler.cc
      sql/item.cc
      sql/item.h
      sql/item_cmpfunc.cc
      sql/item_cmpfunc.h
      sql/item_func.cc
      sql/item_func.h
      sql/item_geofunc.cc
      sql/item_subselect.cc
      sql/item_sum.cc
      sql/log.cc
      sql/log_event.cc
      sql/log_event_old.cc
      sql/my_decimal.h
      sql/mysqld.cc
      sql/opt_range.cc
      sql/records.cc
      sql/sp_head.cc
      sql/sql_acl.cc
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_plugin.cc
      sql/sql_prepare.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_update.cc
      sql/sql_yacc.yy
      sql/time.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_check.c
      storage/myisam/sort.c
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      strings/ctype-uca.c
      tests/mysql_client_test.c
      vio/vio.c
      vio/vio_priv.h
      vio/viosocket.c
      vio/viosslfactories.c
      mysql-test/r/innodb_lock_wait_timeout_1.result
      mysql-test/t/innodb_lock_wait_timeout_1.test
=== modified file 'extra/yassl/taocrypt/src/random.cpp'
--- a/extra/yassl/taocrypt/src/random.cpp	2007-01-29 15:54:40 +0000
+++ b/extra/yassl/taocrypt/src/random.cpp	2009-10-06 16:10:34 +0000
@@ -27,7 +27,6 @@
 #include <time.h>
 
 #if defined(_WIN32)
-    #define _WIN32_WINNT 0x0400
     #include <windows.h>
     #include <wincrypt.h>
 #else

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2009-11-06 14:20:27 +0000
+++ b/mysql-test/collections/default.experimental	2009-11-06 15:19:24 +0000
@@ -6,8 +6,6 @@ binlog.binlog_multi_engine              
 
 funcs_1.charset_collation_1              # depends on compile-time decisions
 
-innodb.innodb_information_schema         # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically
-
 main.ctype_gbk_binlog  @solaris          # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
 main.information_schema                  # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically
 main.innodb-autoinc*                     # Bug#47809 2009-10-04 joro innodb-autoinc.test fails with valgrind errors with the innodb plugin

=== modified file 'mysql-test/lib/My/SafeProcess/safe_process_win.cc'
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc	2009-07-23 17:01:24 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc	2009-10-06 16:10:34 +0000
@@ -50,9 +50,6 @@
            is killed.
 */
 
-/* Requires Windows 2000 or higher */
-#define _WIN32_WINNT 0x0500
-
 #include <windows.h>
 #include <stdio.h>
 #include <tlhelp32.h>

=== modified file 'mysql-test/r/innodb-autoinc.result'
--- a/mysql-test/r/innodb-autoinc.result	2009-11-05 12:10:39 +0000
+++ b/mysql-test/r/innodb-autoinc.result	2009-11-05 13:23:50 +0000
@@ -867,6 +867,7 @@ INSERT INTO t2 SELECT NULL FROM t1;
 Got one of the listed errors
 DROP TABLE t1;
 DROP TABLE t2;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
 CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
 INSERT INTO t1 VALUES (null);
 INSERT INTO t1 VALUES (null);
@@ -874,18 +875,254 @@ ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL
 SELECT * FROM t1;
 d1
 1
-3
+2
 SELECT * FROM t1;
 d1
 1
-3
+2
 INSERT INTO t1 VALUES(null);
 Got one of the listed errors
 ALTER TABLE t1 AUTO_INCREMENT = 3;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `d1` int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`d1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
 INSERT INTO t1 VALUES(null);
 SELECT * FROM t1;
 d1
 1
+2
 3
-4
 DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name	Value
+auto_increment_increment	1
+auto_increment_offset	1
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` tinyint(4) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+-127	innodb
+-1	innodb
+1	NULL
+2	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-127, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+1	NULL
+2	innodb
+3	innodb
+4	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` smallint(6) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+-32767	innodb
+-1	innodb
+1	NULL
+2	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-32757, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+1	NULL
+2	innodb
+3	innodb
+4	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` mediumint(9) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+-8388607	innodb
+-1	innodb
+1	NULL
+2	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+1	NULL
+2	innodb
+3	innodb
+4	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+-2147483647	innodb
+-1	innodb
+1	NULL
+2	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+1	NULL
+2	innodb
+3	innodb
+4	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` bigint(20) NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+-9223372036854775807	innodb
+-1	innodb
+1	NULL
+2	NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+  `c2` varchar(10) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1	c2
+1	NULL
+2	innodb
+3	innodb
+4	NULL
+DROP TABLE t1;
+CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on T1(c2);
+SHOW CREATE TABLE T1;
+Table	Create Table
+T1	CREATE TABLE `T1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  `c2` int(11) DEFAULT NULL,
+  PRIMARY KEY (`c1`),
+  KEY `i1` (`c2`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+INSERT INTO T1 (c2) values (0);
+SELECT * FROM T1;
+c1	c2
+10	0
+DROP TABLE T1;

=== modified file 'mysql-test/r/innodb_bug46000.result'
--- a/mysql-test/r/innodb_bug46000.result	2009-10-16 11:58:02 +0000
+++ b/mysql-test/r/innodb_bug46000.result	2009-11-05 13:23:50 +0000
@@ -1,17 +1,19 @@
 create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
-ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
 create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
-ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
-show errors;
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+show warnings;
 Level	Code	Message
-Error	1005	Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Warning	1280	Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error	1280	Incorrect index name 'GEN_CLUST_INDEX'
 Error	1005	Can't create table 'test.bug46000' (errno: -1)
 create table bug46000(id int) engine=innodb;
 create index GEN_CLUST_INDEX on bug46000(id);
-ERROR HY000: Can't create table '#sql-temporary' (errno: -1)
-show errors;
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+show warnings;
 Level	Code	Message
-Error	1005	Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
-Error	1005	Can't create table '#sql-temporary' (errno: -1)
+Warning	1280	Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error	1280	Incorrect index name 'GEN_CLUST_INDEX'
+Error	1030	Got error -1 from storage engine
 create index idx on bug46000(id);
 drop table bug46000;

=== added file 'mysql-test/r/innodb_bug47777.result'
--- a/mysql-test/r/innodb_bug47777.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_bug47777.result	2009-11-05 13:23:50 +0000
@@ -0,0 +1,13 @@
+create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
+insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+count(*)
+1
+update bug47777 set c2=GeomFromText('POINT(1 1)');
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+count(*)
+0
+select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+count(*)
+1
+drop table bug47777;

=== modified file 'mysql-test/suite/innodb/r/innodb-zip.result'
--- a/mysql-test/suite/innodb/r/innodb-zip.result	2009-10-19 13:36:19 +0000
+++ b/mysql-test/suite/innodb/r/innodb-zip.result	2009-11-06 15:19:24 +0000
@@ -196,13 +196,15 @@ drop table t1;
 set innodb_strict_mode = on;
 create table t1 (id int primary key) engine = innodb key_block_size = 0;
 ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16]
 Error	1005	Can't create table 'test.t1' (errno: 1478)
 create table t2 (id int primary key) engine = innodb key_block_size = 9;
 ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
 Error	1005	Can't create table 'test.t2' (errno: 1478)
 create table t3 (id int primary key) engine = innodb key_block_size = 1;
 create table t4 (id int primary key) engine = innodb key_block_size = 2;
@@ -231,26 +233,30 @@ key_block_size = 8 row_format = compress
 create table t2 (id int primary key) engine = innodb
 key_block_size = 8 row_format = redundant;
 ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
 Error	1005	Can't create table 'test.t2' (errno: 1478)
 create table t3 (id int primary key) engine = innodb
 key_block_size = 8 row_format = compact;
 ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
 Error	1005	Can't create table 'test.t3' (errno: 1478)
 create table t4 (id int primary key) engine = innodb
 key_block_size = 8 row_format = dynamic;
 ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
 Error	1005	Can't create table 'test.t4' (errno: 1478)
 create table t5 (id int primary key) engine = innodb
 key_block_size = 8 row_format = default;
 ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
 Error	1005	Can't create table 'test.t5' (errno: 1478)
 SELECT table_schema, table_name, row_format
 FROM information_schema.tables WHERE engine='innodb';
@@ -260,20 +266,26 @@ drop table t1;
 create table t1 (id int primary key) engine = innodb
 key_block_size = 9 row_format = redundant;
 ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Warning	1478	InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
 Error	1005	Can't create table 'test.t1' (errno: 1478)
 create table t2 (id int primary key) engine = innodb
 key_block_size = 9 row_format = compact;
 ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Warning	1478	InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
 Error	1005	Can't create table 'test.t2' (errno: 1478)
 create table t2 (id int primary key) engine = innodb
 key_block_size = 9 row_format = dynamic;
 ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
+Warning	1478	InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
 Error	1005	Can't create table 'test.t2' (errno: 1478)
 SELECT table_schema, table_name, row_format
 FROM information_schema.tables WHERE engine='innodb';
@@ -281,38 +293,45 @@ table_schema	table_name	row_format
 set global innodb_file_per_table = off;
 create table t1 (id int primary key) engine = innodb key_block_size = 1;
 ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
 Error	1005	Can't create table 'test.t1' (errno: 1478)
 create table t2 (id int primary key) engine = innodb key_block_size = 2;
 ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
 Error	1005	Can't create table 'test.t2' (errno: 1478)
 create table t3 (id int primary key) engine = innodb key_block_size = 4;
 ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
 Error	1005	Can't create table 'test.t3' (errno: 1478)
 create table t4 (id int primary key) engine = innodb key_block_size = 8;
 ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
 Error	1005	Can't create table 'test.t4' (errno: 1478)
 create table t5 (id int primary key) engine = innodb key_block_size = 16;
 ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
 Error	1005	Can't create table 'test.t5' (errno: 1478)
 create table t6 (id int primary key) engine = innodb row_format = compressed;
 ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
 Error	1005	Can't create table 'test.t6' (errno: 1478)
 create table t7 (id int primary key) engine = innodb row_format = dynamic;
 ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
 Error	1005	Can't create table 'test.t7' (errno: 1478)
 create table t8 (id int primary key) engine = innodb row_format = compact;
 create table t9 (id int primary key) engine = innodb row_format = redundant;
@@ -326,38 +345,45 @@ set global innodb_file_per_table = on;
 set global innodb_file_format = `0`;
 create table t1 (id int primary key) engine = innodb key_block_size = 1;
 ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
 Error	1005	Can't create table 'test.t1' (errno: 1478)
 create table t2 (id int primary key) engine = innodb key_block_size = 2;
 ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
 Error	1005	Can't create table 'test.t2' (errno: 1478)
 create table t3 (id int primary key) engine = innodb key_block_size = 4;
 ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
 Error	1005	Can't create table 'test.t3' (errno: 1478)
 create table t4 (id int primary key) engine = innodb key_block_size = 8;
 ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
 Error	1005	Can't create table 'test.t4' (errno: 1478)
 create table t5 (id int primary key) engine = innodb key_block_size = 16;
 ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
 Error	1005	Can't create table 'test.t5' (errno: 1478)
 create table t6 (id int primary key) engine = innodb row_format = compressed;
 ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
 Error	1005	Can't create table 'test.t6' (errno: 1478)
 create table t7 (id int primary key) engine = innodb row_format = dynamic;
 ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show errors;
+show warnings;
 Level	Code	Message
+Warning	1478	InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
 Error	1005	Can't create table 'test.t7' (errno: 1478)
 create table t8 (id int primary key) engine = innodb row_format = compact;
 create table t9 (id int primary key) engine = innodb row_format = redundant;

=== modified file 'mysql-test/suite/innodb/t/disabled.def'
--- a/mysql-test/suite/innodb/t/disabled.def	2009-10-13 09:42:38 +0000
+++ b/mysql-test/suite/innodb/t/disabled.def	2009-11-05 12:29:58 +0000
@@ -1,2 +1 @@
 innodb-index                  : Bug#47563 2009-06-11 svoj InnoDB: Error: table `test`.`t1#1` already exists in InnoDB internal
-innodb_information_schema     : Bug#47808 joro : innodb_information_schema.test fails when run under valgrind

=== modified file 'mysql-test/suite/innodb/t/innodb-analyze.test'
--- a/mysql-test/suite/innodb/t/innodb-analyze.test	2009-08-05 10:07:41 +0000
+++ b/mysql-test/suite/innodb/t/innodb-analyze.test	2009-11-05 13:23:50 +0000
@@ -11,6 +11,7 @@
 -- disable_result_log
 -- enable_warnings
 
+let $sample_pages=`select @@innodb_stats_sample_pages`;
 SET GLOBAL innodb_stats_sample_pages=0;
 
 # check that the value has been adjusted to 1
@@ -61,5 +62,4 @@ SET GLOBAL innodb_stats_sample_pages=16;
 ANALYZE TABLE innodb_analyze;
 
 DROP TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=DEFAULT;
+EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages;

=== modified file 'mysql-test/suite/innodb/t/innodb-zip.test'
--- a/mysql-test/suite/innodb/t/innodb-zip.test	2009-10-19 13:10:22 +0000
+++ b/mysql-test/suite/innodb/t/innodb-zip.test	2009-11-05 12:29:58 +0000
@@ -174,11 +174,11 @@ set innodb_strict_mode = on;
 
 --error ER_CANT_CREATE_TABLE
 create table t1 (id int primary key) engine = innodb key_block_size = 0;
-show errors;
+show warnings;
 
 --error ER_CANT_CREATE_TABLE
 create table t2 (id int primary key) engine = innodb key_block_size = 9;
-show errors;
+show warnings;
 
 
 create table t3 (id int primary key) engine = innodb key_block_size = 1;
@@ -204,22 +204,22 @@ key_block_size = 8 row_format = compress
 --error ER_CANT_CREATE_TABLE
 create table t2 (id int primary key) engine = innodb
 key_block_size = 8 row_format = redundant;
-show errors;
+show warnings;
 
 --error ER_CANT_CREATE_TABLE
 create table t3 (id int primary key) engine = innodb
 key_block_size = 8 row_format = compact;
-show errors;
+show warnings;
 
 --error ER_CANT_CREATE_TABLE
 create table t4 (id int primary key) engine = innodb
 key_block_size = 8 row_format = dynamic;
-show errors;
+show warnings;
 
 --error ER_CANT_CREATE_TABLE
 create table t5 (id int primary key) engine = innodb
 key_block_size = 8 row_format = default;
-show errors;
+show warnings;
 
 SELECT table_schema, table_name, row_format
 FROM information_schema.tables WHERE engine='innodb';
@@ -229,17 +229,17 @@ drop table t1;
 --error ER_CANT_CREATE_TABLE
 create table t1 (id int primary key) engine = innodb
 key_block_size = 9 row_format = redundant;
-show errors;
+show warnings;
 
 --error ER_CANT_CREATE_TABLE
 create table t2 (id int primary key) engine = innodb
 key_block_size = 9 row_format = compact;
-show errors;
+show warnings;
 
 --error ER_CANT_CREATE_TABLE
 create table t2 (id int primary key) engine = innodb
 key_block_size = 9 row_format = dynamic;
-show errors;
+show warnings;
 
 SELECT table_schema, table_name, row_format
 FROM information_schema.tables WHERE engine='innodb';
@@ -249,25 +249,25 @@ set global innodb_file_per_table = off;
 
 --error ER_CANT_CREATE_TABLE
 create table t1 (id int primary key) engine = innodb key_block_size = 1;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t2 (id int primary key) engine = innodb key_block_size = 2;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t3 (id int primary key) engine = innodb key_block_size = 4;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t4 (id int primary key) engine = innodb key_block_size = 8;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t5 (id int primary key) engine = innodb key_block_size = 16;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t6 (id int primary key) engine = innodb row_format = compressed;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t7 (id int primary key) engine = innodb row_format = dynamic;
-show errors;
+show warnings;
 create table t8 (id int primary key) engine = innodb row_format = compact;
 create table t9 (id int primary key) engine = innodb row_format = redundant;
 
@@ -281,25 +281,25 @@ set global innodb_file_format = `0`; 
 
 --error ER_CANT_CREATE_TABLE
 create table t1 (id int primary key) engine = innodb key_block_size = 1;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t2 (id int primary key) engine = innodb key_block_size = 2;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t3 (id int primary key) engine = innodb key_block_size = 4;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t4 (id int primary key) engine = innodb key_block_size = 8;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t5 (id int primary key) engine = innodb key_block_size = 16;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t6 (id int primary key) engine = innodb row_format = compressed;
-show errors;
+show warnings;
 --error ER_CANT_CREATE_TABLE
 create table t7 (id int primary key) engine = innodb row_format = dynamic;
-show errors;
+show warnings;
 create table t8 (id int primary key) engine = innodb row_format = compact;
 create table t9 (id int primary key) engine = innodb row_format = redundant;
 

=== modified file 'mysql-test/suite/innodb/t/innodb_bug36169.test'
--- a/mysql-test/suite/innodb/t/innodb_bug36169.test	2009-08-05 10:07:41 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug36169.test	2009-11-05 13:23:50 +0000
@@ -5,6 +5,8 @@
 
 -- source include/have_innodb.inc
 
+let $file_format=`select @@innodb_file_format`;
+let $file_per_table=`select @@innodb_file_per_table`;
 SET GLOBAL innodb_file_format='Barracuda';
 SET GLOBAL innodb_file_per_table=ON;
 
@@ -1153,6 +1155,5 @@ DROP TABLE IF EXISTS table4;
 DROP TABLE IF EXISTS table5;
 DROP TABLE IF EXISTS table6;
 
-SET GLOBAL innodb_file_per_table=DEFAULT;
-SET GLOBAL innodb_file_format='Antelope';
-SET GLOBAL innodb_file_format_check='Antelope';
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;

=== modified file 'mysql-test/suite/innodb/t/innodb_bug36172.test'
--- a/mysql-test/suite/innodb/t/innodb_bug36172.test	2009-08-05 10:07:41 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug36172.test	2009-11-05 13:23:50 +0000
@@ -14,6 +14,9 @@ SET storage_engine=InnoDB;
 -- disable_query_log
 -- disable_result_log
 
+let $file_format=`select @@innodb_file_format`;
+let $file_format_check=`select @@innodb_file_format_check`;
+let $file_per_table=`select @@innodb_file_per_table`;
 SET GLOBAL innodb_file_format='Barracuda';
 SET GLOBAL innodb_file_per_table=on;
 
@@ -24,7 +27,6 @@ CHECK TABLE table0 EXTENDED;
 INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col6
 0` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278';
 CHECK TABLE table0 EXTENDED;
 DROP TABLE table0;
-
-SET GLOBAL innodb_file_per_table=DEFAULT;
-SET GLOBAL innodb_file_format='Antelope';
-SET GLOBAL innodb_file_format_check='Antelope';
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;

=== modified file 'mysql-test/suite/innodb/t/innodb_information_schema.test'
--- a/mysql-test/suite/innodb/t/innodb_information_schema.test	2009-08-05 10:07:41 +0000
+++ b/mysql-test/suite/innodb/t/innodb_information_schema.test	2009-11-05 12:29:58 +0000
@@ -109,14 +109,18 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '3
 -- send
 SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
 
-# Give time to the above 2 queries to execute before continuing.
-# Without this sleep it sometimes happens that the SELECT from innodb_locks
-# executes before some of them, resulting in less than expected number
-# of rows being selected from innodb_locks.
--- sleep 0.1
-
 -- enable_result_log
 -- connection con_verify_innodb_locks
+# Wait for the above queries to execute before continuing.
+# Without this, it sometimes happens that the SELECT from innodb_locks
+# executes before some of them, resulting in less than expected number
+# of rows being selected from innodb_locks. If there is a bug and there
+# are no 14 rows in innodb_locks then this test will fail with timeout.
+let $count = 14;
+let $table = INFORMATION_SCHEMA.INNODB_LOCKS;
+-- source include/wait_until_rows_count.inc
+# the above enables the query log, re-disable it
+-- disable_query_log
 SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
 FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
 

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2009-11-06 14:20:27 +0000
+++ b/mysql-test/t/disabled.def	2009-11-06 15:19:24 +0000
@@ -10,8 +10,6 @@
 #
 ##############################################################################
 kill                     : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
-innodb_bug39438          : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows.  Note that this test is not run on windows and on embedded in PB for main trees currently"
 query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
 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
-innodb_bug46000          : Bug#47860 2009-10-16 satyab Test fails for innodb plugin 1.0.5

=== modified file 'mysql-test/t/innodb-autoinc.test'
--- a/mysql-test/t/innodb-autoinc.test	2009-11-05 12:10:39 +0000
+++ b/mysql-test/t/innodb-autoinc.test	2009-11-05 13:23:50 +0000
@@ -479,9 +479,10 @@ INSERT INTO t2 SELECT NULL FROM t1;
 DROP TABLE t1;
 DROP TABLE t2;
 #
-# BUG#44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
+# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
 # the index (PRIMARY)
 # This test requires a restart of the server
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
 CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
 INSERT INTO t1 VALUES (null);
 INSERT INTO t1 VALUES (null);
@@ -495,6 +496,123 @@ SELECT * FROM t1;
 -- error ER_AUTOINC_READ_FAILED,1467
 INSERT INTO t1 VALUES(null);
 ALTER TABLE t1 AUTO_INCREMENT = 3;
+SHOW CREATE TABLE t1;
 INSERT INTO t1 VALUES(null);
 SELECT * FROM t1;
 DROP TABLE t1;
+
+# If the user has specified negative values for an AUTOINC column then
+# InnoDB should ignore those values when setting the table's max value.
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+# TINYINT
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# SMALLINT
+#
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32757, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# MEDIUMINT
+#
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# INT
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# BIGINT
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# End negative number check
+
+##
+# 47125: auto_increment start value is ignored if an index is created
+# and engine=innodb
+#
+CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on T1(c2);
+SHOW CREATE TABLE T1;
+INSERT INTO T1 (c2) values (0);
+SELECT * FROM T1;
+DROP TABLE T1;

=== modified file 'mysql-test/t/innodb.test'
--- a/mysql-test/t/innodb.test	2009-08-12 14:39:50 +0000
+++ b/mysql-test/t/innodb.test	2009-11-05 13:23:50 +0000
@@ -1317,8 +1317,7 @@ drop table t1;
 
 # Test for testable InnoDB status variables. This test
 # uses previous ones(pages_created, rows_deleted, ...).
-# We get one of 511 or 512 randomly
---replace_result 511 512
+--replace_result 8192 8191
 SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
 SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
 SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';

=== modified file 'mysql-test/t/innodb_bug39438.test'
--- a/mysql-test/t/innodb_bug39438.test	2009-11-05 12:10:39 +0000
+++ b/mysql-test/t/innodb_bug39438.test	2009-11-05 14:06:28 +0000
@@ -9,6 +9,10 @@
 
 -- source include/have_innodb.inc
 
+--disable_query_log
+call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'");
+--enable_query_log
+
 SET storage_engine=InnoDB;
 
 # we care only that the following SQL commands do not crash the server

=== modified file 'mysql-test/t/innodb_bug44369.test'
--- a/mysql-test/t/innodb_bug44369.test	2009-10-20 09:37:07 +0000
+++ b/mysql-test/t/innodb_bug44369.test	2009-11-06 15:19:24 +0000
@@ -13,15 +13,9 @@ create table bug44369 (DB_ROW_ID int) en
 --error ER_CANT_CREATE_TABLE
 create table bug44369 (db_row_id int) engine=innodb;
 
-# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
-# errors' again.
-# show errors;
 show warnings;
 
 --error ER_CANT_CREATE_TABLE
 create table bug44369 (db_TRX_Id int) engine=innodb;
 
-# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
-# errors' again.
-# show errors;
 show warnings;

=== modified file 'mysql-test/t/innodb_bug46000.test'
--- a/mysql-test/t/innodb_bug46000.test	2009-10-16 11:58:02 +0000
+++ b/mysql-test/t/innodb_bug46000.test	2009-11-05 13:23:50 +0000
@@ -7,24 +7,22 @@
 
 # This 'create table' operation should fail because of
 # using the reserve name as its index name.
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_NAME_FOR_INDEX
 create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
 
 # Mixed upper/lower case of the reserved key words
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_NAME_FOR_INDEX
 create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
 
-show errors;
+show warnings;
 
 create table bug46000(id int) engine=innodb;
 
 # This 'create index' operation should fail.
---replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_NAME_FOR_INDEX
 create index GEN_CLUST_INDEX on bug46000(id);
 
---replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
-show errors;
+show warnings;
 
 # This 'create index' operation should succeed, no
 # temp table left from last failed create index

=== added file 'mysql-test/t/innodb_bug47777.test'
--- a/mysql-test/t/innodb_bug47777.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_bug47777.test	2009-11-05 13:23:50 +0000
@@ -0,0 +1,24 @@
+# This is the test for bug 47777. GEOMETRY
+# data is treated as BLOB data in innodb.
+# Consequently, its key value generation/storing
+# should follow the process for the BLOB
+# datatype as well.
+
+--source include/have_innodb.inc
+
+create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
+
+insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
+
+# Verify correct row get inserted.
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+
+# Update table bug47777 should be successful.
+update bug47777 set c2=GeomFromText('POINT(1 1)');
+
+# Verify the row get updated successfully. The original
+# c2 value should be changed to GeomFromText('POINT(1 1)').
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+
+drop table bug47777;

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2009-11-06 14:20:27 +0000
+++ b/sql/sp_head.cc	2009-11-06 15:28:25 +0000
@@ -2939,7 +2939,7 @@ sp_instr_stmt::print(String *str)
 int
 sp_instr_stmt::exec_core(THD *thd, uint *nextp)
 {
-  MYSQL_QUERY_EXEC_START(thd->query,
+  MYSQL_QUERY_EXEC_START(thd->query(),
                          thd->thread_id,
                          (char *) (thd->db ? thd->db : ""),
                          thd->security_ctx->priv_user,

=== modified file 'sql/sql_cache.cc'
--- a/sql/sql_cache.cc	2009-11-05 20:28:35 +0000
+++ b/sql/sql_cache.cc	2009-11-06 15:28:25 +0000
@@ -1652,13 +1652,13 @@ def_week_frmt: %lu, in_trans: %d, autoco
   thd->stmt_da->disable_status();
 
   BLOCK_UNLOCK_RD(query_block);
-  MYSQL_QUERY_CACHE_HIT(thd->query, (ulong) thd->limit_found_rows);
+  MYSQL_QUERY_CACHE_HIT(thd->query(), (ulong) thd->limit_found_rows);
   DBUG_RETURN(1);				// Result sent to client
 
 err_unlock:
   unlock();
 err:
-  MYSQL_QUERY_CACHE_MISS(thd->query);
+  MYSQL_QUERY_CACHE_MISS(thd->query());
   DBUG_RETURN(0);				// Query was not cached
 }
 

=== modified file 'sql/sql_cursor.cc'
--- a/sql/sql_cursor.cc	2009-10-21 20:02:06 +0000
+++ b/sql/sql_cursor.cc	2009-11-06 15:28:25 +0000
@@ -169,7 +169,7 @@ int mysql_open_cursor(THD *thd, uint fla
     thd->lock_id= sensitive_cursor->get_lock_id();
     thd->cursor= sensitive_cursor;
   }
-  MYSQL_QUERY_EXEC_START(thd->query,
+  MYSQL_QUERY_EXEC_START(thd->query(),
                          thd->thread_id,
                          (char *) (thd->db ? thd->db : ""),
                          thd->security_ctx->priv_user,

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-11-06 14:20:27 +0000
+++ b/sql/sql_parse.cc	2009-11-06 15:28:25 +0000
@@ -1220,7 +1220,7 @@ bool dispatch_command(enum enum_server_c
   {
     if (alloc_query(thd, packet, packet_length))
       break;					// fatal error is set
-    MYSQL_QUERY_START(thd->query, thd->thread_id,
+    MYSQL_QUERY_START(thd->query(), thd->thread_id,
                       (char *) (thd->db ? thd->db : ""),
                       thd->security_ctx->priv_user,
                       (char *) thd->security_ctx->host_or_ip);
@@ -3164,7 +3164,7 @@ end_with_restore_list:
       goto error;
     DBUG_ASSERT(select_lex->offset_limit == 0);
     unit->set_limit(select_lex);
-    MYSQL_UPDATE_START(thd->query);
+    MYSQL_UPDATE_START(thd->query());
     res= (up_result= mysql_update(thd, all_tables,
                                   select_lex->item_list,
                                   lex->value_list,
@@ -3238,7 +3238,7 @@ end_with_restore_list:
 #endif
     {
       multi_update *result_obj;
-      MYSQL_MULTI_UPDATE_START(thd->query);
+      MYSQL_MULTI_UPDATE_START(thd->query());
       res= mysql_multi_update(thd, all_tables,
                               &select_lex->item_list,
                               &lex->value_list,
@@ -3306,7 +3306,7 @@ end_with_restore_list:
       res= 1;
       break;
     }
-    MYSQL_INSERT_START(thd->query);
+    MYSQL_INSERT_START(thd->query());
     res= mysql_insert(thd, all_tables, lex->field_list, lex->many_values,
 		      lex->update_list, lex->value_list,
                       lex->duplicates, lex->ignore);
@@ -3348,7 +3348,7 @@ end_with_restore_list:
     }
     if (!(res= open_and_lock_tables(thd, all_tables)))
     {
-      MYSQL_INSERT_SELECT_START(thd->query);
+      MYSQL_INSERT_SELECT_START(thd->query());
       /* Skip first table, which is the table we are inserting in */
       TABLE_LIST *second_table= first_table->next_local;
       select_lex->table_list.first= (uchar*) second_table;
@@ -3434,7 +3434,7 @@ end_with_restore_list:
       res= 1;
       break;
     }
-    MYSQL_DELETE_START(thd->query);
+    MYSQL_DELETE_START(thd->query());
     res = mysql_delete(thd, all_tables, select_lex->where,
                        &select_lex->order_list,
                        unit->select_limit_cnt, select_lex->options,
@@ -3469,7 +3469,7 @@ end_with_restore_list:
     if ((res= open_and_lock_tables(thd, all_tables)))
       break;
 
-    MYSQL_MULTI_DELETE_START(thd->query);
+    MYSQL_MULTI_DELETE_START(thd->query());
     if ((res= mysql_multi_delete_prepare(thd)))
     {
       MYSQL_MULTI_DELETE_DONE(1, 0);
@@ -6201,7 +6201,7 @@ void mysql_parse(THD *thd, const char *i
             thd->server_status|= SERVER_MORE_RESULTS_EXISTS;
           }
           lex->set_trg_event_type_for_tables();
-          MYSQL_QUERY_EXEC_START(thd->query,
+          MYSQL_QUERY_EXEC_START(thd->query(),
                                  thd->thread_id,
                                  (char *) (thd->db ? thd->db : ""),
                                  thd->security_ctx->priv_user,
@@ -8063,7 +8063,7 @@ bool parse_sql(THD *thd,
   bool ret_value;
   DBUG_ASSERT(thd->m_parser_state == NULL);
 
-  MYSQL_QUERY_PARSE_START(thd->query);
+  MYSQL_QUERY_PARSE_START(thd->query());
   /* Backup creation context. */
 
   Object_creation_ctx *backup_ctx= NULL;

=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc	2009-11-06 14:20:27 +0000
+++ b/sql/sql_prepare.cc	2009-11-06 15:28:25 +0000
@@ -3753,7 +3753,7 @@ bool Prepared_statement::execute(String 
     if (query_cache_send_result_to_client(thd, thd->query(),
                                           thd->query_length()) <= 0)
     {
-      MYSQL_QUERY_EXEC_START(thd->query,
+      MYSQL_QUERY_EXEC_START(thd->query(),
                              thd->thread_id,
                              (char *) (thd->db ? thd->db : ""),
                              thd->security_ctx->priv_user,

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-11-06 14:20:27 +0000
+++ b/sql/sql_select.cc	2009-11-06 15:28:25 +0000
@@ -242,7 +242,7 @@ bool handle_select(THD *thd, LEX *lex, s
   bool res;
   register SELECT_LEX *select_lex = &lex->select_lex;
   DBUG_ENTER("handle_select");
-  MYSQL_SELECT_START(thd->query);
+  MYSQL_SELECT_START(thd->query());
 
   if (select_lex->master_unit()->is_union() || 
       select_lex->master_unit()->fake_select_lex)

=== modified file 'storage/innobase/ChangeLog'
--- a/storage/innobase/ChangeLog	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/ChangeLog	2009-11-05 12:29:58 +0000
@@ -1,9 +1,89 @@
+2009-10-29	The InnoDB Team
+
+	* handler/ha_innodb.cc, mysql-test/innodb-autoinc.result,
+	mysql-test/innodb-autoinc.test:
+	Fix Bug#47125 auto_increment start value is ignored if an index is
+	created and engine=innodb
+
+2009-10-29	The InnoDB Team
+
+	* handler/ha_innodb.cc, mysql-test/innodb_bug47777.result,
+	mysql-test/innodb_bug47777.test:
+	Fix Bug#47777 innodb dies with spatial pk: Failing assertion: buf <=
+	original_buf + buf_len
+
+2009-10-29	The InnoDB Team
+
+	* handler/ha_innodb.cc:
+	Fix Bug#38996 Race condition in ANALYZE TABLE
+
+2009-10-29	The InnoDB Team
+
+	* handler/ha_innodb.cc:
+	Fix bug#42383: Can't create table 'test.bug39438'
+
+2009-10-29	The InnoDB Team
+
+	* os/os0proc.c:
+	Fix Bug#48237 Error handling in os_mem_alloc_large appears to
+	be incorrect
+
+2009-10-29	The InnoDB Team
+
+	* buf/buf0buf.c, buf/buf0lru.c, include/buf0buf.h, include/buf0buf.ic:
+	Fix corruption of the buf_pool->LRU_old list and improve debug
+	assertions.
+
+2009-10-28	The InnoDB Team
+
+	* srv/srv0start.c:
+	Fix Bug#41490 After enlargement of InnoDB page size, the error message
+	become inaccurate
+
+2009-10-26	The InnoDB Team
+
+	* row/row0ins.c:
+	When allocating a data tuple, zero out the system fields in order
+	to avoid Valgrind warnings about uninitialized fields in
+	dtuple_validate().
+
+2009-10-22	The InnoDB Team
+
+	* handler/ha_innodb.cc, mysql-test/innodb-zip.result,
+	mysql-test/innodb-zip.test, mysql-test/innodb_bug44369.result,
+	mysql-test/innodb_bug44369.test:
+	Fix Bug#47233 Innodb calls push_warning(MYSQL_ERROR::WARN_LEVEL_ERROR)
+
+2009-10-19	The InnoDB Team
+
+	* mysql-test/innodb_information_schema.test:
+	Fix Bug#47808 innodb_information_schema.test fails when run under
+	valgrind
+
+2009-10-15	The InnoDB Team
+
+	* include/page0page.ic:
+	Fix Bug#47058 Failure to compile innodb_plugin on solaris 10u7 + spro
+	cc/CC 5.10
+
+2009-10-05	The InnoDB Team
+
+	* buf/buf0buf.c:
+	Do not invalidate buffer pool while an LRU batch is active. Added code
+	to buf_pool_invalidate() to wait for the running batches to finish.
+
+2009-10-01	The InnoDB Team
+
+	* handler/ha_innodb.cc:
+	Fix Bug#47763 typo in error message: Failed to open table %s after %lu
+	attemtps.
+
 2009-10-01	The InnoDB Team
 
 	* fsp/fsp0fsp.c, row/row0merge.c:
-	Clean up after a crash during DROP INDEX.  When InnoDB crashes
+	Clean up after a crash during DROP INDEX. When InnoDB crashes
 	while dropping an index, ensure that the index will be completely
-	dropped during crash recovery.  The MySQL .frm file may still
+	dropped during crash recovery. The MySQL .frm file may still
 	contain the dropped index, but there is little that we can do
 	about it.
 
@@ -20,15 +100,15 @@
 	include/page0zip.h, page/page0cur.c, page/page0page.c,
 	page/page0zip.c:
 	Do not write to PAGE_INDEX_ID when restoring an uncompressed page
-	after a compression failure.  The field should only be written
-	when creating a B-tree page.  This fix addresses a race condition
+	after a compression failure. The field should only be written
+	when creating a B-tree page. This fix addresses a race condition
 	in a debug assertion.
 
 2009-09-28	The InnoDB Team
 
 	* fil/fil0fil.c:
 	Try to prevent the reuse of tablespace identifiers after InnoDB
-	has crashed during table creation.  Also, refuse to start if files
+	has crashed during table creation. Also, refuse to start if files
 	with duplicate tablespace identifiers are encountered.
 
 2009-09-25	The InnoDB Team

=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/buf/buf0buf.c	2009-11-05 12:29:58 +0000
@@ -1163,10 +1163,15 @@ buf_relocate(
 #ifdef UNIV_LRU_DEBUG
 		/* buf_pool->LRU_old must be the first item in the LRU list
 		whose "old" flag is set. */
+		ut_a(buf_pool->LRU_old->old);
 		ut_a(!UT_LIST_GET_PREV(LRU, buf_pool->LRU_old)
 		     || !UT_LIST_GET_PREV(LRU, buf_pool->LRU_old)->old);
 		ut_a(!UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)
 		     || UT_LIST_GET_NEXT(LRU, buf_pool->LRU_old)->old);
+	} else {
+		/* Check that the "old" flag is consistent in
+		the block and its neighbours. */
+		buf_page_set_old(dpage, buf_page_is_old(dpage));
 #endif /* UNIV_LRU_DEBUG */
 	}
 

=== modified file 'storage/innobase/buf/buf0flu.c'
--- a/storage/innobase/buf/buf0flu.c	2009-07-30 12:42:56 +0000
+++ b/storage/innobase/buf/buf0flu.c	2009-11-03 10:02:19 +0000
@@ -304,6 +304,28 @@ buf_flush_write_complete(
 }
 
 /********************************************************************//**
+Flush a batch of writes to the datafiles that have already been
+written by the OS. */
+static
+void
+buf_flush_sync_datafiles(void)
+/*==========================*/
+{
+	/* Wake possible simulated aio thread to actually post the
+	writes to the operating system */
+	os_aio_simulated_wake_handler_threads();
+
+	/* Wait that all async writes to tablespaces have been posted to
+	the OS */
+	os_aio_wait_until_no_pending_writes();
+
+	/* Now we flush the data to disk (for example, with fsync) */
+	fil_flush_file_spaces(FIL_TABLESPACE);
+
+	return;
+}
+
+/********************************************************************//**
 Flushes possible buffered writes from the doublewrite memory buffer to disk,
 and also wakes up the aio thread if simulated aio is used. It is very
 important to call this function after a batch of writes has been posted,
@@ -320,8 +342,8 @@ buf_flush_buffered_writes(void)
 	ulint		i;
 
 	if (!srv_use_doublewrite_buf || trx_doublewrite == NULL) {
-		os_aio_simulated_wake_handler_threads();
-
+		/* Sync the writes to the disk. */
+		buf_flush_sync_datafiles();
 		return;
 	}
 
@@ -529,22 +551,10 @@ flush:
 		buf_LRU_stat_inc_io();
 	}
 
-	/* Wake possible simulated aio thread to actually post the
-	writes to the operating system */
-
-	os_aio_simulated_wake_handler_threads();
-
-	/* Wait that all async writes to tablespaces have been posted to
-	the OS */
-
-	os_aio_wait_until_no_pending_writes();
-
-	/* Now we flush the data to disk (for example, with fsync) */
-
-	fil_flush_file_spaces(FIL_TABLESPACE);
+	/* Sync the writes to the disk. */
+	buf_flush_sync_datafiles();
 
 	/* We can now reuse the doublewrite memory buffer: */
-
 	trx_doublewrite->first_free = 0;
 
 	mutex_exit(&(trx_doublewrite->mutex));

=== modified file 'storage/innobase/buf/buf0lru.c'
--- a/storage/innobase/buf/buf0lru.c	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/buf/buf0lru.c	2009-11-05 12:29:58 +0000
@@ -978,14 +978,14 @@ buf_LRU_old_adjust_len(void)
 #ifdef UNIV_LRU_DEBUG
 			ut_a(!LRU_old->old);
 #endif /* UNIV_LRU_DEBUG */
-			buf_page_set_old(LRU_old, TRUE);
 			old_len = ++buf_pool->LRU_old_len;
+			buf_page_set_old(LRU_old, TRUE);
 
 		} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
 
-			buf_page_set_old(LRU_old, FALSE);
 			buf_pool->LRU_old = UT_LIST_GET_NEXT(LRU, LRU_old);
 			old_len = --buf_pool->LRU_old_len;
+			buf_page_set_old(LRU_old, FALSE);
 		} else {
 			return;
 		}
@@ -1009,13 +1009,13 @@ buf_LRU_old_init(void)
 	the adjust function to move the LRU_old pointer to the right
 	position */
 
-	bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
-
-	while (bpage != NULL) {
+	for (bpage = UT_LIST_GET_LAST(buf_pool->LRU); bpage != NULL;
+	     bpage = UT_LIST_GET_PREV(LRU, bpage)) {
 		ut_ad(bpage->in_LRU_list);
 		ut_ad(buf_page_in_file(bpage));
-		buf_page_set_old(bpage, TRUE);
-		bpage = UT_LIST_GET_NEXT(LRU, bpage);
+		/* This loop temporarily violates the
+		assertions of buf_page_set_old(). */
+		bpage->old = TRUE;
 	}
 
 	buf_pool->LRU_old = UT_LIST_GET_FIRST(buf_pool->LRU);
@@ -1091,10 +1091,19 @@ buf_LRU_remove_block(
 
 	buf_unzip_LRU_remove_block_if_needed(bpage);
 
-	/* If the LRU list is so short that LRU_old not defined, return */
+	/* If the LRU list is so short that LRU_old is not defined,
+	clear the "old" flags and return */
 	if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN) {
 
+		for (bpage = UT_LIST_GET_FIRST(buf_pool->LRU); bpage != NULL;
+		     bpage = UT_LIST_GET_NEXT(LRU, bpage)) {
+			/* This loop temporarily violates the
+			assertions of buf_page_set_old(). */
+			bpage->old = FALSE;
+		}
+
 		buf_pool->LRU_old = NULL;
+		buf_pool->LRU_old_len = 0;
 
 		return;
 	}
@@ -1155,14 +1164,13 @@ buf_LRU_add_block_to_end_low(
 	UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
 	ut_d(bpage->in_LRU_list = TRUE);
 
-	buf_page_set_old(bpage, TRUE);
-
 	if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
 
 		ut_ad(buf_pool->LRU_old);
 
 		/* Adjust the length of the old block list if necessary */
 
+		buf_page_set_old(bpage, TRUE);
 		buf_pool->LRU_old_len++;
 		buf_LRU_old_adjust_len();
 
@@ -1171,8 +1179,9 @@ buf_LRU_add_block_to_end_low(
 		/* The LRU list is now long enough for LRU_old to become
 		defined: init it */
 
-		buf_pool->LRU_old_len++;
 		buf_LRU_old_init();
+	} else {
+		buf_page_set_old(bpage, buf_pool->LRU_old != NULL);
 	}
 
 	/* If this is a zipped block with decompressed frame as well
@@ -1223,14 +1232,13 @@ buf_LRU_add_block_low(
 
 	ut_d(bpage->in_LRU_list = TRUE);
 
-	buf_page_set_old(bpage, old);
-
 	if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
 
 		ut_ad(buf_pool->LRU_old);
 
 		/* Adjust the length of the old block list if necessary */
 
+		buf_page_set_old(bpage, old);
 		buf_LRU_old_adjust_len();
 
 	} else if (UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN) {
@@ -1239,6 +1247,8 @@ buf_LRU_add_block_low(
 		defined: init it */
 
 		buf_LRU_old_init();
+	} else {
+		buf_page_set_old(bpage, buf_pool->LRU_old != NULL);
 	}
 
 	/* If this is a zipped block with decompressed frame as well
@@ -1436,15 +1446,6 @@ alloc:
 
 						buf_pool->LRU_old = b;
 					}
-#ifdef UNIV_LRU_DEBUG
-					ut_a(prev_b->old
-					     || !UT_LIST_GET_NEXT(LRU, b)
-					     || UT_LIST_GET_NEXT(LRU, b)->old);
-				} else {
-					ut_a(!prev_b->old
-					     || !UT_LIST_GET_NEXT(LRU, b)
-					     || !UT_LIST_GET_NEXT(LRU, b)->old);
-#endif /* UNIV_LRU_DEBUG */
 				}
 
 				lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
@@ -1460,6 +1461,11 @@ alloc:
 					defined: init it */
 					buf_LRU_old_init();
 				}
+#ifdef UNIV_LRU_DEBUG
+				/* Check that the "old" flag is consistent
+				in the block and its neighbours. */
+				buf_page_set_old(b, buf_page_is_old(b));
+#endif /* UNIV_LRU_DEBUG */
 			} else {
 				ut_d(b->in_LRU_list = FALSE);
 				buf_LRU_add_block_low(b, buf_page_is_old(b));
@@ -1966,19 +1972,24 @@ buf_LRU_validate(void)
 		}
 
 		if (buf_page_is_old(bpage)) {
-			old_len++;
-		}
+			const buf_page_t*	prev
+				= UT_LIST_GET_PREV(LRU, bpage);
+			const buf_page_t*	next
+				= UT_LIST_GET_NEXT(LRU, bpage);
+
+			if (!old_len++) {
+				ut_a(buf_pool->LRU_old == bpage);
+			} else {
+				ut_a(!prev || buf_page_is_old(prev));
+			}
 
-		if (buf_pool->LRU_old && (old_len == 1)) {
-			ut_a(buf_pool->LRU_old == bpage);
+			ut_a(!next || buf_page_is_old(next));
 		}
 
 		bpage = UT_LIST_GET_NEXT(LRU, bpage);
 	}
 
-	if (buf_pool->LRU_old) {
-		ut_a(buf_pool->LRU_old_len == old_len);
-	}
+	ut_a(buf_pool->LRU_old_len == old_len);
 
 	UT_LIST_VALIDATE(list, buf_page_t, buf_pool->free,
 			 ut_ad(ut_list_node_313->in_free_list));

=== modified file 'storage/innobase/fil/fil0fil.c'
--- a/storage/innobase/fil/fil0fil.c	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/fil/fil0fil.c	2009-11-05 12:29:58 +0000
@@ -659,6 +659,7 @@ fil_node_open_file(
 #ifdef UNIV_HOTBACKUP
 		if (space->id == 0) {
 			node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
+			os_file_close(node->handle);
 			goto add_size;
 		}
 #endif /* UNIV_HOTBACKUP */
@@ -3244,7 +3245,7 @@ fil_load_single_table_tablespace(
 		fprintf(stderr,
 			"InnoDB: Renaming tablespace %s of id %lu,\n"
 			"InnoDB: to %s_ibbackup_old_vers_<timestamp>\n"
-			"InnoDB: because its size %lld is too small"
+			"InnoDB: because its size %" PRId64 " is too small"
 			" (< 4 pages 16 kB each),\n"
 			"InnoDB: or the space id in the file header"
 			" is not sensible.\n"

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2009-11-06 14:20:27 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2009-11-06 15:19:24 +0000
@@ -110,7 +110,7 @@ extern "C" {
 # ifndef MYSQL_PLUGIN_IMPORT
 #  define MYSQL_PLUGIN_IMPORT /* nothing */
 # endif /* MYSQL_PLUGIN_IMPORT */
-/* This is needed because of Bug #3596.  Let us hope that pthread_mutex_t
+/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
 is defined the same in both builds: the MySQL server and the InnoDB plugin. */
 extern MYSQL_PLUGIN_IMPORT pthread_mutex_t LOCK_thread_count;
 
@@ -129,6 +129,7 @@ static ulong commit_threads = 0;
 static pthread_mutex_t commit_threads_m;
 static pthread_cond_t commit_cond;
 static pthread_mutex_t commit_cond_m;
+static pthread_mutex_t analyze_mutex;
 static bool innodb_inited = 0;
 
 #define INSIDE_HA_INNOBASE_CC
@@ -229,21 +230,6 @@ static handler *innobase_create_handler(
                                         TABLE_SHARE *table,
                                         MEM_ROOT *mem_root);
 
-/***********************************************************************
-This function checks each index name for a table against reserved
-system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
-this function pushes an error message to the client, and returns true. */
-static
-bool
-innobase_index_name_is_reserved(
-/*============================*/
-					/* out: true if index name matches a
-					reserved name */
-	const trx_t*	trx,		/* in: InnoDB transaction handle */
-	const TABLE*	form,		/* in: information on table
-					columns and indexes */
-	const char*	norm_name);	/* in: table name */
-
 /* "GEN_CLUST_INDEX" is the name reserved for Innodb default
 system primary index. */
 static const char innobase_index_reserve_name[]= "GEN_CLUST_INDEX";
@@ -2288,6 +2274,7 @@ innobase_change_buffering_inited_ok:
 	pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
 	pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
 	pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
+	pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
 	pthread_cond_init(&commit_cond, NULL);
 	innodb_inited= 1;
 #ifdef MYSQL_DYNAMIC_PLUGIN
@@ -2342,6 +2329,7 @@ innobase_end(
 		pthread_mutex_destroy(&prepare_commit_mutex);
 		pthread_mutex_destroy(&commit_threads_m);
 		pthread_mutex_destroy(&commit_cond_m);
+		pthread_mutex_destroy(&analyze_mutex);
 		pthread_cond_destroy(&commit_cond);
 	}
 
@@ -2620,6 +2608,8 @@ innobase_rollback(
 
 	innobase_release_stat_resources(trx);
 
+	trx->n_autoinc_rows = 0; /* Reset the number AUTO-INC rows required */
+
 	/* If we had reserved the auto-inc lock for some table (if
 	we come here to roll back the latest SQL statement) we
 	release it now before a possibly lengthy rollback */
@@ -3780,7 +3770,10 @@ ha_innobase::store_key_val_for_row(
 		} else if (mysql_type == MYSQL_TYPE_TINY_BLOB
 			|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB
 			|| mysql_type == MYSQL_TYPE_BLOB
-			|| mysql_type == MYSQL_TYPE_LONG_BLOB) {
+			|| mysql_type == MYSQL_TYPE_LONG_BLOB
+			/* MYSQL_TYPE_GEOMETRY data is treated
+			as BLOB data in innodb. */
+			|| mysql_type == MYSQL_TYPE_GEOMETRY) {
 
 			CHARSET_INFO*	cs;
 			ulint		key_len;
@@ -5710,7 +5703,7 @@ create_table_def(
 				number fits in one byte in prtype */
 				push_warning_printf(
 					(THD*) trx->mysql_thd,
-					MYSQL_ERROR::WARN_LEVEL_ERROR,
+					MYSQL_ERROR::WARN_LEVEL_WARN,
 					ER_CANT_CREATE_TABLE,
 					"In InnoDB, charset-collation codes"
 					" must be below 256."
@@ -5744,7 +5737,7 @@ create_table_def(
 		if (dict_col_name_is_reserved(field->field_name)){
 			push_warning_printf(
 				(THD*) trx->mysql_thd,
-				MYSQL_ERROR::WARN_LEVEL_ERROR,
+				MYSQL_ERROR::WARN_LEVEL_WARN,
 				ER_CANT_CREATE_TABLE,
 				"Error creating table '%s' with "
 				"column name '%s'. '%s' is a "
@@ -5978,7 +5971,7 @@ create_options_are_valid(
 			/* Valid value. */
 			break;
 		default:
-			push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+			push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 					    ER_ILLEGAL_HA_CREATE_OPTION,
 					    "InnoDB: invalid"
 					    " KEY_BLOCK_SIZE = %lu."
@@ -5992,7 +5985,7 @@ create_options_are_valid(
 	/* If KEY_BLOCK_SIZE was specified, check for its
 	dependencies. */
 	if (kbs_specified && !srv_file_per_table) {
-		push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+		push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 			     ER_ILLEGAL_HA_CREATE_OPTION,
 			     "InnoDB: KEY_BLOCK_SIZE"
 			     " requires innodb_file_per_table.");
@@ -6000,7 +5993,7 @@ create_options_are_valid(
 	}
 
 	if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) {
-		push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+		push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 			     ER_ILLEGAL_HA_CREATE_OPTION,
 			     "InnoDB: KEY_BLOCK_SIZE"
 			     " requires innodb_file_format >"
@@ -6024,7 +6017,7 @@ create_options_are_valid(
 			if (!srv_file_per_table) {
 				push_warning_printf(
 					thd,
-					MYSQL_ERROR::WARN_LEVEL_ERROR,
+					MYSQL_ERROR::WARN_LEVEL_WARN,
 					ER_ILLEGAL_HA_CREATE_OPTION,
 					"InnoDB: ROW_FORMAT=%s"
 					" requires innodb_file_per_table.",
@@ -6036,7 +6029,7 @@ create_options_are_valid(
 			if (srv_file_format < DICT_TF_FORMAT_ZIP) {
 				push_warning_printf(
 					thd,
-					MYSQL_ERROR::WARN_LEVEL_ERROR,
+					MYSQL_ERROR::WARN_LEVEL_WARN,
 					ER_ILLEGAL_HA_CREATE_OPTION,
 					"InnoDB: ROW_FORMAT=%s"
 					" requires innodb_file_format >"
@@ -6053,7 +6046,7 @@ create_options_are_valid(
 			    && form->s->row_type == ROW_TYPE_DYNAMIC) {
 				push_warning_printf(
 					thd,
-					MYSQL_ERROR::WARN_LEVEL_ERROR,
+					MYSQL_ERROR::WARN_LEVEL_WARN,
 					ER_ILLEGAL_HA_CREATE_OPTION,
 					"InnoDB: cannot specify"
 					" ROW_FORMAT = DYNAMIC with"
@@ -6077,7 +6070,7 @@ create_options_are_valid(
 			if (kbs_specified) {
 				push_warning_printf(
 					thd,
-					MYSQL_ERROR::WARN_LEVEL_ERROR,
+					MYSQL_ERROR::WARN_LEVEL_WARN,
 					ER_ILLEGAL_HA_CREATE_OPTION,
 					"InnoDB: cannot specify"
 					" ROW_FORMAT = %s with"
@@ -6090,7 +6083,7 @@ create_options_are_valid(
 
 		default:
 			push_warning(thd,
-				     MYSQL_ERROR::WARN_LEVEL_ERROR,
+				     MYSQL_ERROR::WARN_LEVEL_WARN,
 				     ER_ILLEGAL_HA_CREATE_OPTION,
 				     "InnoDB: invalid ROW_FORMAT specifier.");
 			ret = FALSE;
@@ -6154,13 +6147,15 @@ ha_innobase::create(
 	1. <database_name>/<table_name>: for normal table creation
 	2. full path: for temp table creation, or sym link
 
-	When srv_file_per_table is on, check for full path pattern, i.e.
+	When srv_file_per_table is on and mysqld_embedded is off,
+	check for full path pattern, i.e.
 	X:\dir\...,		X is a driver letter, or
 	\\dir1\dir2\...,	UNC path
 	returns error if it is in full path format, but not creating a temp.
 	table. Currently InnoDB does not support symbolic link on Windows. */
 
 	if (srv_file_per_table
+	    && !mysqld_embedded
 	    && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
 
 		if ((name[1] == ':')
@@ -6364,7 +6359,8 @@ ha_innobase::create(
 
 	/* Check for name conflicts (with reserved name) for
 	any user indices to be created. */
-	if (innobase_index_name_is_reserved(trx, form, norm_name)) {
+	if (innobase_index_name_is_reserved(trx, form->key_info,
+					    form->s->keys)) {
 		error = -1;
 		goto cleanup;
 	}
@@ -6451,18 +6447,22 @@ ha_innobase::create(
 	setup at this stage and so we use thd. */
 
 	/* We need to copy the AUTOINC value from the old table if
-	this is an ALTER TABLE. */
+	this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
+	does a table copy too. */
 
 	if (((create_info->used_fields & HA_CREATE_USED_AUTO)
-	    || thd_sql_command(thd) == SQLCOM_ALTER_TABLE)
-	    && create_info->auto_increment_value != 0) {
-
-		/* Query was ALTER TABLE...AUTO_INCREMENT = x; or
-		CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
-		definition from the dictionary and get the current value
-		of the auto increment field. Set a new value to the
-		auto increment field if the value is greater than the
-		maximum value in the column. */
+	    || thd_sql_command(thd) == SQLCOM_ALTER_TABLE
+	    || thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
+	    && create_info->auto_increment_value > 0) {
+
+		/* Query was one of :
+		CREATE TABLE ...AUTO_INCREMENT = x; or
+		ALTER TABLE...AUTO_INCREMENT = x;   or
+		CREATE INDEX x on t(...);
+		Find out a table definition from the dictionary and get
+		the current value of the auto increment field. Set a new
+		value to the auto increment field if the value is greater
+		than the maximum value in the column. */
 
 		auto_inc_value = create_info->auto_increment_value;
 
@@ -7316,9 +7316,15 @@ ha_innobase::analyze(
 	THD*		thd,		/*!< in: connection thread handle */
 	HA_CHECK_OPT*	check_opt)	/*!< in: currently ignored */
 {
+	/* Serialize ANALYZE TABLE inside InnoDB, see
+	Bug#38996 Race condition in ANALYZE TABLE */
+	pthread_mutex_lock(&analyze_mutex);
+
 	/* Simply call ::info() with all the flags */
 	info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
 
+	pthread_mutex_unlock(&analyze_mutex);
+
 	return(0);
 }
 
@@ -8795,6 +8801,7 @@ ha_innobase::get_auto_increment(
 	AUTOINC counter after attempting to insert the row. */
 	if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
 		ulonglong	need;
+		ulonglong	current;
 		ulonglong	next_value;
 		ulonglong	col_max_value;
 
@@ -8803,11 +8810,12 @@ ha_innobase::get_auto_increment(
 		col_max_value = innobase_get_int_col_max_value(
 			table->next_number_field);
 
+		current = *first_value > col_max_value ? autoinc : *first_value;
 		need = *nb_reserved_values * increment;
 
 		/* Compute the last value in the interval */
 		next_value = innobase_next_autoinc(
-			*first_value, need, offset, col_max_value);
+			current, need, offset, col_max_value);
 
 		prebuilt->autoinc_last_value = next_value;
 
@@ -9826,36 +9834,39 @@ static int show_innodb_vars(THD *thd, SH
 /***********************************************************************
 This function checks each index name for a table against reserved
 system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
-this function pushes an error message to the client, and returns true. */
-static
+this function pushes an warning message to the client, and returns true. */
+extern "C" UNIV_INTERN
 bool
 innobase_index_name_is_reserved(
 /*============================*/
 					/* out: true if an index name
 					matches the reserved name */
 	const trx_t*	trx,		/* in: InnoDB transaction handle */
-	const TABLE*	form,		/* in: information on table
-					columns and indexes */
-	const char*	norm_name)	/* in: table name */
+	const KEY*	key_info,	/* in: Indexes to be created */
+	ulint		num_of_keys)	/* in: Number of indexes to
+					be created. */
 {
-	KEY*		key;
+	const KEY*	key;
 	uint		key_num;	/* index number */
 
-	for (key_num = 0; key_num < form->s->keys; key_num++) {
-		key = form->key_info + key_num;
+	for (key_num = 0; key_num < num_of_keys; key_num++) {
+		key = &key_info[key_num];
 
 		if (innobase_strcasecmp(key->name,
 					innobase_index_reserve_name) == 0) {
 			/* Push warning to mysql */
 			push_warning_printf((THD*) trx->mysql_thd,
-					    MYSQL_ERROR::WARN_LEVEL_ERROR,
-					    ER_CANT_CREATE_TABLE,
+					    MYSQL_ERROR::WARN_LEVEL_WARN,
+					    ER_WRONG_NAME_FOR_INDEX,
 					    "Cannot Create Index with name "
 					    "'%s'. The name is reserved "
 					    "for the system default primary "
 					    "index.",
 					    innobase_index_reserve_name);
 
+			my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0),
+				 innobase_index_reserve_name);
+
 			return(true);
 		}
 	}

=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h	2009-09-24 14:52:52 +0000
+++ b/storage/innobase/handler/ha_innodb.h	2009-11-03 10:07:51 +0000
@@ -289,3 +289,21 @@ trx_t*
 innobase_trx_allocate(
 /*==================*/
 	MYSQL_THD	thd);	/*!< in: user thread handle */
+
+
+/*********************************************************************//**
+This function checks each index name for a table against reserved
+system default primary index name 'GEN_CLUST_INDEX'. If a name
+matches, this function pushes an warning message to the client,
+and returns true. */
+extern "C"
+bool
+innobase_index_name_is_reserved(
+/*============================*/
+					/* out: true if the index name
+					matches the reserved name */
+	const trx_t*	trx,		/* in: InnoDB transaction handle */
+	const KEY*	key_info,	/* in: Indexes to be created */
+	ulint		num_of_keys);	/* in: Number of indexes to
+					be created. */
+

=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/handler/handler0alter.cc	2009-11-05 12:29:58 +0000
@@ -628,7 +628,7 @@ ha_innobase::add_index(
 	ulint		num_created	= 0;
 	ibool		dict_locked	= FALSE;
 	ulint		new_primary;
-	ulint		error;
+	int		error;
 
 	DBUG_ENTER("ha_innobase::add_index");
 	ut_a(table);
@@ -656,9 +656,13 @@ ha_innobase::add_index(
 	innodb_table = indexed_table
 		= dict_table_get(prebuilt->table->name, FALSE);
 
-	/* Check that index keys are sensible */
-
-	error = innobase_check_index_keys(key_info, num_of_keys);
+	/* Check if the index name is reserved. */
+	if (innobase_index_name_is_reserved(trx, key_info, num_of_keys)) {
+		error = -1;
+	} else {
+		/* Check that index keys are sensible */
+		error = innobase_check_index_keys(key_info, num_of_keys);
+	}
 
 	if (UNIV_UNLIKELY(error)) {
 err_exit:

=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/include/buf0buf.h	2009-11-05 12:29:58 +0000
@@ -1129,7 +1129,7 @@ struct buf_page_struct{
 					debugging */
 #endif /* UNIV_DEBUG */
 	unsigned	old:1;		/*!< TRUE if the block is in the old
-					blocks in the LRU list */
+					blocks in buf_pool->LRU_old */
 	unsigned	freed_page_clock:31;/*!< the value of
 					buf_pool->freed_page_clock
 					when this block was the last
@@ -1393,8 +1393,7 @@ struct buf_pool_struct{
 					the block to which LRU_old points
 					onward, including that block;
 					see buf0lru.c for the restrictions
-					on this value; not defined if
-					LRU_old == NULL;
+					on this value; 0 if LRU_old == NULL;
 					NOTE: LRU_old_len must be adjusted
 					whenever LRU_old shrinks or grows! */
 

=== modified file 'storage/innobase/include/buf0buf.ic'
--- a/storage/innobase/include/buf0buf.ic	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/include/buf0buf.ic	2009-11-05 12:29:58 +0000
@@ -466,10 +466,19 @@ buf_page_set_old(
 	ut_ad(bpage->in_LRU_list);
 
 #ifdef UNIV_LRU_DEBUG
-	if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)
-	    && UT_LIST_GET_PREV(LRU, bpage)->old
-	    == UT_LIST_GET_NEXT(LRU, bpage)->old) {
-		ut_a(UT_LIST_GET_PREV(LRU, bpage)->old == old);
+	ut_a((buf_pool->LRU_old_len == 0) == (buf_pool->LRU_old == NULL));
+	/* If a block is flagged "old", the LRU_old list must exist. */
+	ut_a(!old || buf_pool->LRU_old);
+
+	if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)) {
+		const buf_page_t*	prev = UT_LIST_GET_PREV(LRU, bpage);
+		const buf_page_t*	next = UT_LIST_GET_NEXT(LRU, bpage);
+		if (prev->old == next->old) {
+			ut_a(prev->old == old);
+		} else {
+			ut_a(!prev->old);
+			ut_a(buf_pool->LRU_old == (old ? bpage : next));
+		}
 	}
 #endif /* UNIV_LRU_DEBUG */
 

=== modified file 'storage/innobase/include/page0page.ic'
--- a/storage/innobase/include/page0page.ic	2009-05-27 09:45:59 +0000
+++ b/storage/innobase/include/page0page.ic	2009-11-03 10:02:43 +0000
@@ -907,7 +907,7 @@ page_get_data_size(
 
 /************************************************************//**
 Allocates a block of memory from the free list of an index page. */
-UNIV_INTERN
+UNIV_INLINE
 void
 page_mem_alloc_free(
 /*================*/

=== modified file 'storage/innobase/include/row0mysql.h'
--- a/storage/innobase/include/row0mysql.h	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/include/row0mysql.h	2009-11-05 12:29:58 +0000
@@ -756,8 +756,6 @@ struct row_prebuilt_struct {
 					store it here so that we can return
 					it to MySQL */
 	/*----------------------*/
-	UT_LIST_NODE_T(row_prebuilt_t)	prebuilts;
-					/*!< list node of table->prebuilts */
 	ulint		magic_n2;	/*!< this should be the same as
 					magic_n */
 };

=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/include/univ.i	2009-11-05 12:29:58 +0000
@@ -237,7 +237,7 @@ by one. */
 
 /* Linkage specifier for non-static InnoDB symbols (variables and functions)
 that are only referenced from within InnoDB, not from MySQL */
-#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(UNIV_HOTBACKUP)
+#if defined(__GNUC__) && (__GNUC__ >= 4) || defined(__INTEL_COMPILER)
 # define UNIV_INTERN __attribute__((visibility ("hidden")))
 #else
 # define UNIV_INTERN

=== modified file 'storage/innobase/os/os0file.c'
--- a/storage/innobase/os/os0file.c	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/os/os0file.c	2009-11-05 12:29:58 +0000
@@ -832,6 +832,23 @@ next_file:
 	ret = stat(full_path, &statinfo);
 
 	if (ret) {
+
+		if (errno == ENOENT) {
+			/* readdir() returned a file that does not exist,
+			it must have been deleted in the meantime. Do what
+			would have happened if the file was deleted before
+			readdir() - ignore and go to the next entry.
+			If this is the last entry then info->name will still
+			contain the name of the deleted file when this
+			function returns, but this is not an issue since the
+			caller shouldn't be looking at info when end of
+			directory is returned. */
+
+			ut_free(full_path);
+
+			goto next_file;
+		}
+
 		os_file_handle_error_no_exit(full_path, "stat");
 
 		ut_free(full_path);

=== modified file 'storage/innobase/os/os0proc.c'
--- a/storage/innobase/os/os0proc.c	2009-07-30 12:42:56 +0000
+++ b/storage/innobase/os/os0proc.c	2009-11-03 10:25:00 +0000
@@ -97,6 +97,7 @@ os_mem_alloc_large(
 			fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
 				" attach shared memory segment, errno %d\n",
 				errno);
+			ptr = NULL;
 		}
 
 		/* Remove the shared memory segment so that it will be

=== modified file 'storage/innobase/row/row0ins.c'
--- a/storage/innobase/row/row0ins.c	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/row/row0ins.c	2009-11-05 12:29:58 +0000
@@ -141,7 +141,7 @@ row_ins_alloc_sys_fields(
 
 	dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
 
-	ptr = mem_heap_alloc(heap, DATA_ROW_ID_LEN);
+	ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN);
 
 	dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN);
 
@@ -152,7 +152,7 @@ row_ins_alloc_sys_fields(
 	col = dict_table_get_sys_col(table, DATA_TRX_ID);
 
 	dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
-	ptr = mem_heap_alloc(heap, DATA_TRX_ID_LEN);
+	ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN);
 
 	dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN);
 
@@ -163,7 +163,7 @@ row_ins_alloc_sys_fields(
 	col = dict_table_get_sys_col(table, DATA_ROLL_PTR);
 
 	dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
-	ptr = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN);
+	ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN);
 
 	dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN);
 }

=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/row/row0mysql.c	2009-11-05 12:29:58 +0000
@@ -2068,7 +2068,7 @@ Scans a table create SQL string and adds
 the foreign key constraints declared in the string. This function
 should be called after the indexes for a table have been created.
 Each foreign key constraint must be accompanied with indexes in
-bot participating tables. The indexes are allowed to contain more
+both participating tables. The indexes are allowed to contain more
 fields than mentioned in the constraint. Check also that foreign key
 constraints which reference this table are ok.
 @return	error code or DB_SUCCESS */

=== modified file 'storage/innobase/srv/srv0start.c'
--- a/storage/innobase/srv/srv0start.c	2009-10-19 13:10:22 +0000
+++ b/storage/innobase/srv/srv0start.c	2009-11-05 12:29:58 +0000
@@ -1376,7 +1376,7 @@ innobase_start_or_create_for_mysql(void)
 		sum_of_new_sizes += srv_data_file_sizes[i];
 	}
 
-	if (sum_of_new_sizes < 640) {
+	if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) {
 		fprintf(stderr,
 			"InnoDB: Error: tablespace size must be"
 			" at least 10 MB\n");


Attachment: [text/bzr-bundle] bzr/alik@sun.com-20091106153337-dr6ec4x1ujdjzgen.bundle
Thread
bzr push into mysql-5.5-next-mr branch (alik:2932 to 2935)Alexander Nozdrin6 Nov