3247 Jon Olav Hauglid 2011-07-07
Bug#11938817 ALTER BEHAVIOR DIFFERENT THEN DOCUMENTED
The problem was that "ALTER TABLE t1" did nothing while
"ALTER TABLE t1 ENGINE = x" rebuilt the table (given that
t1 was using engine x to start with). Even if both statements
logically do not change to the table.
After discussing the issue with support, it was decided that we
cannot easily change the behavior of "ALTER TABLE t1 ENGINE = x"
as users and external tools depend on the current behavior.
This patch adds a code comment explaining current behavior,
as well as a regression test documenting the behavior.
modified:
mysql-test/r/alter_table.result
mysql-test/t/alter_table.test
sql/sql_table.cc
3246 Anitha Gopi 2011-07-06
Bug#12664445 - Include an order by in the query to fix the PB2 failure. This is just a workaround and the real problem needs to be addressed soon
modified:
mysql-test/suite/sys_vars/r/all_vars.result
mysql-test/suite/sys_vars/t/all_vars.test
=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result 2011-06-16 23:45:58 +0000
+++ b/mysql-test/r/alter_table.result 2011-07-07 10:25:51 +0000
@@ -1443,3 +1443,21 @@ rename table t2 to t1;
execute stmt1;
deallocate prepare stmt1;
drop table t2;
+#
+# Bug#11938817 ALTER BEHAVIOR DIFFERENT THEN DOCUMENTED
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT) engine=innodb;
+INSERT INTO t1 VALUES (1), (2);
+# This should not do anything
+ALTER TABLE t1;
+affected rows: 0
+# Check that we rebuild the table
+ALTER TABLE t1 engine=innodb;
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+# This should also rebuild the table
+ALTER TABLE t1 FORCE;
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 0
+DROP TABLE t1;
=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test 2011-06-16 23:45:58 +0000
+++ b/mysql-test/t/alter_table.test 2011-07-07 10:25:51 +0000
@@ -1221,3 +1221,26 @@ rename table t2 to t1;
execute stmt1;
deallocate prepare stmt1;
drop table t2;
+
+
+--echo #
+--echo # Bug#11938817 ALTER BEHAVIOR DIFFERENT THEN DOCUMENTED
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT) engine=innodb;
+INSERT INTO t1 VALUES (1), (2);
+
+--enable_info
+--echo # This should not do anything
+ALTER TABLE t1;
+--echo # Check that we rebuild the table
+ALTER TABLE t1 engine=innodb;
+--echo # This should also rebuild the table
+ALTER TABLE t1 FORCE;
+--disable_info
+
+DROP TABLE t1;
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-07-04 00:25:46 +0000
+++ b/sql/sql_table.cc 2011-07-07 10:25:51 +0000
@@ -5168,6 +5168,9 @@ mysql_compare_tables(TABLE *table,
Test also that engine was not given during ALTER TABLE, or
we are force to run regular alter table (copy).
E.g. ALTER TABLE tbl_name ENGINE=MyISAM.
+ Note that we do copy even if the table is already using the
+ given engine. Many users and tools depend on using ENGINE to
+ force a table rebuild.
For the following ones we also want to run regular alter table:
ALTER TABLE tbl_name ORDER BY ..
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (jon.hauglid:3246 to 3247) Bug#11938817 | Jon Olav Hauglid | 7 Jul |