mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
2b7573ecdd
Fixed wait condition to wait for InnoDB to actually acquire row locks instead of waiting for thread to enter "Searching rows for update" state (which happens earlier). Also use default wait timeout, 2 seconds can be too few for threads to enter appropriate state.
162 lines
4.8 KiB
Text
162 lines
4.8 KiB
Text
--source include/have_partition.inc
|
|
--source include/have_innodb.inc
|
|
|
|
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
|
|
|
--echo #
|
|
--echo # Bug#11766879/Bug#60106: DIFF BETWEEN # OF INDEXES IN MYSQL VS INNODB,
|
|
--echo # PARTITONING, ON INDEX CREATE
|
|
--echo # Bug#12696518: MEMORY LEAKS IN HA_PARTITION (VALGRIND TESTS ON TRUNK)
|
|
--echo #
|
|
CREATE TABLE t1 (
|
|
id bigint NOT NULL AUTO_INCREMENT,
|
|
time date,
|
|
id2 bigint not null,
|
|
PRIMARY KEY (id,time)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
|
/*!50100 PARTITION BY RANGE(TO_DAYS(time))
|
|
(PARTITION p10 VALUES LESS THAN (734708) ENGINE = InnoDB,
|
|
PARTITION p20 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */;
|
|
|
|
INSERT INTO t1 (time,id2) VALUES ('2011-07-24',1);
|
|
INSERT INTO t1 (time,id2) VALUES ('2011-07-25',1);
|
|
INSERT INTO t1 (time,id2) VALUES ('2011-07-25',1);
|
|
|
|
--error ER_DUP_ENTRY
|
|
CREATE UNIQUE INDEX uk_time_id2 on t1(time,id2);
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
|
|
DROP TABLE t1;
|
|
|
|
call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal");
|
|
--echo #
|
|
--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt
|
|
--echo #
|
|
SET @old_innodb_file_format = @@global.innodb_file_format;
|
|
SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
|
|
SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
|
|
SET @@global.innodb_file_format = Barracuda,
|
|
@@global.innodb_file_per_table = ON,
|
|
@@global.innodb_strict_mode = ON;
|
|
|
|
--echo # Connection con1
|
|
--connect(con1,localhost,root,,)
|
|
|
|
CREATE TABLE t1 (id INT NOT NULL
|
|
PRIMARY KEY,
|
|
user_num CHAR(10)
|
|
) ENGINE = InnoDB
|
|
KEY_BLOCK_SIZE=4
|
|
PARTITION BY HASH(id) PARTITIONS 1;
|
|
|
|
--replace_result #p# #P#
|
|
--list_files $MYSQLD_DATADIR/test
|
|
SHOW CREATE TABLE t1;
|
|
|
|
SET GLOBAL innodb_file_per_table = OFF;
|
|
|
|
--disconnect con1
|
|
--connect(con2,localhost,root,,)
|
|
--echo # Connection con2
|
|
|
|
LOCK TABLE t1 WRITE;
|
|
|
|
--echo # ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
|
|
--echo # are incompatible with innodb_file_per_table = OFF;
|
|
|
|
--error ER_GET_ERRNO
|
|
ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
|
|
|
|
--replace_result #p# #P#
|
|
--list_files $MYSQLD_DATADIR/test
|
|
--echo # This SET is not needed to reproduce the bug,
|
|
--echo # it is here just to make the test case more realistic
|
|
SET innodb_strict_mode = OFF;
|
|
|
|
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
|
|
--replace_result #p# #P#
|
|
--list_files $MYSQLD_DATADIR/test
|
|
|
|
# really bug#56172
|
|
ALTER TABLE t1 REBUILD PARTITION p0;
|
|
|
|
UNLOCK TABLES;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
|
|
--disconnect con2
|
|
--connection default
|
|
--echo # Connection default
|
|
SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
|
|
SET @@global.innodb_file_format = @old_innodb_file_format;
|
|
SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
|
|
|
|
#
|
|
# Bug#32430 - show engine innodb status causes errors
|
|
#
|
|
SET NAMES utf8;
|
|
CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
|
|
ENGINE=InnoDB
|
|
PARTITION BY RANGE (a)
|
|
SUBPARTITION BY HASH (a)
|
|
(PARTITION `p0``\""e` VALUES LESS THAN (100)
|
|
(SUBPARTITION `sp0``\""e`,
|
|
SUBPARTITION `sp1``\""e`),
|
|
PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
|
|
(SUBPARTITION `sp2``\""e`,
|
|
SUBPARTITION `sp3``\""e`));
|
|
INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
|
|
START TRANSACTION;
|
|
--echo # con1
|
|
connect(con1,localhost,root,,);
|
|
SET NAMES utf8;
|
|
START TRANSACTION;
|
|
--echo # default connection
|
|
connection default;
|
|
UPDATE `t``\""e` SET a = 16 WHERE a = 0;
|
|
--echo # con1
|
|
connection con1;
|
|
UPDATE `t``\""e` SET a = 8 WHERE a = 22;
|
|
let $id_1= `SELECT CONNECTION_ID()`;
|
|
SEND;
|
|
UPDATE `t``\""e` SET a = 12 WHERE a = 0;
|
|
--echo # default connection
|
|
connection default;
|
|
let $wait_condition= SELECT COUNT(*)=2 FROM INFORMATION_SCHEMA.INNODB_LOCKS;
|
|
--source include/wait_condition.inc
|
|
--sorted_result
|
|
SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
|
|
GROUP BY lock_table;
|
|
set @old_sql_mode = @@sql_mode;
|
|
set sql_mode = 'ANSI_QUOTES';
|
|
--sorted_result
|
|
SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
|
|
GROUP BY lock_table;
|
|
set @@sql_mode = @old_sql_mode;
|
|
--error ER_LOCK_DEADLOCK
|
|
UPDATE `t``\""e` SET a = 4 WHERE a = 22;
|
|
--echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
|
|
# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
|
|
# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
|
|
# trx id 0 775
|
|
# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
|
|
# on big texts, removing a lot of text before + after makes it much faster.
|
|
#/.*in (.*) trx.*/\1/
|
|
--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
|
|
SHOW ENGINE InnoDB STATUS;
|
|
set @old_sql_mode = @@sql_mode;
|
|
set sql_mode = 'ANSI_QUOTES';
|
|
--replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in //
|
|
SHOW ENGINE InnoDB STATUS;
|
|
set @@sql_mode = @old_sql_mode;
|
|
--echo # con1
|
|
connection con1;
|
|
REAP;
|
|
ROLLBACK;
|
|
disconnect con1;
|
|
--echo # default connection
|
|
connection default;
|
|
DROP TABLE `t``\""e`;
|
|
SET NAMES DEFAULT;
|