Browse Source
Merge Bug #54679 fix from mysql-5.1-innodb:
Merge Bug #54679 fix from mysql-5.1-innodb:
------------------------------------------------------------ revno: 3523 revision-id: marko.makela@oracle.com-20100624104620-pklunowaigv7quu9 parent: jimmy.yang@oracle.com-20100624021010-oh2hnp8e1xbaax6u committer: Marko Mäkelä <marko.makela@oracle.com> branch nick: 5.1-innodb timestamp: Thu 2010-06-24 13:46:20 +0300 message: Bug#54679: alter table causes compressed row_format to revert to compact ha_innobase::create(): Add the local variable row_type = form->s->row_type. Adjust it to ROW_TYPE_COMPRESSED when ROW_FORMAT is not specified or inherited but KEY_BLOCK_SIZE is. Observe the inherited ROW_FORMAT even when it is not explicitly specified. innodb_bug54679.test: New test, to test the bug and to ensure that there are no regressions. (The only difference in the test result without the patch applied is that the first ALTER TABLE changes ROW_FORMAT to Compact.)pull/374/head
3 changed files with 268 additions and 79 deletions
-
91mysql-test/suite/innodb/r/innodb_bug54679.result
-
97mysql-test/suite/innodb/t/innodb_bug54679.test
-
159storage/innobase/handler/ha_innodb.cc
@ -0,0 +1,91 @@ |
|||
SET GLOBAL innodb_file_format='Barracuda'; |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
SET innodb_strict_mode=ON; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed row_format=COMPRESSED |
|||
ALTER TABLE bug54679 ADD COLUMN b INT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed row_format=COMPRESSED |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compact |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed KEY_BLOCK_SIZE=1 |
|||
ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Redundant row_format=REDUNDANT |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
TABLE_NAME ROW_FORMAT CREATE_OPTIONS |
|||
bug54679 Compressed row_format=REDUNDANT KEY_BLOCK_SIZE=2 |
|||
SET GLOBAL innodb_file_format=Antelope; |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. |
|||
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. |
|||
Error 1005 Can't create table 'test.bug54679' (errno: 1478) |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
SET GLOBAL innodb_file_format=Barracuda; |
|||
SET GLOBAL innodb_file_per_table=OFF; |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table '#sql-temporary' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. |
|||
Error 1005 Can't create table '#sql-temporary' (errno: 1478) |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
ERROR HY000: Can't create table 'test.bug54679' (errno: 1478) |
|||
SHOW WARNINGS; |
|||
Level Code Message |
|||
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. |
|||
Error 1005 Can't create table 'test.bug54679' (errno: 1478) |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
DROP TABLE bug54679; |
|||
SET GLOBAL innodb_file_format=Antelope; |
|||
SET GLOBAL innodb_file_format_max=Antelope; |
|||
SET GLOBAL innodb_file_per_table=0; |
|||
@ -0,0 +1,97 @@ |
|||
# Test Bug #54679 alter table causes compressed row_format to revert to compact |
|||
|
|||
--source include/have_innodb.inc |
|||
|
|||
let $file_format=`select @@innodb_file_format`; |
|||
let $file_format_max=`select @@innodb_file_format_max`; |
|||
let $file_per_table=`select @@innodb_file_per_table`; |
|||
SET GLOBAL innodb_file_format='Barracuda'; |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
SET innodb_strict_mode=ON; |
|||
|
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
# The ROW_FORMAT of the table should be preserved when it is not specified |
|||
# in ALTER TABLE. |
|||
ALTER TABLE bug54679 ADD COLUMN b INT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
DROP TABLE bug54679; |
|||
|
|||
# Check that the ROW_FORMAT conversion to/from COMPRESSED works. |
|||
|
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
# KEY_BLOCK_SIZE implies COMPRESSED. |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=1; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
DROP TABLE bug54679; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=2; |
|||
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables |
|||
WHERE TABLE_NAME='bug54679'; |
|||
|
|||
# This prevents other than REDUNDANT or COMPACT ROW_FORMAT for new tables. |
|||
SET GLOBAL innodb_file_format=Antelope; |
|||
|
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
DROP TABLE bug54679; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB; |
|||
|
|||
SET GLOBAL innodb_file_format=Barracuda; |
|||
# This will prevent ROW_FORMAT=COMPRESSED, because the system tablespace |
|||
# cannot be compressed. |
|||
SET GLOBAL innodb_file_per_table=OFF; |
|||
|
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
DROP TABLE bug54679; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
--error ER_CANT_CREATE_TABLE |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ |
|||
SHOW WARNINGS; |
|||
SET GLOBAL innodb_file_per_table=ON; |
|||
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; |
|||
DROP TABLE bug54679; |
|||
|
|||
EVAL SET GLOBAL innodb_file_format=$file_format; |
|||
EVAL SET GLOBAL innodb_file_format_max=$file_format_max; |
|||
EVAL SET GLOBAL innodb_file_per_table=$file_per_table; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue