Commit 7becfb63 authored by Larysa Sherepa's avatar Larysa Sherepa

8k, 16k...

parent 8059d6fe
No preview for this file type
No preview for this file type
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value <= 16384`)
{
--skip Test requires InnoDB with page size not greater than 16k.
}
# Check that (after lots of action) the following is still zero. If it is not,
# then the file that is allocating dynamic memory should be added to the list
# in ut_new_boot().
-- echo count_alloc WHERE event_name like 'memory/innodb/other'
-- let pfs_enabled = `SELECT COUNT(*) FROM information_schema.engines WHERE support IN ('YES', 'DEFAULT') AND engine = 'PERFORMANCE_SCHEMA'`
-- disable_query_log
if ($pfs_enabled) {
SELECT count_alloc FROM performance_schema.memory_summary_global_by_event_name
WHERE event_name = 'memory/innodb/other';
}
if (!$pfs_enabled) {
SELECT 0 AS count_alloc;
}
-- enable_query_log
# We don't support COMPRESSED table when innodb_page_size is 32k or 64k.
SET GLOBAL innodb_file_per_table=1;
# Test strict mode
SET SESSION innodb_strict_mode=ON;
-- error ER_ILLEGAL_HA
CREATE TABLE t1 (id int, a TEXT) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
-- error ER_ILLEGAL_HA
CREATE TABLE t1 (id int, a TEXT) ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
-- error ER_ILLEGAL_HA
CREATE TABLE t1(id int, a TEXT) KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
CREATE TABLE t1 (id int, a TEXT);
SHOW WARNINGS;
-- error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
-- error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
-- error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
DROP TABLE t1;
# Test non strict mode
SET SESSION innodb_strict_mode=OFF;
CREATE TABLE t1 (id int, a TEXT) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
DROP TABLE t1;
CREATE TABLE t1 (id int, a TEXT) ROW_FORMAT=COMPRESSED;
DROP TABLE t1;
CREATE TABLE t1 (id int, a TEXT) KEY_BLOCK_SIZE=4;
DROP TABLE t1;
CREATE TABLE t1 (id int, a TEXT);
ALTER TABLE t1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
DROP TABLE t1;
SET GLOBAL innodb_file_per_table=default;
This diff is collapsed.
--echo
--echo ####################################
--echo # Check if table rebuilding alter isn't affect if table is created
--echo # with explicit row_format
eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 'abc');
--source suite/innodb/include/default_row_format_show.inc
SET GLOBAL innodb_default_row_format=DYNAMIC;
ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
--echo # Here we expect COMPACT because it was explicitly specified at CREATE
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
--echo ####################################
--echo # Check if table rebuilding alter is affected when there is no
--echo # row_format specified at CREATE TABLE.
SET GLOBAL innodb_default_row_format = COMPACT;
eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 'abc');
--source suite/innodb/include/default_row_format_show.inc
SET GLOBAL innodb_default_row_format = DYNAMIC;
ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
--echo # Here we expect DYNAMIC because there is no explicit ROW_FORMAT and the
--echo # default_row_format is changed to DYNAMIC just before ALTER
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
--echo ####################################
--echo # Check the row_format effect on ALTER, ALGORITHM=COPY
SET GLOBAL innodb_default_row_format = REDUNDANT;
eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
--source suite/innodb/include/default_row_format_show.inc
SET GLOBAL innoDB_default_row_format = COMPACT;
ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
--echo # Because of ALGORITHM=COPY, there is TABLE REBUILD and the table isn't
--echo # created with explicit row_format, so we expect ROW_FORMAT=COMPACT
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
--echo ###################################
--echo # Check the row_format effect on ALTER, ALGORITH=COPY on
--echo # create table with explicit row_format
eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
--source suite/innodb/include/default_row_format_show.inc
SET GLOBAL innoDB_default_row_format = COMPACT;
ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
--echo # Because of ALGORITHM=COPY, there is TABLE REBUILD and the table is
--echo # created with explicit row_format, so we expect original
--echo # ROW_FORMAT=REDUNDANT
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
--echo ##################################
--echo # Check row_format on ALTER ALGORITHM=INPLACE
SET GLOBAL innodb_default_row_format=COMPACT;
eval CREATE $TEMPORARY TABLE t1 (a INT PRIMARY KEY, b TEXT, KEY k1(b(10))) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
--source suite/innodb/include/default_row_format_show.inc
SET GLOBAL innodb_default_row_format=DYNAMIC;
ALTER TABLE t1 DROP INDEX k1;
--echo # Because it is in-place operation, there is no rebuild, so the
--echo # original format has to be retained.
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--eval SET GLOBAL innodb_default_row_format = $INNODB_DEFAULT_ROW_FORMAT
# Check default row_format without setting new global variable
SELECT @@innodb_default_row_format;
eval CREATE $TEMPORARY TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB;
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
eval CREATE $TEMPORARY TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
eval CREATE $TEMPORARY TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
eval CREATE $TEMPORARY TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
eval CREATE $TEMPORARY TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
--source suite/innodb/include/default_row_format_show.inc
DROP TABLE t1;
--echo
perl;
use strict;
use warnings;
my $dest_dir = $ENV{'MYSQLTEST_VARDIR'};
my $prefix_len = $ENV{'PREFIX_LEN'};
open(DATA, ">$dest_dir/tmp/create_table.sql") or die "Couldn't open file
$dest_dir/tmp/create_table.sql, $!";
print DATA "CREATE TABLE t1(";
my $huge_cols = 196;
for (my $i=1; $i <= $huge_cols; $i++) {
print DATA "c$i TEXT ";
if ($i != $huge_cols) {
print DATA ", ";
}
}
print DATA ", ";
my $max_keys = 64;
for (my $i=1; $i <= $max_keys; $i++) {
print DATA "KEY k$i(c$i($prefix_len))";
if ($i != $max_keys) {
print DATA ", ";
}
}
print DATA ")ENGINE=INNODB ROW_FORMAT=DYNAMIC;";
print DATA "\n";
print DATA "INSERT INTO t1 VALUES (";
for (my $i=1; $i <= $huge_cols; $i++) {
print DATA "$i$i";
if ($i != $huge_cols) {
print DATA ", ";
}
}
print DATA ");";
print DATA "\n";
print DATA "UPDATE t1 SET ";
for (my $i=1; $i <= $huge_cols; $i++) {
print DATA " c$i=REPEAT('a', 1)";
if ($i != $huge_cols) {
print DATA ", ";
}
}
print DATA ";";
print DATA "\n";
print DATA "UPDATE t1 SET ";
for (my $i=1; $i <= $huge_cols; $i++) {
print DATA " c$i=REPEAT('a', $i)";
if ($i != $huge_cols) {
print DATA ", ";
}
}
print DATA ";";
print DATA "\n";
close DATA;
EOF
if (!$TEMPORARY) {
--source suite/innodb/include/show_i_s_tables.inc
}
if ($TEMPORARY) {
SHOW CREATE TABLE test.t1;
}
# Check Default row_format=Dynamic
SELECT @@innodb_default_row_format;
# Check if no tablespace is set
if ($tablespace == '') {
# Check Default file_per_table=ON & Barracuda
SELECT @@innodb_file_per_table;
--echo #Create table with no tablespace
CREATE TABLE tab(c1 TEXT, c2 BLOB);
# Insert some records
INSERT INTO tab VALUES('Check with no tablespace','Check with no tablespace');
}
# Check if tablespace is set
if ($tablespace == 'tblsp') {
# Check for compressed tables without File_block_size.
--echo #Create table with tablespace
CREATE TABLESPACE $tablespace ADD DATAFILE '$tablespace.ibd'
ENGINE=InnoDB;
CREATE TABLE tab(c1 TEXT, c2 BLOB) TABLESPACE $tablespace;
# Check for compressed tables with File_block_size.
CREATE TABLESPACE tblsp1 ADD DATAFILE 'tblsp1.ibd' FILE_BLOCK_SIZE=1k
ENGINE=InnoDB;
CREATE TABLE tab1(c1 TEXT, c2 BLOB) KEY_BLOCK_SIZE=1 TABLESPACE tblsp1;
# Insert some records
INSERT INTO tab VALUES('Check with General tablespace',
'Check with General tablespace');
INSERT INTO tab1 VALUES('tablsp File Block size',
'tablsp File Block size');
}
# Check if system tablespace is set
if ($tablespace == 'innodb_system') {
--echo #Create table with innodb system tablespace
# Create table in system tablesspace
CREATE TABLE tab(c1 TEXT, c2 BLOB) TABLESPACE innodb_system;
# Insert some records
INSERT INTO tab VALUES('Check with InnoDB system tablespace',
'Check with InnoDB system tablespace');
}
# Check when file_per_table=OFF is set
if ($tablespace == 'OFF') {
# Set file_per_table=OFF
SET GLOBAL innodb_file_per_table=0;
# Check Default file_per_table=OFF
SELECT @@innodb_file_per_table;
--echo #Create table with file_per_table=0
CREATE TABLE tab(c1 TEXT, c2 BLOB);
# Insert some records
INSERT INTO tab VALUES('File per table off','File per table off');
}
# Check Default row_format=Dynamic
--source suite/innodb/include/default_row_format_show.inc
ALTER TABLE tab ROW_FORMAT=COMPACT;
# Check Default row_format=Compact
--source suite/innodb/include/default_row_format_show.inc
CHECK TABLE tab;
ALTER TABLE tab ROW_FORMAT=DYNAMIC;
# Check Default row_format=Dynamic
--source suite/innodb/include/default_row_format_show.inc
CHECK TABLE tab;
ALTER TABLE tab ROW_FORMAT=REDUNDANT;
# Check Default row_format=Redundant
--source suite/innodb/include/default_row_format_show.inc
CHECK TABLE tab;
# Check successful, when no tablespace is set
if ($tablespace == '') {
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
}
# When tablespace is set, check error for compressed tables with
# and without File_block_size
# Check ALTER success for compressed tables with tablespace File_block_size
if ($tablespace == 'tblsp') {
# Check error with compressed tables without File_block_size
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
# Check error with compressed tables with File_block_size
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE tab1 ROW_FORMAT=DYNAMIC;
}
# Check when file_per_table=OFF is set
if ($tablespace == 'OFF') {
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
}
# Check Default row_format=Compressed
# Note: we do not use default_row_format_show.inc because
# ALTER ROW_FORMAT=COMPRESSED shows different compressed page sizes
# with different innodb_page_sizes
SELECT NAME,FILE_FORMAT,ROW_FORMAT FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE NAME='test/tab';
CHECK TABLE tab;
if ($tablespace == 'tblsp') {
CHECK TABLE tab1;
}
ALTER TABLE tab ROW_FORMAT=Dynamic;
# Check Default row_format=Dynamic;
--source suite/innodb/include/default_row_format_show.inc
CHECK TABLE tab;
# Cleanup
DROP TABLE tab;
# Drop only when tablespace is set
if ($tablespace == 'tblsp') {
DROP TABLE tab1;
DROP TABLESPACE $tablespace;
DROP TABLESPACE tblsp1;
}
# Reset to default values
SET GLOBAL innodb_file_per_table=Default;
#
# WL#6737: Drop workload created for firing queries.
#
drop function func1;
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14;
--remove_file $MYSQL_TMP_DIR/alt_dir/test/nolink.ibd.bak
--rmdir $MYSQL_TMP_DIR/alt_dir/test
--rmdir $MYSQL_TMP_DIR/alt_dir
--rmdir $MYSQL_TMP_DIR/new_dir/test
--rmdir $MYSQL_TMP_DIR/new_dir
#
# wl#7277: InnoDB: Bulk Load for Create Index
#
# Create Insert Procedure
DELIMITER |;
CREATE PROCEDURE populate_t1(load_even INT)
BEGIN
DECLARE i int DEFAULT 1;
START TRANSACTION;
WHILE (i <= 10000) DO
IF i%2 = 0 AND load_even = 1 THEN
INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
END IF;
IF i%2 != 0 AND load_even != 1 THEN
INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
END IF;
SET i = i + 1;
END WHILE;
COMMIT;
END|
DELIMITER ;|
SELECT @@innodb_fill_factor;
if ($row_format != 'COMPRESSED')
{
eval CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB ROW_FORMAT=$row_format;
}
if ($row_format == 'COMPRESSED')
{
SET GLOBAL innodb_file_per_table=1;
eval CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
}
-- disable_query_log
# Load half records
CALL populate_t1(1);
-- enable_query_log
SELECT COUNT(*) FROM t1;
/* Create index. */
CREATE INDEX idx_id ON t1(id);
CREATE INDEX idx_title ON t1(title);
/* Check table. */
CHECK TABLE t1;
/* Select by index. */
EXPLAIN SELECT * FROM t1 WHERE id = 10;
EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
SELECT * FROM t1 WHERE id = 10;
SELECT * FROM t1 WHERE title = 'a10';
SELECT * FROM t1 WHERE id = 5000;
SELECT * FROM t1 WHERE title = 'a5000';
SELECT * FROM t1 WHERE id = 10000;
SELECT * FROM t1 WHERE title = 'a10000';
SELECT * FROM t1 WHERE id = 10010;
SELECT * FROM t1 WHERE title = 'a10010';
/*Insert/Update/Delete. */
DELETE FROM t1 WHERE id < 4010 AND id > 3990;
INSERT INTO t1 VALUES(4000, 4000, 'b4000');
UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
SELECT * FROM t1 WHERE id = 3000;
SELECT * FROM t1 WHERE title = 'a3000';
SELECT * FROM t1 WHERE title = 'b3000';
SELECT * FROM t1 WHERE id = 4000;
SELECT * FROM t1 WHERE title = 'a4000';
SELECT * FROM t1 WHERE title = 'b4000';
SELECT * FROM t1 WHERE id = 4001;
SELECT * FROM t1 WHERE title = 'a4001';
-- disable_query_log
# Load half records (follow up load)
CALL populate_t1(0);
-- enable_query_log
SELECT COUNT(*) FROM t1;
/* Add column. */
ALTER TABLE t1 ADD COLUMN content TEXT;
CHECK TABLE t1;
SELECT * FROM t1 WHERE id = 10;
SELECT * FROM t1 WHERE title = 'a10';
SELECT * FROM t1 WHERE id = 5000;
SELECT * FROM t1 WHERE title = 'a5000';
SELECT * FROM t1 WHERE id = 10000;
SELECT * FROM t1 WHERE title = 'a10000';
SELECT * FROM t1 WHERE id = 10010;
SELECT * FROM t1 WHERE title = 'a10010';
/* Drop column. */
ALTER TABLE t1 DROP COLUMN content;
CHECK TABLE t1;
SELECT * FROM t1 WHERE id = 10;
SELECT * FROM t1 WHERE title = 'a10';
SELECT * FROM t1 WHERE id = 5000;
SELECT * FROM t1 WHERE title = 'a5000';
SELECT * FROM t1 WHERE id = 10000;
SELECT * FROM t1 WHERE title = 'a10000';
SELECT * FROM t1 WHERE id = 10010;
SELECT * FROM t1 WHERE title = 'a10010';
DROP TABLE t1;
# Test Blob
if ($row_format != 'COMPRESSED') {
eval CREATE TABLE t1(
a INT PRIMARY KEY,
b TEXT,
c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
}
if ($row_format == 'COMPRESSED') {
eval CREATE TABLE t1(
a INT PRIMARY KEY,
b BLOB,
c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
}
let $cnt= 5000;
-- disable_query_log
WHILE ($cnt>=4950)
{
EVAL INSERT INTO t1 VALUES
($cnt, REPEAT(CONCAT('a', $cnt),2000), CONCAT('a', $cnt));
dec $cnt;
}
-- enable_query_log
ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
ALTER TABLE t1 DROP COLUMN c;
CHECK TABLE t1;
SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
DROP TABLE t1;
# Restore global variables
if ($row_format == 'COMPRESSED')
{
SET GLOBAL innodb_file_per_table=default;
}
DROP PROCEDURE populate_t1;
#
# wl#7277: InnoDB: Bulk Load for Create Index
#
# Not supported in embedded
-- source include/not_embedded.inc
# This test case needs to crash the server. Needs a debug server.
-- source include/have_debug.inc
# Don't test this under valgrind, memory leaks will occur.
-- source include/not_valgrind.inc
# Avoid CrashReporter popup on Mac
-- source include/not_crashrep.inc
-- source include/have_innodb.inc
# Create Insert Procedure
DELIMITER |;
CREATE PROCEDURE populate_t1()
BEGIN
DECLARE i int DEFAULT 1;
START TRANSACTION;
WHILE (i <= 10000) DO
INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
SET i = i + 1;
END WHILE;
COMMIT;
END|
DELIMITER ;|
# Test scenarios:
# 1. Test restart;
# 2. Test crash recovery.
# Test Restart
if ($row_format != 'COMPRESSED')
{
eval CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB ROW_FORMAT=$row_format;
}
if ($row_format == 'COMPRESSED')
{
SET GLOBAL innodb_file_per_table=1;
eval CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
}
-- disable_query_log
CALL populate_t1();
-- enable_query_log
SELECT COUNT(*) FROM t1;
CREATE INDEX idx_title ON t1(title);
--source include/restart_mysqld.inc
CHECK TABLE t1;
SELECT * FROM t1 WHERE title = 'a10';
SELECT * FROM t1 WHERE title = 'a5000';
SELECT * FROM t1 WHERE title = 'a10000';
SELECT * FROM t1 WHERE title = 'a10010';
DROP TABLE t1;
-- echo # Test Blob
if ($row_format != 'COMPRESSED') {
eval CREATE TABLE t1(
a INT PRIMARY KEY,
b TEXT,
c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
}
if ($row_format == 'COMPRESSED') {
SET GLOBAL innodb_file_per_table=1;
eval CREATE TABLE t1(
a INT PRIMARY KEY,
b TEXT,
c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
}
INSERT INTO t1 VALUES
(1, REPEAT('a',10000), 'a'),
(2, REPEAT('b',20000), 'b'),
(3, REPEAT('c',40000), 'c'),
(4, REPEAT('d',60000), 'd');
SELECT CHAR_LENGTH(b) FROM t1;
ALTER TABLE t1 DROP COLUMN c;
--source include/restart_mysqld.inc
CHECK TABLE t1;
SELECT CHAR_LENGTH(b) FROM t1;
DROP TABLE t1;
# Test Crash Recovery
if ($row_format != 'COMPRESSED')
{
eval CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB ROW_FORMAT=$row_format;
}
if ($row_format == 'COMPRESSED')
{
SET GLOBAL innodb_file_per_table=1;
eval CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
}
-- disable_query_log
CALL populate_t1();
-- enable_query_log
SET SESSION debug="+d,crash_commit_before";
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
CREATE INDEX idx_title ON t1(title);
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
SELECT * FROM t1 WHERE title = 'a10';
SELECT * FROM t1 WHERE title = 'a5000';
SELECT * FROM t1 WHERE title = 'a10000';
SELECT * FROM t1 WHERE title = 'a10010';
DROP TABLE t1;
-- echo # Test Blob
if ($row_format != 'COMPRESSED') {
eval CREATE TABLE t1(
a INT PRIMARY KEY,
b TEXT,
c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
}
if ($row_format == 'COMPRESSED') {
SET GLOBAL innodb_file_per_table=1;
eval CREATE TABLE t1(
a INT PRIMARY KEY,
b TEXT,
c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
}
INSERT INTO t1 VALUES
(1, REPEAT('a',10000), 'a'),
(2, REPEAT('b',20000), 'b'),
(3, REPEAT('c',40000), 'c'),
(4, REPEAT('d',60000), 'd');
SELECT CHAR_LENGTH(b) FROM t1;
SET SESSION debug="+d,crash_commit_before";
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
ALTER TABLE t1 DROP COLUMN c;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
CHECK TABLE t1;
SELECT CHAR_LENGTH(b) FROM t1;
DROP TABLE t1;
# Restore global variables
if ($row_format == 'COMPRESSED')
{
SET GLOBAL innodb_file_per_table=default;
}
DROP PROCEDURE populate_t1;
This diff is collapsed.
#
# test loading of table with different action that
# cause commit/rollback/purge (mainly involving undo-logs)
#
delimiter |;
create procedure populate_t1()
begin
declare i int default 1;
while (i <= 2000) DO
insert into t1 values (i, 'a', 'b');
set i = i + 1;
end while;
end|
delimiter ;|
begin;
call populate_t1();
commit;
select count(*) from t1;
begin;
call populate_t1();
rollback;
select count(*) from t1;
truncate table t1;
select count(*) from t1;
begin;
call populate_t1();
commit;
select count(*) from t1;
# purge should kick-in after delete.
delete from t1 where a < 500;
select count(*) from t1;
update t1 set b = 'innodb' where b = 'a';
update t1 set c = 'mysql' where c = 'b' and a < 1000;
begin;
update t1 set c = 'sqldb' where c = 'mysql' and a < 1000;
select count(*) from t1 where c = 'sqldb';
rollback;
#
drop procedure populate_t1;
--source include/have_innodb.inc
eval CREATE TABLE `t` (
`a` VARCHAR(10000), `b` VARCHAR(3000),
`c` VARCHAR(14000) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
`d` VARCHAR(5000) GENERATED ALWAYS AS (b) VIRTUAL,
`e` INT(11) GENERATED ALWAYS AS (10) VIRTUAL,
`h` INT(11) NOT NULL,
PRIMARY KEY (`h`) ) ROW_FORMAT=$row_format ENGINE=InnoDB;
SHOW CREATE TABLE t;
INSERT INTO t VALUES (REPEAT('g', 10000), REPEAT('x', 2800), DEFAULT, DEFAULT, DEFAULT, 1);
INSERT INTO t VALUES (REPEAT('a', 9000), REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 2);
INSERT INTO t VALUES (REPEAT('m', 8000), REPEAT('n', 3000), DEFAULT, DEFAULT, DEFAULT, 3);
CREATE INDEX idx ON t(c(100), d(20));
UPDATE t SET a = REPEAT(CAST(1 AS CHAR), 2000) WHERE h = 1;
delimiter |;
CREATE PROCEDURE UPDATE_t()
begin
DECLARE i INT DEFAULT 1;
WHILE (i <= 100) DO
UPDATE t SET a = REPEAT(CAST(i AS CHAR), 2000) WHERE h = 1;
SET i = i + 1;
END WHILE;
END|
CREATE PROCEDURE DELETE_insert_t()
begin
DECLARE i INT DEFAULT 1;
WHILE (i <= 100) DO
DELETE FROM t WHERE h = 1;
INSERT INTO t VALUES (REPEAT(CAST(i AS CHAR), 2000) , REPEAT('b', 2000), DEFAULT, DEFAULT, DEFAULT, 1);
SET i = i + 1;
END WHILE;
END|
delimiter ;|
CALL UPDATE_t();
CALL DELETE_insert_t();
UPDATE t SET a = NULL WHERE h=1;
START TRANSACTION;
CALL UPDATE_t();
ROLLBACK;
DROP PROCEDURE DELETE_insert_t;
DROP PROCEDURE UPDATE_t;
DROP TABLE t;
#
# WL#6737: Integrating InnoDB temporary tables with MySQL Optimizer.
#
SET @optimizer_switch_saved= @@optimizer_switch;
SET @@optimizer_switch="derived_merge=off";
# use sql_buffer_result
explain format = json select sql_buffer_result * from t1;
select sql_buffer_result * from t1;
explain format = json select sql_buffer_result * from t2;
select sql_buffer_result * from t2;
#
# If order by is not simple order
# If not (sort_order only uses fields from head table and the head table is not left join table)
explain format = json select * from t1 left join t2 on t1.b = t2.b order by t1.a;
select * from t1 left join t2 on t1.b = t2.b order by t1.a;
#
# If sorting by a sp or udf function due to their expensive and probably non-deterministic nature.
explain format = json select * from t1 order by func1(a);
select * from t1 order by func1(a);
--source include/turn_off_only_full_group_by.inc
# order by aggregate function
explain format = json select a from t1 group by b order by sum(a);
select a from t1 group by b order by sum(a);
# order by aggregate -- In order to make it simple, we make group by index
explain format = json select a from t7 group by b order by sum(a);
select a from t7 group by b order by sum(a);
#
# a select with join and sql_big_result(only can work with group by or distinct)
explain format = json select sql_big_result distinct * from t1, t2;
select sql_big_result distinct * from t1, t2;
explain format = json select sql_big_result t1.b from t1, t2 group by t1.b;
select sql_big_result t1.b from t1, t2 group by t1.b;
explain format = json select sql_big_result distinct t1.a from t1, t2 group by t1.b;
select sql_big_result distinct t1.a from t1, t2 group by t1.b;
#
# a select with join and sorting
explain format = json select t1.* from t1 inner join t2 on t1.a = t2.a order by t2.a;
select t1.* from t1 inner join t2 on t1.a = t2.a order by t2.a;
explain format = json select t1.* from t1, t2 where t1.a = t2.a order by t1.a;
select t1.* from t1, t2 where t1.a = t2.a order by t1.a;
#
# a select with join and grouping that uses tmp table for grouping
explain format = json select t1.* from t1 inner join t2 where t1.a = t2.a group by t1.a;
select t1.* from t1 inner join t2 where t1.a = t2.a group by t1.a;
explain format = json select t1.* from t1 inner join t2 where t1.a = t2.a group by t2.a;
select t1.* from t1 inner join t2 where t1.a = t2.a group by t2.a;
#
# there is an order by clause and a different group by clause
explain format = json select a from t1 group by a order by a;
select a from t1 group by a order by a;
explain format = json select b from t1 group by b order by a;
select b from t1 group by b order by a;
#
# select distinct that uses tmp table for duplicate elimination
explain format = json select distinct t1.a from t1, t2 where t1.b = t2.b;
select distinct t1.a from t1, t2 where t1.b = t2.b;
#
# remove_dup_with_hash_index
explain format = json select distinct a from t1 group by b,a;
select distinct a from t1 group by b,a;
#
# remove_dup_with_compare
set @old_sort_buffer_size = @@sort_buffer_size;
set @@sort_buffer_size = 32804;
explain format = json select distinct b from t3 group by a having count(*) > 1;
select distinct b from t3 group by a having count(*) > 1;
select distinct b from t3 group by a;
set @@sort_buffer_size = @old_sort_buffer_size;
#
# special case for distinct
explain format = json select distinct t4.a,e from t4, t1 order by t4.b;
select distinct t4.a,e from t4, t1 order by t4.b;
#
# union
explain format = json select * from t1 union all select * from t2;
select * from t1 union all select * from t2;
# union distinct with global order by filesort
explain format = json select * from t1 union select * from t2 order by b;
select * from t1 union select * from t2 order by b;
#
# select with a single derived table
explain format = json select tt.* from (select * from t1) as tt;
select tt.* from (select * from t1) as tt;
# select with a derived table that builds index over the derived table
explain format = json select b from (select b from t5 where b > 5) tt;
select b from (select b from t5 where b > 5) tt;
# select with mutiple derived tables
explain format = json select * from (select b from t1) as t1, (select b from t2) as t2;
select * from (select b from t1) as t1, (select b from t2) as t2;
# derived table uses 'ref' scan
explain format = json select * from t1, (select * from t6) as t where t.a =5;
select * from t1, (select * from t6) as t where t.a =5;
#
# materialized semi-join
explain format = json select * from t1 where t1.a in (select a from t2) ;
select * from t1 where t1.a in (select a from t2) ;
# tmp table for semi-join weedout
if (`select locate('materialization', @@optimizer_switch) > 0`)
{
set optimizer_switch='materialization=off';
}
if (`select locate('firstmatch', @@optimizer_switch) > 0`)
{
set optimizer_switch='firstmatch=off';
}
if (`select locate('loosescan', @@optimizer_switch) > 0`)
{
set optimizer_switch='loosescan=off';
}
explain format = json select * from t1 where t1.a in (select a from t2) ;
select * from t1 where t1.a in (select a from t2) ;
set optimizer_switch='default,derived_merge=off';
#
# muti-update
if (!`select @@innodb_read_only`)
{
explain format = json update t1, t2 set t1.a = 9, t2.a = 10 where t1.b = 'a';
update t1, t2 set t1.a = 9, t2.a = 10 where t1.b = 'a';
}
#
# count with distinct
explain format = json select count(distinct a) from t1;
select count(distinct a) from t1;
#
# group_concat
explain format = json select b, group_concat(a) from t1;
select b, group_concat(a) from t1;
#
# quick group
select * from t1;
explain format = json select b, count(a), sum(a), avg(a), std(a),
min(a), max(a), bit_and(a), bit_or(a) from t1 group by b;
select b, count(a), sum(a), avg(a), std(a), min(a),
max(a), bit_and(a), bit_or(a) from t1 group by b;
#
# choose innodb to create tmp table
--disable_warnings
select sql_big_result * from information_schema.global_variables where variable_name like 'internal_tmp_disk_storage_engine';
--enable_warnings
#
# union distinct and all
select 1 union distinct select 1 union all select 1;
#
# enable and disable indexes
select alias1.`col_int_key` AS field1 from (t8 as alias1) where (5) in
(select 7 union select 1) order by alias1.`col_varchar_key` asc;
#
# Exercises select from multiple non-temporary tables that result in
# insert .... select kind of semantics on intrinsic temporary table.
select count(table2.col_date_key) as field1 from
(t10 as table1 inner join
((t10 as table2 right join
t9 as table3 on
((table3.pk = table2.pk) or
(table3.pk = table2.col_int_key))))
on ((table3.pk < table2.col_int_nokey)))
order by field1 ASC;
#
# trying to create index on blob column
select distinct table1.col_varchar_1024_utf8_key as field1
from t11 as table1 left join t11 as table2 on
table1.col_varchar_1024_utf8 = table2.col_varchar_1024_latin1_key
order by field1;
#
# nulls_equal use-case
select t from t12 group by c;
#
# complex queries resulting in multiple intrinsic temporary tables
select count(outr.col_varchar_nokey) AS x
from t13 as outr2 left join
(select * from t13) as outr
on (outr2.col_time_key > outr.col_date_key)
where outr.pk in
(select innr.col_int_nokey AS y from
(select * from t14) as innr2 left join
(select * from t14) AS innr
ON (innr2.col_int_nokey = innr.col_int_key)
where innr.col_varchar_nokey > innr.col_varchar_key
or not outr.pk > 9)
or outr.col_varchar_key is null;
--source include/restore_sql_mode_after_turn_off_only_full_group_by.inc
SET @@optimizer_switch=@optimizer_switch_saved;
......@@ -6,7 +6,6 @@
--replace_regex /#P#/#p#/ /#SP#/#sp#/
--replace_result ./ MYSQLD_DATADIR/ $MYSQLD_DATADIR/ MYSQLD_DATADIR/ $MYSQLD_DATADIR MYSQLD_DATADIR/ $MYSQL_TMP_DIR MYSQL_TMP_DIR $INNODB_PAGE_SIZE DEFAULT
SELECT s.name 'Space_Name',
s.space_type 'Space_Type',
s.page_size 'Page_Size',
s.zip_page_size 'Zip_Size',
s.row_format 'Formats_Permitted',
......
# Remember some variables.
LET $MYSQLD_DATADIR = `select @@datadir`;
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
--echo #
--echo # Try a series of invalid relative ADD DATAFILE entries.
--echo # General tablespace files can be in the datadir but they cannot be under the datadir.
--echo #
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE '';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE '.ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE './ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE './.ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE '../spaces/';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE 'test/bad.ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE './test/bad.ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE './test//bad.ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE '../data/test/bad.ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE '../data/../data/test/bad.ibd';
SHOW WARNINGS;
--error ER_WRONG_FILE_NAME
CREATE TABLESPACE bad ADD DATAFILE '../does_not_exist/bad.ibd';
SHOW WARNINGS;
--echo #
--echo # Try a series of valid relative ADD DATAFILE entries.
--echo # General tablespace files can be in the datadir but they cannot be under the datadir.
--echo #
CREATE TABLESPACE ibport_s01 ADD DATAFILE 'ibport_s01.ibd';
CREATE TABLESPACE ibport_s02 ADD DATAFILE './ibport_s02.ibd';
CREATE TABLESPACE ibport_s03 ADD DATAFILE '../data/ibport_s03.ibd';
CREATE TABLESPACE ibport_s04 ADD DATAFILE 'test/../ibport_s04.ibd';
CREATE TABLESPACE ibport_s05 ADD DATAFILE './test/../ibport_s05.ibd';
CREATE TABLESPACE ibport_s06 ADD DATAFILE '..///data//test///..//ibport_s06.ibd';
CREATE TABLESPACE ibport_s12 ADD DATAFILE '.\\ibport_s12.ibd';
CREATE TABLESPACE ibport_s13 ADD DATAFILE '..\\data\\ibport_s13.ibd';
CREATE TABLESPACE ibport_s14 ADD DATAFILE 'test\\..\\ibport_s14.ibd';
CREATE TABLESPACE ibport_s15 ADD DATAFILE '.\\test\\..\\ibport_s15.ibd';
CREATE TABLESPACE ibport_s16 ADD DATAFILE '..\\\\\\data\\\\test\\\\\\..\\\\ibport_s16.ibd';
--echo # Directory listing of MYSQLD_DATADIR/ ibport*
--list_files $MYSQLD_DATADIR/ ibport*
--replace_result $MYSQLD_DATADIR/ MYSQLD_DATADIR/ $MYSQLD_DATADIR MYSQLD_DATADIR/
SELECT s.space_type 'Type', s.name 'Space Name', d.path 'Path'
FROM information_schema.innodb_sys_tablespaces s, information_schema.innodb_sys_datafiles d
WHERE s.name like '%ibport%' AND s.space = d.space ORDER BY s.space;
--replace_result $MYSQLD_DATADIR/ MYSQLD_DATADIR/ $MYSQLD_DATADIR MYSQLD_DATADIR/
SELECT s.space_type 'Type', s.name 'Space Name', f.file_name 'Path'
FROM information_schema.innodb_sys_tablespaces s, information_schema.files f
WHERE s.name like '%ibport%' AND s.space = f.file_id ORDER BY s.space;
DROP TABLESPACE ibport_s01;
DROP TABLESPACE ibport_s02;
DROP TABLESPACE ibport_s03;
DROP TABLESPACE ibport_s04;
DROP TABLESPACE ibport_s05;
DROP TABLESPACE ibport_s06;
DROP TABLESPACE ibport_s12;
DROP TABLESPACE ibport_s13;
DROP TABLESPACE ibport_s14;
DROP TABLESPACE ibport_s15;
DROP TABLESPACE ibport_s16;
This diff is collapsed.
--eval SET SESSION debug="+d,$DBUG_CRASH_POINT"
--replace_regex /'.*t1.cfg'/'t1.cfg'/
--error ER_OUT_OF_RESOURCES
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
--eval SET SESSION debug="-d,$DBUG_CRASH_POINT"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -8,43 +8,43 @@ variable_value
SELECT variable_value FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value
{checked_valid}
1023
# Test 3) Query some information_shema tables that are dependent upon
# the page size.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
i.n_fields
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'mysql%'
ORDER BY t.name, i.index_id;
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
mysql/innodb_index_stats 11 33 PRIMARY 3 3 4 50
mysql/innodb_table_stats 9 33 PRIMARY 3 3 2 50
table_name n_cols table_flags index_name root_page type n_fields
mysql/innodb_index_stats 11 1 PRIMARY 3 3 4
mysql/innodb_table_stats 9 1 PRIMARY 3 3 2
CREATE TABLE t1 (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t2 (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t3 (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb;
CREATE TABLE t4 (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
i.n_fields
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
AND t.name LIKE 'test%'
ORDER BY t.name, i.name;
table_name n_cols table_flags index_name root_page type n_fields merge_threshold
test/t1 5 0 PRIMARY 3 3 1 50
test/t2 5 1 PRIMARY 3 3 1 50
test/t3 5 39 PRIMARY 3 3 1 50
test/t4 5 33 PRIMARY 3 3 1 50
table_name n_cols table_flags index_name root_page type n_fields
test/t1 5 0 PRIMARY 3 3 1
test/t2 5 1 PRIMARY 3 3 1
test/t3 5 39 PRIMARY 3 3 1
test/t4 5 33 PRIMARY 3 3 1
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t1 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 Single DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
test/t3 Single DEFAULT 4096 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 Single DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4.ibd
Space_Name Page_Size Zip_Size Formats_Permitted Path
test/t1 DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t1.ibd
test/t2 DEFAULT 0 Compact or Redundant MYSQLD_DATADIR/test/t2.ibd
test/t3 DEFAULT 4096 Compressed MYSQLD_DATADIR/test/t3.ibd
test/t4 DEFAULT 0 Dynamic MYSQLD_DATADIR/test/t4.ibd
DROP TABLE t1, t2, t3, t4;
# Test 4) The maximum row size is dependent upon the page size.
# Redundant: 4027, Compact: 4030.
......@@ -252,14 +252,12 @@ CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_file_format = `Antelope`;
Warnings:
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
SHOW WARNINGS;
......@@ -271,13 +269,11 @@ CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Warning 1478 InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8.
Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SET GLOBAL innodb_file_format = `Barracuda`;
Warnings:
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
# Test 7) Not included here; 16k only
# Test 8) Test creating a table that could lead to undo log overflow.
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
......@@ -299,7 +295,7 @@ k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c;
CREATE INDEX t1c ON t1 (c(767));
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d,f=@d,g=@d,h=@d,i=@d,j=@d,
k=@d,l=@d,m=@d,n=@d,o=@d,p=@d,q=@d,r=@d,s=@d,t=@d,u=@d;
ERROR HY000: Undo log record is too big
ERROR HY000: Undo log record is too big.
BEGIN;
UPDATE t1 SET a=@d,b=@d,c=@d,d=@d,e=@d;
UPDATE t1 SET f=@d,g=@d,h=@d,i=@d,j=@d,k=@d,l=@d,m=@d,
......@@ -318,33 +314,34 @@ UPDATE t1 SET h=@e;
CREATE INDEX t1i ON t1 (i(767));
UPDATE t1 SET i=@e;
CREATE INDEX t1k ON t1 (j(767));
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 4030. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
CREATE INDEX t1j ON t1 (j(500));
UPDATE t1 SET j=@e;
ERROR HY000: Undo log record is too big
ERROR HY000: Undo log record is too big.
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` blob DEFAULT NULL,
`b` blob DEFAULT NULL,
`c` blob DEFAULT NULL,
`d` blob DEFAULT NULL,
`e` blob DEFAULT NULL,
`f` blob DEFAULT NULL,
`g` blob DEFAULT NULL,
`h` blob DEFAULT NULL,
`i` blob DEFAULT NULL,
`j` blob DEFAULT NULL,
`k` blob DEFAULT NULL,
`l` blob DEFAULT NULL,
`m` blob DEFAULT NULL,
`n` blob DEFAULT NULL,
`o` blob DEFAULT NULL,
`p` blob DEFAULT NULL,
`q` blob DEFAULT NULL,
`r` blob DEFAULT NULL,
`s` blob DEFAULT NULL,
`t` blob DEFAULT NULL,
`u` blob DEFAULT NULL,
`a` blob,
`b` blob,
`c` blob,
`d` blob,
`e` blob,
`f` blob,
`g` blob,
`h` blob,
`i` blob,
`j` blob,
`k` blob,
`l` blob,
`m` blob,
`n` blob,
`o` blob,
`p` blob,
`q` blob,
`r` blob,
`s` blob,
`t` blob,
`u` blob,
KEY `t1a` (`a`(767)),
KEY `t1b` (`b`(767)),
KEY `t1c` (`c`(767)),
......@@ -354,7 +351,6 @@ t1 CREATE TABLE `t1` (
KEY `t1g` (`g`(767)),
KEY `t1h` (`h`(767)),
KEY `t1i` (`i`(767)),
KEY `t1k` (`j`(767)),
KEY `t1j` (`j`(500))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
DROP TABLE t1;
......@@ -426,16 +422,12 @@ CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
......@@ -443,10 +435,9 @@ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
Warnings:
Warning 139 Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE t1;
ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_file_format=Barracuda;
set global innodb_file_per_table=on;
set global innodb_file_format=`1`;
create table t1(a text) engine=innodb key_block_size=4;
SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0;
page_size
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -6,6 +6,9 @@ SET default_storage_engine=InnoDB;
--disable_query_log
let $MYSQLD_DATADIR = `select @@datadir`;
let $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
let $innodb_file_format_orig=`select @@innodb_file_format`;
SET GLOBAL innodb_file_format=Barracuda;
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
# These values can change during the test
......@@ -40,7 +43,7 @@ SELECT variable_value FROM information_schema.global_status
# since they are created consistently during bootstrap.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
i.n_fields
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
......@@ -58,7 +61,7 @@ CREATE TABLE t4 (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
# within a file-per-table tablespace.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
i.n_fields
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
......@@ -125,6 +128,7 @@ c36 char(200), c37 char(200), c38 char(200), c39 char(250), c40 char(247)
# Compressed table; 7959 bytes with 40 CHAR fields
# Bug#13391353 Limit is 7957 on 32-Linux only
CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),
......@@ -490,8 +494,9 @@ UPDATE t1 SET s=@e;
CREATE INDEX t1t ON t1 (t(767));
--error ER_UNDO_RECORD_TOO_BIG
UPDATE t1 SET t=@e;
--error 1118
CREATE INDEX t1u ON t1 (u(767));
--error 1118
CREATE INDEX t1ut ON t1 (u(767), t(767));
CREATE INDEX t1st ON t1 (s(767), t(767));
......@@ -634,24 +639,24 @@ DROP TABLE bug12547647;
# The following should fail in non-strict mode too.
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
SET SESSION innodb_strict_mode = off;
--error 1118
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
--error 1118
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
--error 1118
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
......@@ -705,6 +710,7 @@ SELECT COUNT(*) FROM
set @@optimizer_switch=@optimizer_switch_saved;
SET SESSION sort_buffer_size = DEFAULT;
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
DROP TABLE t1;
......
......@@ -6,6 +6,8 @@ SET default_storage_engine=InnoDB;
--disable_query_log
let $MYSQLD_DATADIR = `select @@datadir`;
let $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
let $innodb_file_format_orig=`select @@innodb_file_format`;
SET GLOBAL innodb_file_format=Barracuda;
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
--enable_query_log
......@@ -36,7 +38,7 @@ SELECT variable_value FROM information_schema.global_status
# since they are created consistently during bootstrap.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
i.n_fields
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
......@@ -54,7 +56,7 @@ CREATE TABLE t4 (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
# within a file-per-table tablespace.
SELECT t.name table_name, t.n_cols, t.flag table_flags,
i.name index_name, i.page_no root_page, i.type,
i.n_fields, i.merge_threshold
i.n_fields
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t,
INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
WHERE t.table_id = i.table_id
......@@ -326,6 +328,7 @@ CREATE INDEX t1i ON t1 (i(767));
UPDATE t1 SET i=@e;
--replace_regex /> [0-9]*/> max_row_size/
--error 1118
CREATE INDEX t1k ON t1 (j(767));
# But it does allow a 500 byte index. And with this, we cannot
......@@ -441,27 +444,28 @@ DROP TABLE t1;
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
SET SESSION innodb_strict_mode = off;
--replace_regex /> [0-9]*/> max_row_size/
--error 1118
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
--replace_regex /> [0-9]*/> max_row_size/
--error 1118
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(
c text NOT NULL, d text NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
--replace_regex /> [0-9]*/> max_row_size/
--error 1118
CREATE TABLE t1(c text, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
DROP TABLE t1;
CREATE TABLE t1(c text, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
DROP TABLE t1;
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
......@@ -3,13 +3,12 @@
# scans through pages
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
let $innodb_file_format_orig=`select @@innodb_file_format`;
SET GLOBAL innodb_file_format=Barracuda;
-- let $query_i_s = SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0
set global innodb_file_per_table=on;
set global innodb_file_format=`1`;
create table t1(a text) engine=innodb key_block_size=4;
-- disable_query_log
......@@ -57,5 +56,5 @@ drop table t2;
#
-- disable_query_log
eval set global innodb_file_format=$format;
eval set global innodb_file_per_table=$per_table;
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
\ No newline at end of file
......@@ -21,6 +21,7 @@ if (`SELECT @@innodb_log_compressed_pages = 0`)
-- vertical_results
SET GLOBAL innodb_cmp_per_index_enabled=ON;
let $innodb_file_format_orig=`select @@innodb_file_format`;
SET GLOBAL innodb_file_format=Barracuda;
# reset any leftover stats from previous tests
......@@ -116,4 +117,4 @@ ORDER BY 1, 2, 3;
DROP TABLE t;
SET GLOBAL innodb_cmp_per_index_enabled=default;
SET GLOBAL innodb_file_format=default;
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment