Commit d3ceb934 authored by Jan Lindström's avatar Jan Lindström

MDEV-6701: InnoDB tests fail in 10.1

Fixed test failures seen on defragment tests, innodb.innodb-wl5522-debug-zip
and innodb.innodb_bug12902967.
parent e44751b6
...@@ -11,19 +11,19 @@ drop table t1; ...@@ -11,19 +11,19 @@ drop table t1;
show binlog events in 'master-bin.000001' from 313; show binlog events in 'master-bin.000001' from 313;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 313 Gtid 1 351 GTID 0-1-1 master-bin.000001 313 Gtid 1 351 GTID 0-1-1
master-bin.000001 351 Query 1 465 use `test`; DROP TABLE IF EXISTS `t1` master-bin.000001 351 Query 1 465 use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
master-bin.000001 465 Gtid 1 503 GTID 0-1-2 master-bin.000001 465 Gtid 1 503 GTID 0-1-2
master-bin.000001 503 Query 1 669 use `test`; create table t1(a int not null primary key auto_increment, b varchar(256), key second(b)) engine=innodb master-bin.000001 503 Query 1 669 use `test`; create table t1(a int not null primary key auto_increment, b varchar(256), key second(b)) engine=innodb
master-bin.000001 669 Gtid 1 707 BEGIN GTID 0-1-3 master-bin.000001 669 Gtid 1 707 BEGIN GTID 0-1-3
master-bin.000001 707 Table_map 1 751 table_id: 82 (test.t1) master-bin.000001 707 Table_map 1 751 table_id: # (test.t1)
master-bin.000001 751 Write_rows_v1 1 1043 table_id: 82 flags: STMT_END_F master-bin.000001 751 Write_rows_v1 1 1043 table_id: # flags: STMT_END_F
master-bin.000001 1043 Xid 1 1070 COMMIT master-bin.000001 1043 Xid 1 1070 COMMIT /* XID */
master-bin.000001 1070 Gtid 1 1108 BEGIN GTID 0-1-4 master-bin.000001 1070 Gtid 1 1108 BEGIN GTID 0-1-4
master-bin.000001 1108 Table_map 1 1152 table_id: 82 (test.t1) master-bin.000001 1108 Table_map 1 1152 table_id: # (test.t1)
master-bin.000001 1152 Write_rows_v1 1 1444 table_id: 82 flags: STMT_END_F master-bin.000001 1152 Write_rows_v1 1 1444 table_id: # flags: STMT_END_F
master-bin.000001 1444 Xid 1 1471 COMMIT master-bin.000001 1444 Xid 1 1471 COMMIT /* XID */
master-bin.000001 1471 Gtid 1 1509 GTID 0-1-5 master-bin.000001 1471 Gtid 1 1509 GTID 0-1-5
master-bin.000001 1509 Query 1 1589 use `test`; optimize table t1 master-bin.000001 1509 Query 1 1589 use `test`; optimize table t1
master-bin.000001 1589 Gtid 1 1627 GTID 0-1-6 master-bin.000001 1589 Gtid 1 1627 GTID 0-1-6
master-bin.000001 1627 Query 1 1731 use `test`; DROP TABLE `t1` master-bin.000001 1627 Query 1 1731 use `test`; DROP TABLE `t1` /* generated by server */
include/rpl_end.inc include/rpl_end.inc
...@@ -18,14 +18,26 @@ INSERT INTO t1 (b) SELECT b from t1; ...@@ -18,14 +18,26 @@ 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;
# Not enough page splits to trigger persistent stats write yet. # Not enough page splits to trigger persistent stats write yet.
select count(*) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(*) count(stat_value) = 0
0 1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) = 0
1
INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1;
# Persistent stats recorded. # Persistent stats recorded.
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) > 0 count(stat_value) > 0
0 1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0
1
# Delete some rows. # Delete some rows.
delete from t1 where a between 100 * 20 and 100 * 20 + 30; delete from t1 where a between 100 * 20 and 100 * 20 + 30;
delete from t1 where a between 100 * 19 and 100 * 19 + 30; delete from t1 where a between 100 * 19 and 100 * 19 + 30;
...@@ -49,46 +61,115 @@ delete from t1 where a between 100 * 2 and 100 * 2 + 30; ...@@ -49,46 +61,115 @@ delete from t1 where a between 100 * 2 and 100 * 2 + 30;
delete from t1 where a between 100 * 1 and 100 * 1 + 30; delete from t1 where a between 100 * 1 and 100 * 1 + 30;
# Server Restarted # Server Restarted
# Confirm persistent stats still there after restart. # Confirm persistent stats still there after restart.
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) > 0 count(stat_value) > 0
0 1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0
1
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
# n_page_split should be 0 after defragmentation, n_pages_freed should be non-zero. select sleep(2);
select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; sleep(2)
stat_value = 0 0
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) > 0
1 1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) > 0
1 1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed', 'n_leaf_pages_defrag'); select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0 count(stat_value) > 0
1 1
set global innodb_defragment_stats_accuracy = 40; set global innodb_defragment_stats_accuracy = 40;
INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1;
# Not enough operation to trigger persistent stats write select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; count(stat_value) > 0
stat_value = 0
1 1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0
1 1
INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1;
# Persistent stats write triggered select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select stat_value > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; count(stat_value) > 0
stat_value > 0 1
0 select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
0 count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0
1
# Table rename should cause stats rename. # Table rename should cause stats rename.
rename table t1 to t2; rename table t1 to t2;
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select sleep(1);
sleep(1)
0
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) = 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0 count(stat_value) > 0
1 1
# Drop index should cause stats drop. # Drop index should cause stats drop.
drop index SECOND on t2; drop index SECOND on t2;
select count(*) from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND'; select sleep(3);
count(*) sleep(3)
4 0
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_page_split');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_pages_freed');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0
1
Server Restarted Server Restarted
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) = 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0 count(stat_value) > 0
1 1
# Clean up # Clean up
DROP TABLE t2; DROP TABLE t2;
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) = 0
1
...@@ -17,65 +17,109 @@ set @i = 0; ...@@ -17,65 +17,109 @@ set @i = 0;
repeat repeat
set @i = @i + 1; set @i = @i + 1;
optimize table t1; optimize table t1;
select sleep(5);
until @i = 3 end repeat; until @i = 3 end repeat;
end // end //
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) = 0 count(stat_value)
1 0
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) > 0 count(stat_value)
1 2
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0 count(stat_value)
1 2
select count(*) from t1; select count(*) from t1;
count(*) count(*)
10004 10004
select count(*) from t1 force index (second);
count(*)
10004
call defragment(); call defragment();
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(5);
sleep(5)
0
select count(*) from t1; select count(*) from t1;
count(*) count(*)
7904 7904
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) > 0 count(stat_value) = 0
0 0
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) > 0
1
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 0
1
select count(*) from t1 force index (second); select count(*) from t1 force index (second);
count(*) count(*)
7904 7904
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) = 0
1
SET @@global.innodb_defragment_n_pages = 3; SET @@global.innodb_defragment_n_pages = 3;
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 count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) > 0 count(stat_value) < 3
0 1
select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) < 3
1
select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) < 3
1
select count(*) from t1; select count(*) from t1;
count(*) count(*)
6904 6904
select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) < 3
1
select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(stat_value) < 3
1
select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) < 3
1
select count(*) from t1 force index (second); select count(*) from t1 force index (second);
count(*) count(*)
6904 6904
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) = 0
1
SET @@global.innodb_defragment_n_pages = 10; SET @@global.innodb_defragment_n_pages = 10;
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 count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
count(stat_value) > 0 count(stat_value) > 1
0 1
select count(*) from t1; select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
count(*) count(stat_value) > 1
6904 1
select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) > 1
1
select count(*) from t1 force index (second); select count(*) from t1 force index (second);
count(*) count(*)
6904 6904
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split');
count(stat_value) = 0
1
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag');
count(stat_value) = 0
1
DROP PROCEDURE defragment; DROP PROCEDURE defragment;
DROP TABLE t1; DROP TABLE t1;
...@@ -14,13 +14,14 @@ count(*) ...@@ -14,13 +14,14 @@ count(*)
# 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', 50));
Too much space are reserved on primary index.
Too much space are reserved on second index.
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;
...@@ -48,12 +49,16 @@ insert into t2 values(1197, REPEAT('A', 16)); ...@@ -48,12 +49,16 @@ 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;
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/master-slave.inc --source include/master-slave.inc
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
...@@ -13,7 +16,7 @@ optimize table t1; ...@@ -13,7 +16,7 @@ optimize table t1;
drop table t1; drop table t1;
--replace_regex /\/\*.*// --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
show binlog events in 'master-bin.000001' from 313; show binlog events in 'master-bin.000001' from 313;
--source include/rpl_end.inc --source include/rpl_end.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
--disable_warnings --disable_warnings
DROP TABLE if exists t1; DROP TABLE if exists t1;
......
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/big_test.inc --source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
--disable_warnings --disable_warnings
DROP TABLE if exists t1; DROP TABLE if exists t1;
...@@ -29,12 +31,16 @@ INSERT INTO t1 (b) SELECT b from t1; ...@@ -29,12 +31,16 @@ INSERT INTO t1 (b) SELECT b from t1;
INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1;
--echo # Not enough page splits to trigger persistent stats write yet. --echo # Not enough page splits to trigger persistent stats write yet.
select count(*) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1;
--echo # Persistent stats recorded. --echo # Persistent stats recorded.
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
--echo # Delete some rows. --echo # Delete some rows.
let $num_delete = 20; let $num_delete = 20;
...@@ -49,39 +55,71 @@ while ($num_delete) ...@@ -49,39 +55,71 @@ while ($num_delete)
--echo # Server Restarted --echo # Server Restarted
--echo # Confirm persistent stats still there after restart. --echo # Confirm persistent stats still there after restart.
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
optimize table t1; optimize table t1;
--echo # n_page_split should be 0 after defragmentation, n_pages_freed should be non-zero. select sleep(2);
select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split';
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed', 'n_leaf_pages_defrag'); select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
set global innodb_defragment_stats_accuracy = 40; set global innodb_defragment_stats_accuracy = 40;
INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1;
--echo # Not enough operation to trigger persistent stats write
select stat_value = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
INSERT INTO t1 (b) SELECT b from t1; INSERT INTO t1 (b) SELECT b from t1;
--echo # Persistent stats write triggered
select stat_value > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name = 'n_page_split'; select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
--echo # Table rename should cause stats rename. --echo # Table rename should cause stats rename.
rename table t1 to t2; rename table t1 to t2;
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select sleep(1);
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
--echo # Drop index should cause stats drop. --echo # Drop index should cause stats drop.
drop index SECOND on t2; drop index SECOND on t2;
select count(*) from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND'; select sleep(3);
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_page_split');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and index_name = 'SECOND' and stat_name in ('n_leaf_pages_defrag');
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--echo Server Restarted --echo Server Restarted
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
--echo # Clean up --echo # Clean up
DROP TABLE t2; DROP TABLE t2;
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
--disable_query_log --disable_query_log
EVAL SET GLOBAL innodb_defragment_stats_accuracy = $innodb_defragment_stats_accuracy_orig; EVAL SET GLOBAL innodb_defragment_stats_accuracy = $innodb_defragment_stats_accuracy_orig;
--enable_query_log --enable_query_log
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/big_test.inc --source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
--disable_warnings --disable_warnings
DROP TABLE if exists t1; DROP TABLE if exists t1;
......
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
--disable_warnings --disable_warnings
DROP TABLE if exists t1; DROP TABLE if exists t1;
...@@ -36,7 +39,6 @@ begin ...@@ -36,7 +39,6 @@ begin
repeat repeat
set @i = @i + 1; set @i = @i + 1;
optimize table t1; optimize table t1;
select sleep(5);
until @i = 3 end repeat; until @i = 3 end repeat;
end // end //
delimiter ;// delimiter ;//
...@@ -53,25 +55,12 @@ while ($i) ...@@ -53,25 +55,12 @@ while ($i)
} }
--enable_query_log --enable_query_log
select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed'); select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split'); select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag'); select count(stat_value) from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
select count(*) from t1; select count(*) from t1;
if (!`select count(*) > 180 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`)
{
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;
}
select count(*) from t1 force index (second);
if (!`select count(*) > 170 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`)
{
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;
}
connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection con1; connection con1;
...@@ -98,26 +87,19 @@ connection default; ...@@ -98,26 +87,19 @@ connection default;
disconnect con1; disconnect con1;
optimize table t1; optimize table t1;
select sleep(5);
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
select count(*) from t1; select count(*) from t1;
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
# After deletion & defragmentation, there are 8000 records left select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
if (!`select count(*) < 180 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`)
{
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;
}
select count(*) from t1 force index (second); select count(*) from t1 force index (second);
# secondary index is pretty much the same size as primary index so the number of pages should be similar. select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed');
if (!`select count(*) < 180 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`) select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split');
{ select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag');
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;
}
## Test-4 defragment with larger n_pages ## Test-4 defragment with larger n_pages
...@@ -139,23 +121,25 @@ optimize table t1; ...@@ -139,23 +121,25 @@ optimize table t1;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
select count(*) from t1; select count(*) from t1;
# We didn't create large wholes with the previous deletion, so if innodb_defragment_n_pages = 3, we won't be able to free up many pages. # We didn't create large wholes with the previous deletion, so if innodb_defragment_n_pages = 3, we won't be able to free up many pages.
if (!`select count(*) > 130 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`)
{ select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number; select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
} select count(stat_value) < 3 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
select count(*) from t1 force index (second); select count(*) from t1 force index (second);
# Same holds for secondary index, not many pages are released. # Same holds for secondary index, not many pages are released.
if (!`select count(*) > 100 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`) select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed');
{ select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split');
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number; select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag');
}
SET @@global.innodb_defragment_n_pages = 10; SET @@global.innodb_defragment_n_pages = 10;
...@@ -163,25 +147,21 @@ optimize table t1; ...@@ -163,25 +147,21 @@ optimize table t1;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed', 'n_page_split', 'n_leaf_pages_defrag'); select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
select count(stat_value) > 1 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
select count(*) from t1;
# This time we used innodb_defragment_n_pages = 10, so we should be able to free up some pages.
if (!`select count(*) < 165 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;`)
{
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY' order by page_number;
}
select count(*) from t1 force index (second); select count(*) from t1 force index (second);
if (!`select count(*) < 165 from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number;`) # Same holds for secondary index, not many pages are released.
{ select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_pages_freed');
select count(*) from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second' order by page_number; select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_page_split');
} select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and index_name = 'second' and stat_name in ('n_leaf_pages_defrag');
DROP PROCEDURE defragment; DROP PROCEDURE defragment;
DROP TABLE t1; DROP TABLE t1;
# reset system # reset system
--disable_query_log --disable_query_log
EVAL SET GLOBAL innodb_defragment_n_pages = $innodb_defragment_n_pages_orig; EVAL SET GLOBAL innodb_defragment_n_pages = $innodb_defragment_n_pages_orig;
......
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/not_embedded.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;
...@@ -34,34 +38,44 @@ select count(*) from t1; ...@@ -34,34 +38,44 @@ select count(*) from t1;
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)
if ($primary_before != $primary_after) { if ($primary_before != $primary_after) {
--echo Insertion caused page split on primary, which should be avoided by innodb_defragment_fill_factor. --echo Insertion caused page split on primary, which should be avoided by innodb_defragment_fill_factor.
} }
if ($second_before != $second_after) { if ($second_before != $second_after) {
--echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor. --echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor.
} }
--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', 50));
#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 (89, 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)
if ($primary_before == $primary_after) { if ($primary_before == $primary_after) {
--echo Too much space are reserved on primary index. --echo Too much space are reserved on primary index.
} }
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 t1; DROP TABLE t1;
--echo Testing table with small records --echo 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;
# Populate table. # Populate table.
...@@ -111,20 +125,30 @@ insert into t2 values(1197, REPEAT('A', 16)); ...@@ -111,20 +125,30 @@ 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)
if ($second_before != $second_after) { if ($second_before != $second_after) {
--echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor. --echo Insertion caused page split on second, which should be avoided by innodb_defragment_fill_factor.
} }
--echo More insertions will cause page split. --echo 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));
--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;
...@@ -3727,7 +3727,13 @@ fil_open_single_table_tablespace( ...@@ -3727,7 +3727,13 @@ fil_open_single_table_tablespace(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_ad(!fix_dict || mutex_own(&(dict_sys->mutex))); ut_ad(!fix_dict || mutex_own(&(dict_sys->mutex)));
if (!fsp_flags_is_valid(flags)) { /* Table flags can be ULINT_UNDEFINED if
dict_tf_to_fsp_flags_failure is set. */
if (flags != ULINT_UNDEFINED) {
if (!fsp_flags_is_valid(flags)) {
return(DB_CORRUPTION);
}
} else {
return(DB_CORRUPTION); return(DB_CORRUPTION);
} }
......
...@@ -3003,10 +3003,6 @@ innobase_shutdown_for_mysql(void) ...@@ -3003,10 +3003,6 @@ innobase_shutdown_for_mysql(void)
buf_mtflu_io_thread_exit(); buf_mtflu_io_thread_exit();
} }
#ifdef UNIV_DEBUG
fprintf(stderr, "InnoDB: Note: %s:%d os_thread_count:%lu \n", __FUNCTION__, __LINE__, os_thread_count);
#endif
os_mutex_enter(os_sync_mutex); os_mutex_enter(os_sync_mutex);
if (os_thread_count == 0) { if (os_thread_count == 0) {
......
...@@ -3752,7 +3752,13 @@ fil_open_single_table_tablespace( ...@@ -3752,7 +3752,13 @@ fil_open_single_table_tablespace(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_ad(!fix_dict || mutex_own(&(dict_sys->mutex))); ut_ad(!fix_dict || mutex_own(&(dict_sys->mutex)));
if (!fsp_flags_is_valid(flags)) { /* Table flags can be ULINT_UNDEFINED if
dict_tf_to_fsp_flags_failure is set. */
if (flags != ULINT_UNDEFINED) {
if (!fsp_flags_is_valid(flags)) {
return(DB_CORRUPTION);
}
} else {
return(DB_CORRUPTION); return(DB_CORRUPTION);
} }
......
...@@ -3085,12 +3085,8 @@ innobase_shutdown_for_mysql(void) ...@@ -3085,12 +3085,8 @@ innobase_shutdown_for_mysql(void)
buf_mtflu_io_thread_exit(); buf_mtflu_io_thread_exit();
} }
#ifdef UNIV_DEBUG
fprintf(stderr, "InnoDB: Note: %s:%d os_thread_count:%lu \n", __FUNCTION__, __LINE__, os_thread_count);
#endif
os_mutex_enter(os_sync_mutex); os_mutex_enter(os_sync_mutex);
if (os_thread_count == 0) { if (os_thread_count == 0) {
/* All the threads have exited or are just exiting; /* All the threads have exited or are just exiting;
NOTE that the threads may not have completed their NOTE that the threads may not have completed their
......
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