mirror of
https://github.com/MariaDB/server.git
synced 2025-01-23 15:24:16 +01:00
c82afadaa8
Throw warnings, not errors for wrong ROW_FORMAT or KEY_BLOCK_SIZE, so that any table dump can be loaded. As of this change, InnoDB supports the following table formats: ROW_FORMAT=REDUNDANT the only format before MySQL/InnoDB 5.0.3 ROW_FORMAT=COMPACT the new default format of MySQL/InnoDB 5.0.3 ROW_FORMAT=DYNAMIC uncompressed, no prefix in the clustered index record for BLOBs ROW_FORMAT=COMPRESSED like ROW_FORMAT=DYNAMIC, but zlib compressed B-trees and BLOBs; the compressed page size is specified by KEY_BLOCK_SIZE in kilobytes (1, 2, 4, 8, or 16; default 8) KEY_BLOCK_SIZE=1, 2, 4, 8, or 16: implies ROW_FORMAT=COMPRESSED; ignored if ROW_FORMAT is not COMPRESSED KEY_BLOCK_SIZE=anything else: ignored The InnoDB row format is displayed in the 4th column (Row_format) of the output of SHOW TABLE STATUS. The Create_options column may show ROW_FORMAT= and KEY_BLOCK_SIZE=, but they do not necessarily have anything to do with InnoDB. The table format can also be queried like this: SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb' and row_format in ('Compressed','Dynamic'); When Row_format='Compressed', KEY_BLOCK_SIZE should usually correspond to the compressed page size. But the .frm file could be manipulated to show any KEY_BLOCK_SIZE. For some reason, INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS does not include KEY_BLOCK_SIZE. It does include row_format (spelled in lowercase). This looks like a MySQL bug, because the table INFORMATION_SCHEMA.TABLES probably tries to replace SHOW TABLE STATUS. I reported this as Bug #35275 <http://bugs.mysql.com/35275>. ha_innobase::get_row_type(): Add ROW_TYPE_COMPRESSED, ROW_TYPE_DYNAMIC. ha_innobase::create(): Implement ROW_FORMAT=COMPRESSED and ROW_FORMAT=DYNAMIC. Do not throw errors for wrong ROW_FORMAT or KEY_BLOCK_SIZE, but issue warnings instead. ha_innobase::check_if_incompatible_data(): Return COMPATIBLE_DATA_NO if KEY_BLOCK_SIZE has been specified. innodb.result: Adjust the result for the warning issued for ROW_FORMAT=FIXED. innodb-zip.test: Add tests. Query INFORMATION_SCHEMA.TABLES for ROW_FORMAT.
112 lines
4.1 KiB
Text
112 lines
4.1 KiB
Text
set global innodb_file_per_table=off;
|
|
set global innodb_file_format=0;
|
|
create table t1(a int primary key) engine=innodb row_format=dynamic;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
|
|
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
|
|
create table t2(a int primary key) engine=innodb row_format=redundant;
|
|
create table t3(a int primary key) engine=innodb row_format=compact;
|
|
create table t4(a int primary key) engine=innodb key_block_size=9;
|
|
Warnings:
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format>0.
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
|
|
create table t5(a int primary key) engine=innodb
|
|
key_block_size=1 row_format=redundant;
|
|
Warnings:
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format>0.
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
|
|
set global innodb_file_per_table=on;
|
|
create table t6(a int primary key) engine=innodb
|
|
key_block_size=1 row_format=redundant;
|
|
Warnings:
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format>0.
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
|
|
set global innodb_file_format=1;
|
|
create table t7(a int primary key) engine=innodb
|
|
key_block_size=1 row_format=redundant;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
|
|
create table t8(a int primary key) engine=innodb
|
|
key_block_size=1 row_format=fixed;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
|
|
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
|
|
create table t9(a int primary key) engine=innodb
|
|
key_block_size=1 row_format=compact;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
|
|
create table t10(a int primary key) engine=innodb
|
|
key_block_size=1 row_format=dynamic;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
|
|
create table t11(a int primary key) engine=innodb
|
|
key_block_size=1 row_format=compressed;
|
|
create table t12(a int primary key) engine=innodb
|
|
key_block_size=1;
|
|
create table t13(a int primary key) engine=innodb
|
|
row_format=compressed;
|
|
create table t14(a int primary key) engine=innodb key_block_size=9;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
|
|
SELECT table_schema, table_name, row_format
|
|
FROM information_schema.tables WHERE engine='innodb';
|
|
table_schema table_name row_format
|
|
test t1 Compact
|
|
test t10 Dynamic
|
|
test t11 Compressed
|
|
test t12 Compressed
|
|
test t13 Compressed
|
|
test t14 Compact
|
|
test t2 Redundant
|
|
test t3 Compact
|
|
test t4 Compact
|
|
test t5 Redundant
|
|
test t6 Redundant
|
|
test t7 Redundant
|
|
test t8 Compact
|
|
test t9 Compact
|
|
drop table t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
|
|
alter table t1 key_block_size=0;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0.
|
|
alter table t1 row_format=dynamic;
|
|
SELECT table_schema, table_name, row_format
|
|
FROM information_schema.tables WHERE engine='innodb';
|
|
table_schema table_name row_format
|
|
test t1 Dynamic
|
|
alter table t1 row_format=compact;
|
|
SELECT table_schema, table_name, row_format
|
|
FROM information_schema.tables WHERE engine='innodb';
|
|
table_schema table_name row_format
|
|
test t1 Compact
|
|
alter table t1 row_format=redundant;
|
|
SELECT table_schema, table_name, row_format
|
|
FROM information_schema.tables WHERE engine='innodb';
|
|
table_schema table_name row_format
|
|
test t1 Redundant
|
|
drop table t1;
|
|
create table t1(a int not null, b text, index(b(10))) engine=innodb
|
|
key_block_size=1;
|
|
create table t2(b text)engine=innodb;
|
|
insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
|
|
insert into t1 select 1, b from t2;
|
|
commit;
|
|
begin;
|
|
update t1 set b=repeat('B',100);
|
|
select a,left(b,40) from t1 natural join t2;
|
|
a left(b,40)
|
|
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
|
|
rollback;
|
|
select a,left(b,40) from t1 natural join t2;
|
|
a left(b,40)
|
|
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
|
|
SELECT table_schema, table_name, row_format
|
|
FROM information_schema.tables WHERE engine='innodb';
|
|
table_schema table_name row_format
|
|
test t1 Compressed
|
|
test t2 Compact
|
|
drop table t1,t2;
|
|
set global innodb_file_per_table=0;
|
|
set global innodb_file_format=0;
|