Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/innodb/r/virtual_debug_purge.result |
CREATE TABLE `t` ( `a` BLOB, `b` BLOB, `c` BLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, `h` VARCHAR(10) DEFAULT NULL, `i` int ) ENGINE=InnoDB; INSERT INTO t VALUES (REPEAT('g', 16000), REPEAT('x', 16000), DEFAULT, "kk", 1); INSERT INTO t VALUES (REPEAT('a', 16000), REPEAT('b', 16000), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); SET global debug="+d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 16000) WHERE a like "aaa%"; select sleep(3); sleep(3) 0 SET global debug="-d,ib_purge_virtual_index_callback"; DROP TABLE t; CREATE TABLE t ( a TINYBLOB, b TINYBLOB, c TINYBLOB GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL, h VARCHAR(10) DEFAULT NULL, i INT ) ROW_FORMAT=COMPACT ENGINE=InnoDB; INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 100), DEFAULT, "kk", 1); INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2); CREATE INDEX idx ON t(c(100)); SET global debug="+d,ib_purge_virtual_index_callback"; UPDATE t SET a = REPEAT('m', 100) WHERE a like "aaa%"; select sleep(3); sleep(3) 0 SET global debug="-d,ib_purge_virtual_index_callback"; DROP TABLE t; CREATE TABLE t1 ( id INT NOT NULL, store_id INT NOT NULL, x INT GENERATED ALWAYS AS (id + store_id) ) PARTITION BY RANGE (store_id) ( PARTITION p0 VALUES LESS THAN (6), PARTITION p1 VALUES LESS THAN (11), PARTITION p2 VALUES LESS THAN (16), PARTITION p3 VALUES LESS THAN (21) ); insert into t1 values(1, 2, default); insert into t1 values(3, 4, default); insert into t1 values(3, 12, default); insert into t1 values(4, 18, default); CREATE INDEX idx ON t1(x); SET global debug="+d,ib_purge_virtual_index_callback"; UPDATE t1 SET id = 10 WHERE id = 1; select sleep(3); sleep(3) 0 SET global debug="-d,ib_purge_virtual_index_callback"; DROP TABLE t1; CREATE TABLE t1 (a INT, b INT); INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3); # disable purge CREATE TABLE t0 (a INT) ENGINE=InnoDB; BEGIN; SELECT * FROM t0; a DELETE FROM t1 WHERE a = 1; UPDATE t1 SET a = 4, b = 4 WHERE a = 3; INSERT INTO t1(a, b) VALUES (5, 5); SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged'; ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; ERROR 0A000: LOCK=NONE is not supported. Reason: ADD COLUMN col...VIRTUAL, ADD INDEX(col). Try LOCK=SHARED. ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; # enable purge COMMIT; # wait for purge to process the deleted records. SET DEBUG_SYNC= 'now SIGNAL purged'; /* connection default */ ALTER TABLE t1 ADD COLUMN c INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=SHARED; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS ((`a` + `b`)) VIRTUAL, KEY `idx` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t1; a b c 2 2 4 4 4 8 5 5 10 DROP TABLE t1; CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b)); INSERT INTO t1(a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4); # disable purge BEGIN; SELECT * FROM t0; a DELETE FROM t1 WHERE a = 1; UPDATE t1 SET a = 2, b = 2 WHERE a = 5; INSERT INTO t1(a, b) VALUES (6, 6); SET DEBUG_SYNC= 'inplace_after_index_build SIGNAL uncommitted WAIT_FOR purged'; ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; SET DEBUG_SYNC= 'now WAIT_FOR uncommitted'; DELETE FROM t1 WHERE a = 3; UPDATE t1 SET a = 7, b = 7 WHERE a = 4; INSERT INTO t1(a, b) VALUES (8, 8); # enable purge COMMIT; # wait for purge to process the deleted/updated records. SET DEBUG_SYNC= 'now SIGNAL purged'; /* connection default */ ALTER TABLE t1 ADD INDEX idx (c), ALGORITHM=INPLACE, LOCK=NONE; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) GENERATED ALWAYS AS ((`a` + `b`)) VIRTUAL, KEY `idx` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t1; a b c 2 2 4 7 7 14 6 6 12 8 8 16 DROP TABLE t0, t1;