3601 Georgi Kodinov 2009-09-21 [merge]
merge li-bing's patch as instructed by Alfranio
added:
mysql-test/r/bug46760.result
mysql-test/t/bug46760-master.opt
mysql-test/t/bug46760.test
modified:
sql/handler.h
sql/mysqld.cc
sql/sql_table.cc
3600 Li-Bing.Song@stripped 2009-09-18 [merge]
Manual Merge
modified:
mysql-test/suite/rpl/r/rpl_packet.result
mysql-test/suite/rpl/t/rpl_packet.test
sql/share/errmsg-utf8.txt
sql/share/errmsg.txt
sql/slave.cc
sql/sql_repl.cc
=== added file 'mysql-test/r/bug46760.result'
--- a/mysql-test/r/bug46760.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug46760.result 2009-09-18 13:01:18 +0000
@@ -0,0 +1,43 @@
+#
+# Bug#46760: Fast ALTER TABLE no longer works for InnoDB
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+# By using --enable_info and verifying that number of affected
+# rows is 0 we check that this ALTER TABLE is really carried
+# out as "fast/online" operation, i.e. without full-blown data
+# copying.
+#
+# I.e. info for the below statement should normally look like:
+#
+# affected rows: 0
+# info: Records: 0 Duplicates: 0 Warnings: 0
+ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT '10'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# MySQL Bug#39200: optimize table does not recognize
+# ROW_FORMAT=COMPRESSED
+#
+CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+DROP TABLE t1;
+End of 5.1 tests
=== added file 'mysql-test/t/bug46760-master.opt'
--- a/mysql-test/t/bug46760-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46760-master.opt 2009-09-18 13:01:18 +0000
@@ -0,0 +1,2 @@
+--innodb-lock-wait-timeout=2
+--innodb-file-per-table
=== added file 'mysql-test/t/bug46760.test'
--- a/mysql-test/t/bug46760.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46760.test 2009-09-18 13:01:18 +0000
@@ -0,0 +1,38 @@
+-- source include/have_innodb.inc
+
+--echo #
+--echo # Bug#46760: Fast ALTER TABLE no longer works for InnoDB
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--echo # By using --enable_info and verifying that number of affected
+--echo # rows is 0 we check that this ALTER TABLE is really carried
+--echo # out as "fast/online" operation, i.e. without full-blown data
+--echo # copying.
+--echo #
+--echo # I.e. info for the below statement should normally look like:
+--echo #
+--echo # affected rows: 0
+--echo # info: Records: 0 Duplicates: 0 Warnings: 0
+
+--enable_info
+ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
+--disable_info
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MySQL Bug#39200: optimize table does not recognize
+--echo # ROW_FORMAT=COMPRESSED
+--echo #
+
+CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
+SHOW CREATE TABLE t1;
+OPTIMIZE TABLE t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo End of 5.1 tests
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2009-08-31 20:25:11 +0000
+++ b/sql/handler.h 2009-09-21 09:04:22 +0000
@@ -1043,6 +1043,15 @@ typedef struct st_ha_create_information
ulong key_block_size;
SQL_LIST merge_list;
handlerton *db_type;
+ /**
+ Row type of the table definition.
+
+ Defaults to ROW_TYPE_DEFAULT for all non-ALTER statements.
+ For ALTER TABLE defaults to ROW_TYPE_NOT_USED (means "keep the current").
+
+ Can be changed either explicitly by the parser.
+ If nothing speficied inherits the value of the original table (if present).
+ */
enum row_type row_type;
uint null_bits; /* NULL bits at start of record */
uint options; /* OR of HA_CREATE_ options */
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-09-16 08:23:16 +0000
+++ b/sql/mysqld.cc 2009-09-21 09:04:22 +0000
@@ -4953,7 +4953,7 @@ default_service_handling(char **argv,
if (opt_delim= strchr(extra_opt, '='))
{
size_t length= ++opt_delim - extra_opt;
- strnmov(pos, extra_opt, length);
+ pos= strnmov(pos, extra_opt, length);
}
else
opt_delim= extra_opt;
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2009-09-18 06:22:43 +0000
+++ b/sql/sql_table.cc 2009-09-21 09:04:22 +0000
@@ -7046,9 +7046,19 @@ view_err:
goto err;
}
+ /*
+ If this is an ALTER TABLE and no explicit row type specified reuse
+ the table's row type.
+ Note : this is the same as if the row type was specified explicitly.
+ */
if (create_info->row_type == ROW_TYPE_NOT_USED)
{
+ /* ALTER TABLE without explicit row type */
create_info->row_type= table->s->row_type;
+ }
+ else
+ {
+ /* ALTER TABLE with specific row type */
create_info->used_fields |= HA_CREATE_USED_ROW_FORMAT;
}
Attachment: [text/bzr-bundle] bzr/joro@sun.com-20090921090422-jz8bdfmapgq48seg.bundle
| Thread |
|---|
| • bzr push into mysql-6.0 branch (joro:3600 to 3601) | Georgi Kodinov | 21 Sep |