mariadb/mysql-test/suite/innodb/t/insert_into_empty.test
Marko Mäkelä e04bbf73dc MDEV-25496 Assertion 'trx->bulk_insert' failed on INSERT
row_get_prebuilt_insert_row(): Remove some fallback code that had been
added in commit 8ea923f55b (MDEV-24818).
It seems that after all, statement boundaries are being reliably
indicated by ha_innobase::start_stmt() or
(for partitioned tables) ha_innobase::external_lock().
2021-06-29 15:20:33 +03:00

195 lines
4.6 KiB
Text

--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/maybe_debug.inc
--source include/have_partition.inc
# Enable MDEV-515 table-level undo logging for insert into empty table
SET foreign_key_checks=0, unique_checks=0;
--echo #
--echo # MDEV-24715 Assertion !node->table->skip_alter_undo
--echo #
CREATE TABLE t (a INT UNIQUE) ENGINE=InnoDB
REPLACE SELECT 1 AS a, 2 AS b UNION SELECT 1 AS a, 3 AS c;
SELECT * FROM t;
DROP TABLE t;
CREATE TEMPORARY TABLE t (a INT UNIQUE) ENGINE=InnoDB
REPLACE SELECT 1 AS a, 2 AS b UNION SELECT 1 AS a, 3 AS c;
SELECT * FROM t;
DROP TEMPORARY TABLE t;
--echo #
--echo # MDEV-24720 AHI removal during bulk index rollback
--echo #
SET @save_ahi = @@global.innodb_adaptive_hash_index;
SET GLOBAL innodb_adaptive_hash_index = 1;
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 SELECT * FROM seq_1_to_65536;
ROLLBACK;
CHECK TABLE t1;
--echo #
--echo # MDEV-24832 Root page AHI Removal fails fails during
--echo # bulk index rollback
--echo #
BEGIN;
INSERT INTO t1 SELECT * FROM seq_1_to_500;
ROLLBACK;
DROP TABLE t1;
SET GLOBAL innodb_adaptive_hash_index = @save_ahi;
--echo #
--echo # MDEV-24951 Assertion m.first->second.valid(trx->undo_no) failed
--echo # in trx_undo_report_row_operation
--echo #
CREATE TEMPORARY TABLE t (c INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB;
SET tx_read_only=1;
BEGIN;
INSERT INTO t2 VALUES(0);
INSERT INTO t VALUES(0);
COMMIT;
INSERT INTO t VALUES(0);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
DROP TEMPORARY TABLE t,t2;
SET tx_read_only=0;
DROP TEMPORARY TABLE t,t2;
--echo #
--echo # MDEV-24818 Optimize multiple INSERT into empty table
--echo #
CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES (5),(6),(7);
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (4),(5),(6);
COMMIT;
SELECT * FROM t1;
BEGIN;
INSERT INTO t1 VALUES (5),(6),(7);
SAVEPOINT a;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (4),(5),(6);
ROLLBACK TO SAVEPOINT a;
COMMIT;
SELECT * FROM t1;
DROP TABLE t1;
# Repeat the same with the MDEV-515 test disabled
SET foreign_key_checks=1;
CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES (5),(6),(7);
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (4),(5),(6);
COMMIT;
SELECT * FROM t1;
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (5),(6),(7);
SAVEPOINT a;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (4),(5),(6);
ROLLBACK TO SAVEPOINT a;
COMMIT;
SELECT * FROM t1;
DROP TABLE t1;
SET foreign_key_checks=0;
--echo #
--echo # MDEV-25315 Crash in SHOW ENGINE INNODB STATUS
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(0);
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES(2), (2);
--disable_result_log
SHOW ENGINE InnoDB STATUS;
--enable_result_log
COMMIT;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-25297 Assertion: trx->roll_limit <= trx->undo_no
--echo # in ROLLBACK TO SAVEPOINT
--echo #
CREATE TABLE t1 (c INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (c INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES(0);
SAVEPOINT x;
INSERT INTO t2 VALUES(0);
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES(0);
--error ER_ERROR_DURING_ROLLBACK
ROLLBACK TO SAVEPOINT x;
COMMIT;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-25487 Assertion failed in lock_rec_move
--echo #
CREATE TABLE t1 (a INT KEY) ENGINE=InnoDB;
--error 0,1193
SET @save_limit = @@GLOBAL.innodb_limit_optimistic_insert_debug;
--error 0,1193
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
BEGIN;
SELECT * FROM t1 LOCK IN SHARE MODE;
INSERT INTO t1 VALUES (0),(1),(2);
--error ER_WRONG_VALUE_COUNT_ON_ROW
INSERT INTO t1 VALUES (0,1);
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (2);
COMMIT;
--error 0,ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL innodb_limit_optimistic_insert_debug = @save_limit;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-25534 Assertion lock_table_has...LOCK_IX
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
SET autocommit=0;
LOCK TABLE t1 WRITE;
INSERT INTO t1 VALUES (1);
COMMIT;
CREATE TEMPORARY TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t0 VALUES (1);
INSERT INTO t1 VALUES (2);
COMMIT;
SET autocommit=1;
DROP TABLE t1;
DROP TEMPORARY TABLE t0;
--echo #
--echo # MDEV-25496 Assertion 'trx->bulk_insert' failed
--echo # in trx_undo_report_row_operation on INSERT
--echo #
CREATE TABLE t (i INT) ENGINE=InnoDB PARTITION BY HASH (i) PARTITIONS 2;
INSERT INTO t VALUES (0);
INSERT INTO t VALUES (1),(0),(1);
DROP TABLE t;