1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-24 19:42:23 +03:00
Files
mariadb/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result
Jan Lindström a4fa940bad MDEV-11336: Enable defragmentation on 10.2 when tests pass
Problem was that we could take page latches on different
order than wat is entitled with SX-lock. To follow the
latching order defined in WL#6326, acquire index->lock X-latch.
This entitles us to acquire page latches in any order for the index.

btr0btr.cc
	Document latch rules before and after MariaDB 10.2.2

sync0rw.cc
	Document latch compatibility rules better.

btr_defragment_merge_pages
	Fix parameter value.

btr_defragment_thread
	Acquire X-lock to dict_index_t::lock before restoring
	cursor position and continuing defragmentation.

ha_innobase::optimize
	Restore defragment feature.

Testing
	Add GIS-index and FT-index to table being defragmented.

	Defragmentation is not done to GIS-indexes and FT auxiliary
	tables.
2017-10-12 12:56:20 +03:00

92 lines
2.7 KiB
Plaintext

DROP TABLE if exists t1;
select @@global.innodb_stats_persistent;
@@global.innodb_stats_persistent
0
set global innodb_defragment_stats_accuracy = 80;
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
b VARCHAR(256),
c INT,
g GEOMETRY NOT NULL,
t VARCHAR(256),
KEY second(a, b),
KEY third(c),
SPATIAL gk(g),
FULLTEXT INDEX fti(t)) ENGINE=INNODB;
connect con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect con3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect con4,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connection default;
SET @@global.innodb_defragment_n_pages = 20;
select count(*) from t1;
count(*)
20000
select count(*) from t1 force index (second);
count(*)
20000
select count(*) from t1 force index (third);
count(*)
20000
select count(*) from t1;
count(*)
15800
select count(*) from t1 force index (second);
count(*)
15800
select count(*) from t1 force index (third);
count(*)
15800
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
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
connection con1;
optimize table t1;;
connection default;
INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000, Point(1,1),'More like a test but different.');;
connection con2;
INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000, Point(1,1),'Totally different text book.');;
connection con3;
DELETE FROM t1 where a between 1 and 100;;
connection con4;
UPDATE t1 SET c = c + 1 where c between 2000 and 8000;;
connection con1;
connection con2;
connection con3;
connection con4;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
select count(*) from t1;
count(*)
15723
select count(*) from t1 force index (second);
count(*)
15723
select count(*) from t1 force index (third);
count(*)
15723
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_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
drop table t1;