#At file:///home/kgeorge/mysql/work/B46760-5.1-bugteam/ based on revid:alik@stripped
3120 Georgi Kodinov 2009-09-11
Bug#46760: Fast ALTER TABLE no longer works for InnoDB
Despite copying the value of the old table's row type
we don't always have to mark row type as being specified.
Innodb uses this to check if it can do fast ALTER TABLE
or not.
Fixed by marking the row as supplied only when it's
not the default one.
Added a test case for 39200.
modified:
mysql-test/r/innodb_mysql.result
mysql-test/t/innodb_mysql.test
sql/sql_table.cc
=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result 2009-07-13 17:41:43 +0000
+++ b/mysql-test/r/innodb_mysql.result 2009-09-11 13:18:03 +0000
@@ -2208,4 +2208,53 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRI
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
DROP TABLE t1;
+#
+# 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;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+DROP TABLE t1;
End of 5.1 tests
=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test 2009-07-07 12:52:34 +0000
+++ b/mysql-test/t/innodb_mysql.test 2009-09-11 13:18:03 +0000
@@ -461,4 +461,39 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRI
DROP TABLE t1;
+--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/sql_table.cc'
--- a/sql/sql_table.cc 2009-09-10 08:49:49 +0000
+++ b/sql/sql_table.cc 2009-09-11 13:18:03 +0000
@@ -6659,7 +6659,8 @@ view_err:
if (create_info->row_type == ROW_TYPE_NOT_USED)
{
create_info->row_type= table->s->row_type;
- create_info->used_fields |= HA_CREATE_USED_ROW_FORMAT;
+ if (create_info->row_type != ROW_TYPE_DEFAULT)
+ create_info->used_fields |= HA_CREATE_USED_ROW_FORMAT;
}
DBUG_PRINT("info", ("old type: %s new type: %s",
Attachment: [text/bzr-bundle] bzr/joro@sun.com-20090911131803-e06y5mjan02i8ou3.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (joro:3120) Bug#46760 | Georgi Kodinov | 11 Sep |