mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-11802 preparation: Clean up the purge tests.
Revert the MDEV-4396 tweak to innodb.innodb_bug14676111. We must fix the root cause instead. Allow gcol.innodb_virtual_purge to run on a non-debug build (If wait_innodb_all_purged.inc is used in a non-debug test, it will have no effect.) Add the test innodb.index_merge_threshold from MySQL 5.7.
This commit is contained in:
@ -9,8 +9,8 @@
|
||||
# --source include/wait_innodb_all_purged.inc
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
if (`select version() like '%debug%'`) {
|
||||
--disable_query_log
|
||||
|
||||
let $wait_counter_init= 300;
|
||||
@ -57,3 +57,4 @@ if (!$success)
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ COMMIT;
|
||||
UPDATE t1 SET a=1;
|
||||
|
||||
connection default;
|
||||
# wait for purge to process the update_undo record.
|
||||
# wait for purge to process the update_undo record (in debug builds)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
CHECK TABLE t1;
|
||||
@ -118,7 +118,7 @@ COMMIT;
|
||||
disconnect con1;
|
||||
|
||||
connection default;
|
||||
# wait for purge to process the update_undo record.
|
||||
# wait for purge to process the update_undo record (in debug builds)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
CHECK TABLE t1;
|
||||
|
@ -0,0 +1,119 @@
|
||||
#
|
||||
# Test to cause merge of the pages (by deleting)
|
||||
# test/tab1 should be created already with innodb_file_per_table=ON
|
||||
# The definition is intended to be based on
|
||||
# "create table tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;"
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_innodb_16k.inc
|
||||
|
||||
# turn on flags
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_monitor_enable=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_reset=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_enable=index_page_merge_successful;
|
||||
SET GLOBAL innodb_monitor_reset=index_page_merge_successful;
|
||||
--enable_query_log
|
||||
|
||||
--echo # check MERGE_THRESHOLD
|
||||
--replace_result tab1#P tab1#p
|
||||
select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD
|
||||
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/tab1%';
|
||||
|
||||
insert into tab1 values (1, repeat('a',2048));
|
||||
insert into tab1 values (2, repeat('a',2048));
|
||||
insert into tab1 values (3, repeat('a',2048));
|
||||
insert into tab1 values (8, repeat('a',2048));
|
||||
insert into tab1 values (9, repeat('a',2048));
|
||||
insert into tab1 values (10, repeat('a',2048));
|
||||
insert into tab1 values (11, repeat('a',2048));
|
||||
insert into tab1 values (12, repeat('a',2048));
|
||||
insert into tab1 values (4, repeat('a',2048));
|
||||
insert into tab1 values (5, repeat('a',2048));
|
||||
insert into tab1 values (6, repeat('a',2048));
|
||||
insert into tab1 values (7, repeat('a',2048));
|
||||
insert into tab1 values (13, repeat('a',2048));
|
||||
insert into tab1 values (14, repeat('a',2048));
|
||||
|
||||
# filled 2 leaf pages have been prepared
|
||||
# | 1,..,7 | 8,..,14 |
|
||||
|
||||
select PAGE_NUMBER, NUMBER_RECORDS
|
||||
from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1,
|
||||
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
|
||||
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
|
||||
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 12;
|
||||
delete from tab1 where a = 13;
|
||||
delete from tab1 where a = 14;
|
||||
delete from tab1 where a = 5;
|
||||
delete from tab1 where a = 6;
|
||||
delete from tab1 where a = 7;
|
||||
set global innodb_purge_run_now=ON;
|
||||
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
# not merged yet
|
||||
# | 1,2,3,4 | 8,9,10,11 |
|
||||
|
||||
--echo # check page merge happens (nothing is expected)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
select PAGE_NUMBER, NUMBER_RECORDS
|
||||
from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1,
|
||||
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
|
||||
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
|
||||
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
|
||||
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 11;
|
||||
set global innodb_purge_run_now=ON;
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 10;
|
||||
set global innodb_purge_run_now=ON;
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=35 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 9;
|
||||
set global innodb_purge_run_now=ON;
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=25 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
--disable_query_log
|
||||
# Reset flags
|
||||
SET GLOBAL innodb_monitor_disable=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_disable=index_page_merge_successful;
|
||||
|
||||
--disable_warnings
|
||||
set global innodb_monitor_enable = default;
|
||||
set global innodb_monitor_disable = default;
|
||||
set global innodb_monitor_reset = default;
|
||||
set global innodb_monitor_reset_all = default;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
@ -0,0 +1,165 @@
|
||||
#
|
||||
# Test to cause merge of the pages (at secondary index by deleting)
|
||||
# test/tab1 should be created already with innodb_file_per_table=ON
|
||||
# The definition is intended to be based on
|
||||
# "create table tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic;"
|
||||
# "create index index1 on tab1(b(750));"
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_innodb_16k.inc
|
||||
|
||||
# turn on flags
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_monitor_enable=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_reset=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_enable=index_page_merge_successful;
|
||||
SET GLOBAL innodb_monitor_reset=index_page_merge_successful;
|
||||
--enable_query_log
|
||||
|
||||
--echo # check MERGE_THRESHOLD
|
||||
select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD
|
||||
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/tab1%';
|
||||
|
||||
INSERT INTO tab1 VALUES (1, concat("01", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (2, concat("02", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (3, concat("03", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (4, concat("04", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (5, concat("05", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (6, concat("06", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (7, concat("07", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (8, concat("08", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (9, concat("09", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (10, concat("10", repeat('a',8190)));
|
||||
|
||||
INSERT INTO tab1 VALUES (22, concat("22", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (23, concat("23", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (24, concat("24", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (25, concat("25", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (26, concat("26", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (27, concat("27", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (28, concat("28", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (29, concat("29", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (30, concat("30", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (31, concat("31", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (32, concat("32", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (33, concat("33", repeat('a',8190)));
|
||||
|
||||
INSERT INTO tab1 VALUES (11, concat("11", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (12, concat("12", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (13, concat("13", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (14, concat("14", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (15, concat("15", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (16, concat("16", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (17, concat("17", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (18, concat("18", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (19, concat("19", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (20, concat("20", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (21, concat("21", repeat('a',8190)));
|
||||
|
||||
INSERT INTO tab1 VALUES (34, concat("34", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (35, concat("35", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (36, concat("36", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (37, concat("37", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (38, concat("38", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (39, concat("39", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (40, concat("40", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (41, concat("41", repeat('a',8190)));
|
||||
INSERT INTO tab1 VALUES (42, concat("42", repeat('a',8190)));
|
||||
|
||||
# clustered index is still root page only with the 42 records.
|
||||
# secondary index is filled 2 leaf pages have been prepared
|
||||
# | 1,..,21 | 22,..,42 |
|
||||
|
||||
select PAGE_NUMBER, NUMBER_RECORDS
|
||||
from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1,
|
||||
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
|
||||
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
|
||||
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 33;
|
||||
delete from tab1 where a = 34;
|
||||
delete from tab1 where a = 35;
|
||||
delete from tab1 where a = 36;
|
||||
delete from tab1 where a = 37;
|
||||
delete from tab1 where a = 38;
|
||||
delete from tab1 where a = 39;
|
||||
delete from tab1 where a = 40;
|
||||
delete from tab1 where a = 41;
|
||||
delete from tab1 where a = 42;
|
||||
delete from tab1 where a = 12;
|
||||
delete from tab1 where a = 13;
|
||||
delete from tab1 where a = 14;
|
||||
delete from tab1 where a = 15;
|
||||
delete from tab1 where a = 16;
|
||||
delete from tab1 where a = 17;
|
||||
delete from tab1 where a = 18;
|
||||
delete from tab1 where a = 19;
|
||||
delete from tab1 where a = 20;
|
||||
delete from tab1 where a = 21;
|
||||
set global innodb_purge_run_now=ON;
|
||||
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
# secondary index is not merged yet
|
||||
# | 1,..,11 | 22,..,32 |
|
||||
|
||||
--echo # check page merge happens (nothing is expected)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
select PAGE_NUMBER, NUMBER_RECORDS
|
||||
from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1,
|
||||
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
|
||||
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
|
||||
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
|
||||
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 32;
|
||||
set global innodb_purge_run_now=ON;
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 31;
|
||||
set global innodb_purge_run_now=ON;
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=45 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
|
||||
set global innodb_purge_stop_now=ON;
|
||||
delete from tab1 where a = 30;
|
||||
set global innodb_purge_run_now=ON;
|
||||
# wait for purge view progress (records are deleted actually by purge)
|
||||
--source include/wait_innodb_all_purged.inc
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=40 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
--disable_query_log
|
||||
# Reset flags
|
||||
SET GLOBAL innodb_monitor_disable=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_disable=index_page_merge_successful;
|
||||
|
||||
--disable_warnings
|
||||
set global innodb_monitor_enable = default;
|
||||
set global innodb_monitor_disable = default;
|
||||
set global innodb_monitor_reset = default;
|
||||
set global innodb_monitor_reset_all = default;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
@ -0,0 +1,101 @@
|
||||
#
|
||||
# Test to cause merge of the pages (by updating to smaller)
|
||||
# test/tab1 should be created already with innodb_file_per_table=ON
|
||||
# The definition is intended to be based on
|
||||
# "create table tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;"
|
||||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_innodb_16k.inc
|
||||
|
||||
# turn on flags
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_monitor_enable=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_reset=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_enable=index_page_merge_successful;
|
||||
SET GLOBAL innodb_monitor_reset=index_page_merge_successful;
|
||||
--enable_query_log
|
||||
|
||||
--echo # check MERGE_THRESHOLD
|
||||
select t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD
|
||||
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/tab1%';
|
||||
|
||||
insert into tab1 values (1, repeat('a',2048));
|
||||
insert into tab1 values (2, repeat('a',2048));
|
||||
insert into tab1 values (3, repeat('a',2048));
|
||||
insert into tab1 values (8, repeat('a',2048));
|
||||
insert into tab1 values (9, repeat('a',2048));
|
||||
insert into tab1 values (10, repeat('a',2048));
|
||||
insert into tab1 values (11, repeat('a',2048));
|
||||
insert into tab1 values (12, repeat('a',2048));
|
||||
insert into tab1 values (4, repeat('a',2048));
|
||||
insert into tab1 values (5, repeat('a',2048));
|
||||
insert into tab1 values (6, repeat('a',2048));
|
||||
insert into tab1 values (7, repeat('a',2048));
|
||||
insert into tab1 values (13, repeat('a',2048));
|
||||
insert into tab1 values (14, repeat('a',2048));
|
||||
|
||||
# filled 2 leaf pages have been prepared
|
||||
# | 1,..,7 | 8,..,14 |
|
||||
|
||||
select PAGE_NUMBER, NUMBER_RECORDS
|
||||
from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1,
|
||||
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
|
||||
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
|
||||
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
|
||||
|
||||
update tab1 set b='' where a = 12;
|
||||
update tab1 set b='' where a = 13;
|
||||
update tab1 set b='' where a = 14;
|
||||
update tab1 set b='' where a = 5;
|
||||
update tab1 set b='' where a = 6;
|
||||
update tab1 set b='' where a = 7;
|
||||
|
||||
# not merged yet
|
||||
# | 1,2,3,4 | 8,9,10,11 |
|
||||
|
||||
--echo # check page merge happens (nothing is expected)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
select PAGE_NUMBER, NUMBER_RECORDS
|
||||
from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES s1,
|
||||
INFORMATION_SCHEMA.INNODB_BUFFER_PAGE s2
|
||||
where s1.SPACE = s2.SPACE AND NAME like 'test/tab1%'
|
||||
and PAGE_TYPE = "INDEX" order by PAGE_NUMBER, NUMBER_RECORDS;
|
||||
|
||||
|
||||
update tab1 set b='' where a = 11;
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=50 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
|
||||
update tab1 set b='' where a = 10;
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=35 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
|
||||
update tab1 set b='' where a = 9;
|
||||
|
||||
--echo # check page merge happens (MERGE_THRESHOLD=25 causes merge here)
|
||||
SELECT name,count_reset FROM information_schema.innodb_metrics
|
||||
WHERE name like 'index_page_merge_%';
|
||||
|
||||
--disable_query_log
|
||||
# Reset flags
|
||||
SET GLOBAL innodb_monitor_disable=index_page_merge_attempts;
|
||||
SET GLOBAL innodb_monitor_disable=index_page_merge_successful;
|
||||
|
||||
--disable_warnings
|
||||
set global innodb_monitor_enable = default;
|
||||
set global innodb_monitor_disable = default;
|
||||
set global innodb_monitor_reset = default;
|
||||
set global innodb_monitor_reset_all = default;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
1325
mysql-test/suite/innodb/r/index_merge_threshold.result
Normal file
1325
mysql-test/suite/innodb/r/index_merge_threshold.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,4 @@
|
||||
drop table if exists t1;
|
||||
call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*");
|
||||
set global innodb_stats_persistent = false;
|
||||
CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
|
||||
set global innodb_limit_optimistic_insert_debug = 2;
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (5);
|
||||
|
1
mysql-test/suite/innodb/t/index_merge_threshold.opt
Normal file
1
mysql-test/suite/innodb/t/index_merge_threshold.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-innodb_sys_tablespaces
|
189
mysql-test/suite/innodb/t/index_merge_threshold.test
Normal file
189
mysql-test/suite/innodb/t/index_merge_threshold.test
Normal file
@ -0,0 +1,189 @@
|
||||
# #############################################################
|
||||
# wl6747 : Set merge threshold at index level
|
||||
# Check with CREATE INDEX on all datatypes
|
||||
# Check with by ALTER TABLE MODIFY COLUMN TYPE
|
||||
# Check with ALTER TABLE ADD Index
|
||||
# Check by setting at index level with CREATE TABLE
|
||||
# Check with BLOB column at index level with CREATE Index
|
||||
# Check with row_format=compressed and key_block_size=8k
|
||||
# Check withe valid and invalid merge_threshold values.
|
||||
#
|
||||
# Check actual behavior for table, partitioned table and temporary table
|
||||
# #############################################################
|
||||
--source include/have_innodb_16k.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_partition.inc
|
||||
|
||||
# Check index merge threshold by create index on all datatypes
|
||||
|
||||
CREATE TABLE tab(a BIGINT PRIMARY KEY,c1 TINYTEXT,c2 TEXT,c3 MEDIUMTEXT,
|
||||
c4 TINYBLOB,c5 BLOB,c6 MEDIUMBLOB,c7 LONGBLOB) ENGINE=InnoDB;
|
||||
|
||||
# check index merge threshold on all datatypes
|
||||
CREATE INDEX index1 ON tab(c1(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=51';
|
||||
CREATE INDEX index2 ON tab(c2(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=-1';
|
||||
CREATE INDEX index3 ON tab(c3(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=20';
|
||||
CREATE INDEX index4 ON tab(c4(255)) COMMENT 'Check index level merge MERGE_THRESHOLD=25';
|
||||
CREATE INDEX index5 ON tab(c5(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=30';
|
||||
CREATE INDEX index6 ON tab(c6(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=35';
|
||||
CREATE INDEX index7 ON tab(c7(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=40';
|
||||
|
||||
SHOW CREATE TABLE tab;
|
||||
|
||||
SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab';
|
||||
|
||||
ALTER TABLE tab comment='MERGE_THRESHOLD=49';
|
||||
|
||||
SHOW CREATE TABLE tab;
|
||||
|
||||
SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab';
|
||||
|
||||
ALTER TABLE tab MODIFY COLUMN c7 VARCHAR(2048) ;
|
||||
|
||||
SHOW CREATE TABLE tab;
|
||||
|
||||
SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab';
|
||||
|
||||
ALTER TABLE tab ADD INDEX index8 (c7(750)) COMMENT 'Check index level merge MERGE_THRESHOLD=45';
|
||||
|
||||
SHOW CREATE TABLE tab;
|
||||
|
||||
SELECT t.NAME as TABLE_NAME, i.NAME as INDEX_NAME, i.MERGE_THRESHOLD
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES t, INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
WHERE t.TABLE_ID = i.TABLE_ID AND t.NAME = 'test/tab';
|
||||
# Cleanup
|
||||
DROP TABLE tab;
|
||||
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # behavior for deleting records
|
||||
--echo #
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=50 (default))
|
||||
CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_delete.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=35)
|
||||
CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB
|
||||
COMMENT='MERGE_THRESHOLD=35';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_delete.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=25)
|
||||
CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB
|
||||
COMMENT='MERGE_THRESHOLD=25';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_delete.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm partitioned table (MERGE_THRESHOLD=35)
|
||||
CREATE TABLE tab1 (a bigint primary key, b varchar(2048))
|
||||
COMMENT='MERGE_THRESHOLD=35'
|
||||
PARTITION BY RANGE (a)
|
||||
(PARTITION p0 VALUES LESS THAN (20) ENGINE = InnoDB,
|
||||
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB);
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_delete.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # behavior for updating to smaller records
|
||||
--echo #
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=50 (default))
|
||||
CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB;
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_update.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=35)
|
||||
CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB
|
||||
COMMENT='MERGE_THRESHOLD=35';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_update.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=25)
|
||||
CREATE TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB
|
||||
COMMENT='MERGE_THRESHOLD=25';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_update.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm explicit temporary table (MERGE_THRESHOLD=35)
|
||||
--echo # (though not registered to SYS_TABLES,SYS_INDEXES, it works correctly)
|
||||
# Temporary tables are not purged. so deleting records is not caused
|
||||
# So, should be tested by updating case only
|
||||
CREATE TEMPORARY TABLE tab1 (a bigint primary key, b varchar(2048)) engine=InnoDB
|
||||
COMMENT='MERGE_THRESHOLD=35';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_update.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # behavior for secondary index with blob
|
||||
--echo #
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=50 (default))
|
||||
# not to cause page operation at primary key, row_format=dynamic and the key is blob
|
||||
CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic;
|
||||
CREATE INDEX index1 ON tab1(b(750));
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_secondary.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=45)
|
||||
CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic;
|
||||
CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_secondary.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # test to confirm behavior (MERGE_THRESHOLD=40)
|
||||
CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB row_format=dynamic;
|
||||
CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=40';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_secondary.inc
|
||||
|
||||
DROP TABLE tab1;
|
||||
|
||||
|
||||
--echo # compressed table behaves same (MERGE_THRESHOLD=45)
|
||||
CREATE TABLE tab1 (a bigint primary key, b blob) engine=InnoDB
|
||||
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
|
||||
CREATE INDEX index1 ON tab1(b(750)) COMMENT 'MERGE_THRESHOLD=45';
|
||||
|
||||
--source suite/innodb/include/innodb_merge_threshold_secondary.inc
|
||||
|
||||
DROP TABLE tab1;
|
@ -1 +0,0 @@
|
||||
--loose-innodb-purge-threads=0
|
@ -10,20 +10,12 @@ if (`select count(*)=0 from information_schema.global_variables where variable_n
|
||||
|
||||
--disable_query_log
|
||||
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
|
||||
set @old_innodb_stats_persistent = @@innodb_stats_persistent;
|
||||
set @old_innodb_undo_logs = @@innodb_undo_logs;
|
||||
# Limit undo segments for stable progress of purge.
|
||||
set global innodb_undo_logs = 1;
|
||||
--enable_query_log
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*");
|
||||
|
||||
set global innodb_stats_persistent = false;
|
||||
|
||||
CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
|
||||
|
||||
#
|
||||
# make 4 leveled straight tree
|
||||
@ -139,6 +131,5 @@ drop table t1;
|
||||
|
||||
--disable_query_log
|
||||
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
|
||||
set global innodb_stats_persistent = @old_innodb_stats_persistent;
|
||||
set global innodb_undo_logs = @old_innodb_undo_logs;
|
||||
--enable_query_log
|
||||
|
Reference in New Issue
Block a user