mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
86e0a73eaa
The file wait_innodb_all_purged.inc waited for InnoDB purge in a way that only worked in debug builds. The file wait_all_purged.inc provides a better mechanism.
192 lines
6.4 KiB
Text
192 lines
6.4 KiB
Text
# #############################################################
|
|
# 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_partition.inc
|
|
|
|
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
|
|
|
# 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;
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|