polardbxengine/mysql-test/suite/innodb/t/innodb_bug26818787.test

107 lines
2.4 KiB
Plaintext

#
# This tests checks handling of secondary index purge when
# new record is inserted by modify and has externally stored
# columns. In that case purge may be called in state when
# it is not possible to build entry from row data.
#
# In the above case there was a try to access NULL entry for
# indexes with virtual columns and externally stored BLOBs.
#
--source include/have_debug_sync.inc
--source include/count_sessions.inc
SET DEBUG_SYNC='reset';
connect (con1,localhost,root,,);
#
# Try with an index without virtual columns
#
connection default;
CREATE TABLE t1 (
id INT UNIQUE NOT NULL,
a INT,
b BLOB,
ag INT GENERATED ALWAYS AS (a) VIRTUAL,
PRIMARY KEY(id),
INDEX bugidx (b(100),a)
) ENGINE=InnoDB;
INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('a', 50001));
INSERT INTO t1 (id, a, b) VALUES (1002, 2, REPEAT('b', 50002));
SET GLOBAL innodb_purge_stop_now = ON;
sleep 1;
DELETE FROM t1 WHERE id = 1001;
connection con1;
SET DEBUG_SYNC='before_row_ins_upd_pessimistic SIGNAL s1 WAIT_FOR s2 TIMEOUT 10';
send INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('z', 60001));
connection default;
SET DEBUG_SYNC='now WAIT_FOR s1';
SET GLOBAL innodb_purge_run_now = ON;
sleep 5;
SET DEBUG_SYNC='now SIGNAL s2';
--source include/wait_innodb_all_purged.inc
SET DEBUG_SYNC='reset';
connection con1;
reap;
SET DEBUG_SYNC='reset';
connection default;
drop table t1;
#
# Try with an index with virtual columns
#
connection default;
CREATE TABLE t1 (
id INT UNIQUE NOT NULL,
a INT,
b BLOB,
ag INT GENERATED ALWAYS AS (a) VIRTUAL,
PRIMARY KEY(id),
INDEX bugidx (b(100),ag)
) ENGINE=InnoDB;
INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('a', 50001));
INSERT INTO t1 (id, a, b) VALUES (1002, 2, REPEAT('b', 50002));
SET GLOBAL innodb_purge_stop_now = ON;
sleep 1;
DELETE FROM t1 WHERE id = 1001;
connection con1;
SET DEBUG_SYNC='before_row_ins_upd_pessimistic SIGNAL s1 WAIT_FOR s2 TIMEOUT 10';
send INSERT INTO t1 (id, a, b) VALUES (1001, 1, REPEAT('z', 60001));
connection default;
SET DEBUG_SYNC='now WAIT_FOR s1';
SET GLOBAL innodb_purge_run_now = ON;
sleep 5;
SET DEBUG_SYNC='now SIGNAL s2';
--source include/wait_innodb_all_purged.inc
SET DEBUG_SYNC='reset';
connection con1;
reap;
SET DEBUG_SYNC='reset';
connection default;
drop table t1;
#
# Cleanup
#
connection con1;
disconnect con1;
connection default;
--source include/wait_until_count_sessions.inc