mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix test failures seen on
-- innodb-wl5522-debug-zip (path differences win/unix) -- innodb_defragment_fill_factor (stabilise) -- innodb_force_pk (case difference win/unix)
This commit is contained in:
@ -104,7 +104,7 @@ restore: t1 .ibd and .cfg files
|
|||||||
SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
|
SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
|
||||||
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
|
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
|
||||||
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
||||||
ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd
|
ERROR HY000: Got error 44 't1.ibd
|
||||||
SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure";
|
SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure";
|
||||||
restore: t1 .ibd and .cfg files
|
restore: t1 .ibd and .cfg files
|
||||||
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
|
SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure";
|
||||||
@ -537,7 +537,7 @@ ERROR HY000: Tablespace has been discarded for table 't1'
|
|||||||
restore: t1 .ibd and .cfg files
|
restore: t1 .ibd and .cfg files
|
||||||
SET SESSION debug_dbug="+d,fil_space_create_failure";
|
SET SESSION debug_dbug="+d,fil_space_create_failure";
|
||||||
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
||||||
ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd
|
ERROR HY000: Got error 11 't1.ibd
|
||||||
SET SESSION debug_dbug="-d,fil_space_create_failure";
|
SET SESSION debug_dbug="-d,fil_space_create_failure";
|
||||||
DROP TABLE test_wl5522.t1;
|
DROP TABLE test_wl5522.t1;
|
||||||
unlink: t1.ibd
|
unlink: t1.ibd
|
||||||
@ -550,7 +550,7 @@ ERROR HY000: Tablespace has been discarded for table 't1'
|
|||||||
restore: t1 .ibd and .cfg files
|
restore: t1 .ibd and .cfg files
|
||||||
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
|
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
|
||||||
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
||||||
ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd
|
ERROR HY000: Got error 39 't1.ibd
|
||||||
SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure";
|
SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure";
|
||||||
DROP TABLE test_wl5522.t1;
|
DROP TABLE test_wl5522.t1;
|
||||||
unlink: t1.ibd
|
unlink: t1.ibd
|
||||||
|
@ -2,32 +2,48 @@ DROP TABLE if exists t1;
|
|||||||
DROP TABLE if exists t2;
|
DROP TABLE if exists t2;
|
||||||
Testing tables with large records
|
Testing tables with large records
|
||||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB;
|
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB;
|
||||||
|
INSERT INTO t1 VALUES (1, REPEAT('A', 256));
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
optimize table t1;
|
optimize table t1;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t1 optimize status OK
|
test.t1 optimize status OK
|
||||||
|
select sleep(1);
|
||||||
|
sleep(1)
|
||||||
|
0
|
||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
count(*)
|
count(*)
|
||||||
790
|
927
|
||||||
select count(*) from t1 force index (second);
|
select count(*) from t1 force index (second);
|
||||||
count(*)
|
count(*)
|
||||||
790
|
927
|
||||||
# A few more insertions on the page should not cause a page split.
|
# A few more insertions on the page should not cause a page split.
|
||||||
insert into t1 values (81, REPEAT('A', 256));
|
insert into t1 values (81, REPEAT('A', 256));
|
||||||
insert into t1 values (83, REPEAT('A', 256));
|
insert into t1 values (83, REPEAT('A', 256));
|
||||||
# More insertions will cause page splits
|
|
||||||
insert into t1 values (88, REPEAT('A', 50));
|
|
||||||
insert into t1 values (85, REPEAT('A', 256));
|
|
||||||
insert into t1 values (84, REPEAT('A', 256));
|
|
||||||
insert into t1 values (87, REPEAT('A', 256));
|
insert into t1 values (87, REPEAT('A', 256));
|
||||||
insert into t1 values (89, REPEAT('A', 256));
|
|
||||||
insert into t1 values (82, REPEAT('A', 256));
|
insert into t1 values (82, REPEAT('A', 256));
|
||||||
insert into t1 values (86, REPEAT('A', 256));
|
insert into t1 values (86, REPEAT('A', 256));
|
||||||
|
# More insertions will cause page splits
|
||||||
|
insert into t1 values (88, REPEAT('A', 256));
|
||||||
|
insert into t1 values (85, REPEAT('A', 256));
|
||||||
|
insert into t1 values (84, REPEAT('A', 256));
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
Testing table with small records
|
Testing table with small records
|
||||||
CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARchar(16), KEY SECOND(a,b)) ENGINE=INNODB;
|
CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARchar(16), KEY SECOND(a,b)) ENGINE=INNODB;
|
||||||
optimize table t2;
|
optimize table t2;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
test.t2 optimize status OK
|
test.t2 optimize status OK
|
||||||
|
select sleep(1);
|
||||||
|
sleep(1)
|
||||||
|
0
|
||||||
select count(*) from t2 force index(second);
|
select count(*) from t2 force index(second);
|
||||||
count(*)
|
count(*)
|
||||||
3701
|
3701
|
||||||
@ -49,16 +65,12 @@ insert into t2 values(1197, REPEAT('A', 16));
|
|||||||
insert into t2 values(1188, REPEAT('A', 16));
|
insert into t2 values(1188, REPEAT('A', 16));
|
||||||
insert into t2 values(1198, REPEAT('A', 16));
|
insert into t2 values(1198, REPEAT('A', 16));
|
||||||
insert into t2 values(1189, REPEAT('A', 16));
|
insert into t2 values(1189, REPEAT('A', 16));
|
||||||
|
insert into t2 values(1199, REPEAT('A', 16));
|
||||||
|
insert into t2 values(1190, REPEAT('A', 16));
|
||||||
|
insert into t2 values(1180, REPEAT('A', 16));
|
||||||
More insertions will cause page split.
|
More insertions will cause page split.
|
||||||
insert into t2 values(1280, REPEAT('A', 16));
|
insert into t2 values(1280, REPEAT('A', 16));
|
||||||
insert into t2 values(1290, REPEAT('A', 16));
|
insert into t2 values(1290, REPEAT('A', 16));
|
||||||
insert into t2 values(1281, REPEAT('A', 16));
|
insert into t2 values(1281, REPEAT('A', 16));
|
||||||
insert into t2 values(1291, REPEAT('A', 16));
|
insert into t2 values(1291, REPEAT('A', 16));
|
||||||
insert into t2 values(1199, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1190, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1180, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1295, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1294, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1292, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1293, REPEAT('A', 16));
|
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
|
@ -1,53 +1,53 @@
|
|||||||
CREATE TABLE T1(A INTEGER) ENGINE=INNODB;
|
create table t1(a integer) engine=innodb;
|
||||||
ERROR 42000: This table type requires a primary key
|
ERROR 42000: This table type requires a primary key
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1173 This table type requires a primary key
|
Error 1173 This table type requires a primary key
|
||||||
CREATE TABLE T1(A INTEGER UNIQUE KEY) ENGINE=INNODB;
|
create table t1(a integer unique key) engine=innodb;
|
||||||
ERROR 42000: This table type requires a primary key
|
ERROR 42000: This table type requires a primary key
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1173 This table type requires a primary key
|
Error 1173 This table type requires a primary key
|
||||||
CREATE TABLE T1(A INTEGER NOT NULL, B INTEGER,
|
create table t1(a integer not null, b integer,
|
||||||
UNIQUE KEY(A,B)) ENGINE=INNODB;
|
unique key(a,b)) engine=innodb;
|
||||||
ERROR 42000: This table type requires a primary key
|
ERROR 42000: This table type requires a primary key
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1173 This table type requires a primary key
|
Error 1173 This table type requires a primary key
|
||||||
CREATE TABLE T1(A INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
|
create table t1(a integer not null primary key) engine=innodb;
|
||||||
SHOW CREATE TABLE T1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
T1 CREATE TABLE `T1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`A` int(11) NOT NULL,
|
`a` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`A`)
|
PRIMARY KEY (`a`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
DROP TABLE T1;
|
drop table t1;
|
||||||
CREATE TABLE T1(A INTEGER NOT NULL UNIQUE KEY) ENGINE=INNODB;
|
create table t1(a integer not null unique key) engine=innodb;
|
||||||
SHOW CREATE TABLE T1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
T1 CREATE TABLE `T1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`A` int(11) NOT NULL,
|
`a` int(11) NOT NULL,
|
||||||
UNIQUE KEY `A` (`A`)
|
UNIQUE KEY `a` (`a`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
DROP TABLE T1;
|
drop table t1;
|
||||||
set global innodb_force_primary_key = 0;
|
set global innodb_force_primary_key = 0;
|
||||||
CREATE TABLE T1(A INTEGER) ENGINE=INNODB;
|
create table t1(a integer) engine=innodb;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
INSERT INTO T1 VALUES (1),(2),(3);
|
insert into t1 values (1),(2),(3);
|
||||||
set global innodb_force_primary_key = 1;
|
set global innodb_force_primary_key = 1;
|
||||||
SELECT * FROM T1;
|
select * from t1;
|
||||||
A
|
a
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
CREATE TABLE T2(A INTEGER) ENGINE=INNODB;
|
create table t2(a integer) engine=innodb;
|
||||||
ERROR 42000: This table type requires a primary key
|
ERROR 42000: This table type requires a primary key
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1173 This table type requires a primary key
|
Error 1173 This table type requires a primary key
|
||||||
DROP TABLE T1;
|
drop table t1;
|
||||||
|
@ -22,7 +22,7 @@ let MYSQLD_DATADIR =`SELECT @@datadir`;
|
|||||||
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
|
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
|
||||||
let $innodb_file_format = `SELECT @@innodb_file_format`;
|
let $innodb_file_format = `SELECT @@innodb_file_format`;
|
||||||
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
|
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
|
||||||
let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/;
|
let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522_t1.ibd'/;
|
||||||
|
|
||||||
SET GLOBAL innodb_file_per_table = 1;
|
SET GLOBAL innodb_file_per_table = 1;
|
||||||
SELECT @@innodb_file_per_table;
|
SELECT @@innodb_file_per_table;
|
||||||
@ -233,8 +233,7 @@ SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure";
|
|||||||
# Test failure after attempting a tablespace open
|
# Test failure after attempting a tablespace open
|
||||||
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
|
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure";
|
||||||
|
|
||||||
--replace_regex /file: '.*t1.ibd'/'t1.ibd'/
|
--replace_regex /'.*[\/\\]/'/
|
||||||
|
|
||||||
--error ER_GET_ERRMSG
|
--error ER_GET_ERRMSG
|
||||||
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
||||||
|
|
||||||
@ -637,8 +636,7 @@ EOF
|
|||||||
|
|
||||||
SET SESSION debug_dbug="+d,fil_space_create_failure";
|
SET SESSION debug_dbug="+d,fil_space_create_failure";
|
||||||
|
|
||||||
--replace_regex $pathfix
|
--replace_regex /'.*[\/\\]/'/
|
||||||
|
|
||||||
--error ER_GET_ERRMSG
|
--error ER_GET_ERRMSG
|
||||||
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
||||||
|
|
||||||
@ -669,8 +667,7 @@ EOF
|
|||||||
|
|
||||||
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
|
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure";
|
||||||
|
|
||||||
--replace_regex $pathfix
|
--replace_regex /'.*[\/\\]/'/
|
||||||
|
|
||||||
--error ER_GET_ERRMSG
|
--error ER_GET_ERRMSG
|
||||||
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
|
||||||
|
|
||||||
|
@ -2,47 +2,62 @@
|
|||||||
--source include/big_test.inc
|
--source include/big_test.inc
|
||||||
--source include/not_valgrind.inc
|
--source include/not_valgrind.inc
|
||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
|
--source include/have_innodb_16k.inc
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
DROP TABLE if exists t1;
|
DROP TABLE if exists t1;
|
||||||
DROP TABLE if exists t2;
|
DROP TABLE if exists t2;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
--echo Testing tables with large records
|
--echo Testing tables with large records
|
||||||
# Create table.
|
# Create table.
|
||||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB;
|
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB;
|
||||||
|
|
||||||
# Populate table.
|
# Populate table.
|
||||||
let $i = 1000;
|
INSERT INTO t1 VALUES (1, REPEAT('A', 256));
|
||||||
--disable_query_log
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
while ($i)
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
{
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
eval
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
INSERT INTO t1 VALUES ($i, REPEAT('A', 256));
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
dec $i;
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
}
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
--enable_query_log
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
INSERT INTO t1 (b) SELECT b from t1;
|
||||||
|
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
let $size = 10;
|
let $size = 10;
|
||||||
while ($size)
|
while ($size)
|
||||||
{
|
{
|
||||||
let $j = 100 * $size;
|
let $j = 100 * $size;
|
||||||
eval delete from t1 where a between $j - 20 and $j;
|
eval delete from t1 where a between $j - 20 and $j + 5;
|
||||||
dec $size;
|
dec $size;
|
||||||
}
|
}
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
|
|
||||||
|
--source include/restart_mysqld.inc
|
||||||
optimize table t1;
|
optimize table t1;
|
||||||
|
select sleep(1);
|
||||||
|
|
||||||
--source include/restart_mysqld.inc
|
--source include/restart_mysqld.inc
|
||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
|
|
||||||
# After deletion & defragmentation, there are 800 records left. Each page can hold about 57 records. We fill the page 90% full,
|
# After deletion & defragmentation, there are 800 records left. Each page can hold about 57 records. We fill the page 90% full,
|
||||||
# so there should be less than 16 pages total.
|
# so there should be less than 16 pages total.
|
||||||
--let $primary_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1)
|
--let $primary_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1)
|
||||||
|
|
||||||
select count(*) from t1 force index (second);
|
select count(*) from t1 force index (second);
|
||||||
|
|
||||||
# secondary index is slightly bigger than primary index so the number of pages should be similar.
|
# secondary index is slightly bigger than primary index so the number of pages should be similar.
|
||||||
--let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1)
|
--let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1)
|
||||||
|
|
||||||
--echo # A few more insertions on the page should not cause a page split.
|
--echo # A few more insertions on the page should not cause a page split.
|
||||||
insert into t1 values (81, REPEAT('A', 256));
|
insert into t1 values (81, REPEAT('A', 256));
|
||||||
insert into t1 values (83, REPEAT('A', 256));
|
insert into t1 values (83, REPEAT('A', 256));
|
||||||
|
insert into t1 values (87, REPEAT('A', 256));
|
||||||
|
insert into t1 values (82, REPEAT('A', 256));
|
||||||
|
insert into t1 values (86, REPEAT('A', 256));
|
||||||
--let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1)
|
--let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1)
|
||||||
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1)
|
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1)
|
||||||
|
|
||||||
@ -55,14 +70,9 @@ if ($second_before != $second_after) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
--echo # More insertions will cause page splits
|
--echo # More insertions will cause page splits
|
||||||
insert into t1 values (88, REPEAT('A', 50));
|
insert into t1 values (88, REPEAT('A', 256));
|
||||||
insert into t1 values (85, REPEAT('A', 256));
|
insert into t1 values (85, REPEAT('A', 256));
|
||||||
insert into t1 values (84, REPEAT('A', 256));
|
insert into t1 values (84, REPEAT('A', 256));
|
||||||
insert into t1 values (87, REPEAT('A', 256));
|
|
||||||
insert into t1 values (89, REPEAT('A', 256));
|
|
||||||
insert into t1 values (82, REPEAT('A', 256));
|
|
||||||
insert into t1 values (86, REPEAT('A', 256));
|
|
||||||
|
|
||||||
--let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1)
|
--let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1)
|
||||||
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1)
|
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1)
|
||||||
|
|
||||||
@ -94,6 +104,7 @@ INSERT INTO t2 (b) SELECT b from t2;
|
|||||||
INSERT INTO t2 (b) SELECT b from t2;
|
INSERT INTO t2 (b) SELECT b from t2;
|
||||||
INSERT INTO t2 (b) SELECT b from t2;
|
INSERT INTO t2 (b) SELECT b from t2;
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
|
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
let $size = 40;
|
let $size = 40;
|
||||||
while ($size)
|
while ($size)
|
||||||
@ -103,10 +114,16 @@ while ($size)
|
|||||||
dec $size;
|
dec $size;
|
||||||
}
|
}
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
|
|
||||||
|
--source include/restart_mysqld.inc
|
||||||
optimize table t2;
|
optimize table t2;
|
||||||
|
select sleep(1);
|
||||||
|
|
||||||
--source include/restart_mysqld.inc
|
--source include/restart_mysqld.inc
|
||||||
select count(*) from t2 force index(second);
|
select count(*) from t2 force index(second);
|
||||||
|
|
||||||
--let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1)
|
--let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1)
|
||||||
|
|
||||||
--echo The page should have room for about 20 insertions
|
--echo The page should have room for about 20 insertions
|
||||||
insert into t2 values(1181, REPEAT('A', 16));
|
insert into t2 values(1181, REPEAT('A', 16));
|
||||||
insert into t2 values(1191, REPEAT('A', 16));
|
insert into t2 values(1191, REPEAT('A', 16));
|
||||||
@ -125,6 +142,9 @@ insert into t2 values(1197, REPEAT('A', 16));
|
|||||||
insert into t2 values(1188, REPEAT('A', 16));
|
insert into t2 values(1188, REPEAT('A', 16));
|
||||||
insert into t2 values(1198, REPEAT('A', 16));
|
insert into t2 values(1198, REPEAT('A', 16));
|
||||||
insert into t2 values(1189, REPEAT('A', 16));
|
insert into t2 values(1189, REPEAT('A', 16));
|
||||||
|
insert into t2 values(1199, REPEAT('A', 16));
|
||||||
|
insert into t2 values(1190, REPEAT('A', 16));
|
||||||
|
insert into t2 values(1180, REPEAT('A', 16));
|
||||||
|
|
||||||
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1)
|
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1)
|
||||||
|
|
||||||
@ -137,18 +157,10 @@ insert into t2 values(1280, REPEAT('A', 16));
|
|||||||
insert into t2 values(1290, REPEAT('A', 16));
|
insert into t2 values(1290, REPEAT('A', 16));
|
||||||
insert into t2 values(1281, REPEAT('A', 16));
|
insert into t2 values(1281, REPEAT('A', 16));
|
||||||
insert into t2 values(1291, REPEAT('A', 16));
|
insert into t2 values(1291, REPEAT('A', 16));
|
||||||
insert into t2 values(1199, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1190, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1180, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1295, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1294, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1292, REPEAT('A', 16));
|
|
||||||
insert into t2 values(1293, REPEAT('A', 16));
|
|
||||||
|
|
||||||
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1)
|
--let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1)
|
||||||
|
|
||||||
if ($second_before == $second_after) {
|
if ($second_before == $second_after) {
|
||||||
--echo Too much space are reserved on second index.
|
--echo Too much space are reserved on second index.
|
||||||
}
|
}
|
||||||
|
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
@ -3,35 +3,35 @@
|
|||||||
let $force_pk=`select @@innodb_force_primary_key`;
|
let $force_pk=`select @@innodb_force_primary_key`;
|
||||||
|
|
||||||
-- error 1173
|
-- error 1173
|
||||||
CREATE TABLE T1(A INTEGER) ENGINE=INNODB;
|
create table t1(a integer) engine=innodb;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
-- error 1173
|
-- error 1173
|
||||||
CREATE TABLE T1(A INTEGER UNIQUE KEY) ENGINE=INNODB;
|
create table t1(a integer unique key) engine=innodb;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
-- error 1173
|
-- error 1173
|
||||||
CREATE TABLE T1(A INTEGER NOT NULL, B INTEGER,
|
create table t1(a integer not null, b integer,
|
||||||
UNIQUE KEY(A,B)) ENGINE=INNODB;
|
unique key(a,b)) engine=innodb;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
CREATE TABLE T1(A INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
|
create table t1(a integer not null primary key) engine=innodb;
|
||||||
SHOW CREATE TABLE T1;
|
show create table t1;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
DROP TABLE T1;
|
drop table t1;
|
||||||
CREATE TABLE T1(A INTEGER NOT NULL UNIQUE KEY) ENGINE=INNODB;
|
create table t1(a integer not null unique key) engine=innodb;
|
||||||
SHOW CREATE TABLE T1;
|
show create table t1;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
DROP TABLE T1;
|
drop table t1;
|
||||||
|
|
||||||
set global innodb_force_primary_key = 0;
|
set global innodb_force_primary_key = 0;
|
||||||
CREATE TABLE T1(A INTEGER) ENGINE=INNODB;
|
create table t1(a integer) engine=innodb;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
INSERT INTO T1 VALUES (1),(2),(3);
|
insert into t1 values (1),(2),(3);
|
||||||
|
|
||||||
set global innodb_force_primary_key = 1;
|
set global innodb_force_primary_key = 1;
|
||||||
SELECT * FROM T1;
|
select * from t1;
|
||||||
-- error 1173
|
-- error 1173
|
||||||
CREATE TABLE T2(A INTEGER) ENGINE=INNODB;
|
create table t2(a integer) engine=innodb;
|
||||||
SHOW WARNINGS;
|
show warnings;
|
||||||
DROP TABLE T1;
|
drop table t1;
|
||||||
|
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
eval set global innodb_force_primary_key=$force_pk;
|
eval set global innodb_force_primary_key=$force_pk;
|
||||||
|
Reference in New Issue
Block a user