config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/t/

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
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/innodb/t/virtual_debug.test

--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/have_debug.inc
--source include/count_sessions.inc
--source include/have_innodb_max_16k.inc

CREATE TABLE `t` (
  `a` VARCHAR(100),
  `b` VARCHAR(100),
  `c` VARCHAR(200) GENERATED ALWAYS AS (CONCAT(a,b)) VIRTUAL,
  `h` VARCHAR(10) DEFAULT NULL,
  `i` int
) ENGINE=InnoDB;

INSERT INTO t VALUES (REPEAT('g', 100), REPEAT('x', 10), DEFAULT, "kk", 1);
INSERT INTO t VALUES (REPEAT('a', 100), REPEAT('b', 100), DEFAULT, "mm", 2);

CREATE INDEX idx ON t(c(100));

SET session debug="+d,ib_alter_add_virtual_fail";
--error ER_WRONG_KEY_COLUMN
ALTER TABLE t ADD COLUMN x VARCHAR(200) GENERATED ALWAYS AS (a) VIRTUAL,
ALGORITHM = INPLACE;
--error ER_WRONG_KEY_COLUMN
ALTER TABLE t DROP COLUMN c, ALGORITHM = INPLACE;
SET session debug="-d,ib_alter_add_virtual_fail";
DROP TABLE t;

#online test
CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));

INSERT INTO t VALUES (11, 3, DEFAULT, 'mm');
INSERT INTO t VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t VALUES (28, 1, DEFAULT, 'mm');
INSERT INTO t VALUES (null, null, DEFAULT, "mx");

SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send CREATE INDEX idx ON t(c);

connect (con1,localhost,root,,);
connection con1;

SET DEBUG_SYNC = 'now WAIT_FOR start_create';
update t set a=0 where a = 11;
SET DEBUG_SYNC = 'now SIGNAL go_ahead';

connection default;
reap;

SELECT c FROM t;
SHOW CREATE TABLE t;
SELECT * FROM t;

SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send ALTER TABLE t ADD COLUMN x INT;

connection con1;

SET DEBUG_SYNC = 'now WAIT_FOR start_create';
start transaction;
update t set a=1 where a = 0;
ROLLBACK;
SET DEBUG_SYNC = 'now SIGNAL go_ahead';

connection default;
reap;

SELECT c FROM t;

SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send ALTER TABLE t ADD COLUMN x2 INT;

connection con1;

SET DEBUG_SYNC = 'now WAIT_FOR start_create';
start transaction;
DELETE FROM t WHERE a = 0;
ROLLBACK;
DELETE FROM t WHERE a = 0;
SET DEBUG_SYNC = 'now SIGNAL go_ahead';

connection default;
reap;

SELECT c FROM t;

disconnect con1;
DROP TABLE t;

SET DEBUG_SYNC = 'RESET';


# Test add virtual column and add index at the same time
# introduce some error

CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));

INSERT INTO t VALUES (11, 3, DEFAULT, 'mm');

INSERT INTO t VALUES (18, 1, DEFAULT, 'mm');

INSERT INTO t VALUES (28, 1, DEFAULT, 'mm');

INSERT INTO t VALUES (null, null, DEFAULT, 'mm');

CREATE INDEX idx_1 on t(c);

SET SESSION debug="+d,create_index_fail";

--enable_info
--error ER_DUP_ENTRY
ALTER TABLE t ADD COLUMN x INT GENERATED ALWAYS AS(a+b), ADD INDEX idx (x);
SET SESSION debug="-d,create_index_fail";
--disable_info

SHOW CREATE TABLE t;

SELECT c FROM t;

DROP TABLE t;


--echo #
--echo # Bug#22018532 ASSERTION WHEN ONLINE REAPPLY REBUILD LOG ON
--echo # MULTIPLE INDEXED VIRTUAL COLUMNS
--echo #

create table t (
  a int as (1) virtual,
  b int,
  c int as (1) virtual,
  unique(b),
  unique(c),
  key(a)
) engine=innodb;

insert ignore into t values();

SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send optimize table t

connect (con1,localhost,root,,);

SET DEBUG_SYNC = 'now WAIT_FOR start_create';
insert ignore into t values();
SET DEBUG_SYNC = 'now SIGNAL go_ahead';

connection default;
--echo /* connection default */ optimize table t;
reap;
SELECT c FROM t;
SHOW CREATE TABLE t;
SELECT * FROM t;
DROP TABLE t;

# Do another test without duplicate error

CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));

INSERT INTO t VALUES (11, 3, DEFAULT, 'mm');
INSERT INTO t VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t VALUES (28, 1, DEFAULT, 'mm');
INSERT INTO t VALUES (null, null, DEFAULT, 'mm');

CREATE INDEX idx ON t(c);

SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_rebuild WAIT_FOR go_ahead';
--send optimize table t

connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR start_rebuild';
INSERT INTO t VALUES (48, 2, DEFAULT, 'xx');
INSERT INTO t VALUES (68, 3, DEFAULT, 'sx');
SET DEBUG_SYNC = 'now SIGNAL go_ahead';

connection default;
--echo /* connection default */ optimize table t;
reap;

SELECT c FROM t;

disconnect con1;

DROP TABLE t;
--echo #
--echo #  Bug#22140944    WL#8149: ADD TEST FOR THE ROW0LOG.CC FIX THAT
--echo #                  WAS UNRELATED TO Bug#21894654
--echo #

CREATE TABLE t1 ( id INT ,a VARCHAR(20), b VARCHAR(20) ,c VARCHAR(40)
GENERATED ALWAYS AS (CONCAT(a,b)),key(c));
INSERT INTO t1 (id,a,b) VALUES (10,'aditya','hello');

connect (con1,localhost,root);
connection con1;

SET DEBUG_SYNC= 'row_merge_after_scan SIGNAL opened WAIT_FOR go_ddl';
send ALTER TABLE t1 ADD CONSTRAINT  pk1 PRIMARY KEY (id);

connection default;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
UPDATE t1 SET a = 'fg', id = 20 WHERE id = 10;
SET DEBUG_SYNC= 'now SIGNAL go_ddl';

connection con1;
reap;
disconnect con1;

connection default;
SELECT * from t1;
DROP TABLE t1;

--echo #
--echo #  Bug#22951879 - ASSERTS RELATED TO ONLINE DDL AND GCOL
--echo #

# Create a table with 2 virtual column, one (vbidxcol) is indexed and
# the other one (vbcol) is not
create table ibstd_14 (a int not null, d int not null, b varchar(198) not null, c char(181), vadcol int as (a+length(d)) stored, vbcol char(2) as (substr(b,2,2)) virtual, vbidxcol char(3) as (substr(b,1,3)) virtual , index(d), index(a), index(vbidxcol), index(a,vbidxcol), index(vbidxcol,d), unique key (b(10), a, d), index(c(99), b(31)), index(b(5), c(10), a) , index(a,d)) engine=InnoDB stats_persistent=1 row_format=dynamic;

# Do an alter table rebuild table and also create a new index on this
# non-indexed virtual column
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send alter table ibstd_14  row_format=compressed key_block_size=4,add  key kn3 (d,c,vbcol,b);

# Do a concurrent insert, and make sure this newly indexed virtual column
# is also logged
connect (con1,localhost,root);
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR start_create';
insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6',repeat('oacolaarlruoacuroauurloraarucoooarcooauoolacalllaulrruarrrucruuooclacuoouccarrcoocloccorrrrarourcooalloocooccouruolaorlcaocualolc','1'),repeat('lolrrlalcocroraaulauclaaucolcorcuooaolruaooooluooooouaoorlarucorullalcrrloccououaooaorluorraclrcooouuolocoaolcocaaculruoocucoocoooauuolarcoraraocaoolulolarru','1'),default,default);

insert into ibstd_14 (a,d,b,c, vbidxcol, vbcol) values ('118','6', 'aaaa', 'lll', default, default);

# Also do an concurrent update, make sure this is performed
update ibstd_14 set b='11111' where b='aaaa';

SET DEBUG_SYNC = 'now SIGNAL go_ahead';

connection default;
reap;

select * from ibstd_14;

# This will use the newly added "kn3" index, to check materialized vbcol
# after log reapply
select d,c,vbcol,b from  ibstd_14;

# check the value is inserted into the index
select vbcol from ibstd_14;

drop table ibstd_14;

--echo #
--echo # Bug#22018745 CORRUPTION IN ONLINE TABLE REBUILD
--echo # (ROW_FORMAT=REDUNDANT, INDEXED VIRTUAL COLUMN)
--echo #

CREATE TABLE t (
  b char(5) PRIMARY KEY,
  v char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, KEY(v)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT;

connection con1;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL prepared WAIT_FOR apply';
--send OPTIMIZE TABLE t
connection default;

SET DEBUG_SYNC='now WAIT_FOR prepared';
INSERT INTO t SET b='fubar';
BEGIN;
DELETE FROM t;
ROLLBACK;
SET DEBUG_SYNC='now SIGNAL apply';

connection con1;
reap;

connection default;
CHECK TABLE t;
SELECT * FROM t;
DROP TABLE t;

--echo #
--echo # Bug#26375771 INNODB: ASSERTION FAILURE: MACH0DATA.IC:308:VAL > 0X7F
--echo #
create table ibstd_07 (a int not null, d int not null, b blob not null, c text, vadcol int as (a+length(d)) stored, vbcol char(2) as (substr(b,2,2)) virtual, vbidxcol char(3) as (substr(b,1,3)) virtual , index(d  desc), index(a  desc), index(vbidxcol  desc), index(vbidxcol  desc,d  asc), unique key (b(101)  desc, a  asc, d ), index(c(255)  desc, b(255)  asc), index(b(5)  desc, c(10)  asc, a ) ) engine=InnoDB default charset=latin1 row_format=redundant;

insert into ibstd_07 values (2, 2, repeat('rocalrulcrcaurcuccoolrouuocacaooaucauualcucuoucucclolcllloocuarcoorlaccarocouuaoorcolloucraoaaooc','281'),repeat('ouolrculuouocououooalcoraooaulouuacrolrocooraoaooooolaccralacalooolalocoaacoorarorcurccarocucla','317'), default, default, default);


SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send alter table ibstd_07  add primary key (b(11)  desc,a  asc, d );

# Do a concurrent update
connection con1;
SET DEBUG_SYNC = 'now WAIT_FOR start_create';

update ibstd_07 set c=repeat('0.366710324443464crllooolarlollorlulololucrluacoorrrluroluroocouauacacruloulcurlraorcrclrolcocrrcoccolourrooclrcocruruauallo','70');


SET DEBUG_SYNC = 'now SIGNAL go_ahead';

connection default;
reap;

SELECT * FROM ibstd_07;
DROP TABLE ibstd_07;

disconnect con1;

SET DEBUG_SYNC = 'RESET';

--source include/wait_until_count_sessions.inc



--echo #
--echo # BUG#28448853 - ASSERTION FAILURE: ROW0LOG.CC:2153 ROW_LOG_TABLE_APPLY (THR=0X7F7C7C050030
--echo #

CREATE TABLE t1(a INT NOT NULL, d INT NOT NULL, b VARCHAR(198) NOT NULL, c CHAR(84), vbcol CHAR(2) AS (substr(b, 2, 2)) VIRTUAL);

INSERT INTO t1(a, d, b, c) VALUES(200, 300, '1.3.1415926535', 'hello world');

SELECT * FROM t1;

connect (conn1, localhost, root,,);

connection default;

SET DEBUG_SYNC = 'inplace_after_index_build SIGNAL altered WAIT_FOR dmls_done';

--send ALTER TABLE t1 ROW_FORMAT = COMPRESSED;

connection conn1;

SET DEBUG_SYNC = 'now WAIT_FOR altered';

START TRANSACTION;
UPDATE t1 SET b = '6.1516179' WHERE a = 200;
ROLLBACK;

SET DEBUG_SYNC = 'now SIGNAL dmls_done';

disconnect conn1;

connection default;

reap;

SET DEBUG_SYNC = 'reset';

CHECK TABLE t1;

SHOW CREATE TABLE t1;

SELECT * FROM t1;

DROP TABLE t1;



--echo #
--echo # Bug#28825718 - ASSERTION FAILURE: TRX0REC.CC:NNN:N_IDX > 0 WHILE DOING REPLACE/INSERT
--echo #

CREATE TABLE t1(a INT PRIMARY KEY, b INT, c INT GENERATED ALWAYS AS(b+1) VIRTUAL) ENGINE=InnoDB;

INSERT INTO t1(a, b) VALUES(1, 1);

connect (con1,localhost,root,,);
connection con1;
SET DEBUG_SYNC = 'row_log_apply_after SIGNAL s1 WAIT_FOR s2';
SET lock_wait_timeout = 1;
--send ALTER TABLE t1 ADD UNIQUE INDEX(c, b)

connection default;

SET DEBUG_SYNC = 'now WAIT_FOR s1';
SET DEBUG_SYNC = 'row_ins_sec_index_enter SIGNAL s2 WAIT_FOR s3';
--send INSERT INTO t1(a, b) VALUES(2, 2)

connection con1;
--echo /* con1 reap */ ALTER TABLE t1 ADD UNIQUE INDEX(c, b);
--error ER_LOCK_WAIT_TIMEOUT
reap;

SET DEBUG_SYNC ='now SIGNAL s3';

disconnect con1;

connection default;
reap;

ALTER TABLE t1 ADD KEY(b);

INSERT INTO t1(a, b) VALUES(3, 3);

SELECT * FROM t1;

CHECK TABLE t1;

DROP TABLE t1;

--echo #
--echo # Bug#28834208 ROW_LOG_TABLE_APPLY_UPDATE*INPLACE_ALTER_TABLE
--echo #

CREATE TABLE t1 (
   pkey INT(11) PRIMARY KEY,
   a VARCHAR(100),
   v VARCHAR(100) GENERATED ALWAYS AS (SUBSTRING(a,2,2)) VIRTUAL,
   c varchar(100),
  UNIQUE KEY k (v)
);
INSERT INTO t1 ( pkey,a,c) VALUES (149,'bata','test');
SELECT pkey,a,v FROM t1;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL index_built WAIT_FOR S2';
--send OPTIMIZE TABLE t1
connect (con1,localhost,root,,);
--echo # Connect to con1
--connection con1
SET DEBUG_SYNC = 'now WAIT_FOR index_built';
UPDATE t1 SET a='tata' WHERE pkey=149;
SET DEBUG_SYNC ='now signal S2';
SELECT pkey,a,v FROM t1;
disconnect con1;
--connection default
--echo # Connect to Default
reap;
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (
   pkey INT(11) PRIMARY KEY,
   a VARCHAR(100),
   v VARCHAR(100) GENERATED ALWAYS AS (SUBSTRING(a,2,2)) VIRTUAL,
   c varchar(100),
   v1 VARCHAR(100) GENERATED ALWAYS AS (SUBSTRING(c,2,2)) VIRTUAL,
   KEY k (v),
   KEY v (v1)
);
INSERT INTO t1 (pkey, a, c) VALUES (149, 'bata', 'test');
INSERT INTO t1 (pkey, a, c) VALUES (150, 'bata', 'test');
INSERT INTO t1 (pkey, a, c) VALUES (160, 'bata', 'test');
SELECT pkey, a, v, c, v1 FROM t1;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL index_built WAIT_FOR S2';
--send OPTIMIZE TABLE t1
connect (con1,localhost,root,,);
--echo # Connect to con1
--connection con1
SET DEBUG_SYNC = 'now WAIT_FOR index_built';
UPDATE t1 SET c = 'best' WHERE pkey = 149;
UPDATE t1 SET a = 'tata' WHERE pkey = 150;
UPDATE t1 SET a = 'tata', c = 'best' WHERE pkey = 160;
SET DEBUG_SYNC ='now signal S2';
SELECT pkey, a, v, c, v1 FROM t1;
disconnect con1;
--connection default
--echo # Connect to Default
reap;
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1(
   j SERIAL PRIMARY KEY,
   a VARCHAR(36),
   isa BOOLEAN,
   ab VARCHAR(36) AS (IF(`isa`,`a`,NULL )),
   KEY k(ab)
);
INSERT INTO t1 (a, isa) VALUES ('test', 1);
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL index_built WAIT_FOR S2';
--send OPTIMIZE TABLE t1
connect (con1,localhost,root,,);
--echo # Connect to con1
--connection con1
SET DEBUG_SYNC = 'now WAIT_FOR index_built';
UPDATE t1 SET isa=0 ;
SET DEBUG_SYNC ='now signal S2';
SELECT j,a,isa,ab FROM t1;
disconnect con1;
--echo # Connect to Default
--connection default
reap;
SELECT j,a,isa,ab FROM t1;
UPDATE t1 SET isa = 1 WHERE a = 'test' AND isa = 0;
SELECT j,a,isa,ab FROM t1;
DROP TABLE t1;

--echo #
--echo # Bug#29451999: CRASH WITH RANGE QUERIES
--echo #

CREATE TABLE t1 (c1 JSON, c2 TINYTEXT, c3 TIMESTAMP(4), c4 JSON, c5 DOUBLE, c6 TIME(4), c7 LONGTEXT GENERATED ALWAYS AS ('20:30:44') VIRTUAL NOT NULL, KEY k1 (c7(12))) ENGINE=INNODB;
INSERT INTO t1 (c1, c2, c3, c4) VALUES('{}', 1, '1991-05-27', '{}');
INSERT INTO t1 (c1, c2, c3, c4) SELECT c1, c2, c3, c4 FROM t1;
INSERT INTO t1 (c1, c2, c3, c4) SELECT c1, c2, c3, c4 FROM t1;
INSERT INTO t1 (c1, c2, c3, c4) SELECT c1, c2, c3, c4 FROM t1;
INSERT INTO t1 (c1, c2, c3, c4) SELECT c1, c2, c3, c4 FROM t1;
INSERT INTO t1 (c1, c2, c3, c4) SELECT c1, c2, c3, c4 FROM t1;
INSERT INTO t1 (c1, c2, c3, c4) SELECT c1, c2, c3, c4 FROM t1;
INSERT INTO t1 (c1, c2, c3, c4) SELECT c1, c2, c3, c4 FROM t1;
SELECT COUNT(*) FROM t1;

SET GLOBAL innodb_purge_stop_now= ON;
DELETE FROM t1;

SELECT c4 FROM t1 WHERE c7 BETWEEN '16383' AND '2015-01-01';

#Cleanup
SET GLOBAL innodb_purge_run_now = ON;
DROP TABLE t1;

CREATE TABLE t2 (
  i INT NOT NULL,
  gc INT GENERATED ALWAYS AS (i) VIRTUAL NOT NULL,
  KEY (gc)
);

INSERT INTO t2 (i) VALUES (-1), (0), (1), (2);

BEGIN;
--disable_query_log
--let $i = 2000
while ($i > 0)
{
  INSERT INTO t2 (i) VALUES (-10);
  dec $i;
}
--enable_query_log

CONNECT (con1,localhost,root,,);
# This query used to return zero rows.
SELECT i FROM t2 FORCE INDEX (gc) WHERE gc <= -1;
# Similar query using covering index was correct even before.
SELECT gc FROM t2 FORCE INDEX (gc) WHERE gc <= -1;
DISCONNECT con1;
CONNECTION default;

COMMIT;

DROP TABLE t2;

--echo #
--echo # Bug #30556595  FAILING ASSERTION: !CURSOR->INDEX->IS_COMMITTED()
--echo # ON TABLE WITH GCOLS
--echo #

--echo # Testcase-1
CREATE TABLE t (pid int PRIMARY KEY,
                uid int,
                vid int AS (uid) VIRTUAL);
connect(con1,localhost,root,,);
--echo # Create index on virtual column and stop before applying row logs.
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL start_dml WAIT_FOR resume_ddl';
--send ALTER TABLE t ADD INDEX idx_vid(vid), algorithm=inplace
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR start_dml';
--echo # Insert a record to generate an insert row log for the new index.
--echo # LOG-1 idx_vid : INSERT [10, 1]
INSERT INTO t(pid, uid) VALUES (1,10);
--echo # Update the record changing PK. It should generate 2 row logs for the new index.
--echo # LOG-2 idx_vid : DELETE [10, 1]
--echo # LOG-3 idx_vid : INSERT [10, 2]
UPDATE t SET pid = 2 WHERE pid = 1;
SELECT * FROM t;
SET DEBUG_SYNC= 'now SIGNAL resume_ddl';
connection con1;
--reap
connection default;
--echo # Insert a record to re-use the delete marked record in idx_vid [10, 1]
INSERT INTO t(pid, uid) VALUES (1,10);
SELECT * FROM t;
disconnect con1;
DROP TABLE t;

--echo # Testcase-2
CREATE TABLE t (pid int PRIMARY KEY,
                uid int,
                vid int AS (uid) VIRTUAL);
connect(con1,localhost,root,,);
--echo # Create index on virtual column and stop before applying row logs.
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL start_dml WAIT_FOR resume_ddl';
--send ALTER TABLE t ADD INDEX idx_vid(vid), algorithm=inplace
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR start_dml';
--echo # Start transaction
BEGIN;
--echo # Insert a record to generate an insert row log for the new index.
--echo # LOG-1 idx_vid : INSERT [10, 1]
INSERT INTO t(pid, uid) VALUES (1,10);
--echo # Update the record changing PK. It should generate 2 row logs for the new index.
--echo # LOG-2 idx_vid : DELETE [10, 1]
--echo # LOG-3 idx_vid : INSERT [10, 2]
UPDATE t SET pid = 2 WHERE pid = 1;
SELECT * FROM t;
--echo # Rollback transaction
--echo # LOG-4 idx_vid : DELETE [10, 2]
--echo # LOG-5 idx_vid : INSERT [10, 1]
--echo # LOG-6 idx_vid : DELETE [10, 1]
ROLLBACK;
SET DEBUG_SYNC= 'now SIGNAL resume_ddl';
connection con1;
--reap
connection default;
--echo # Insert a record to check valid entry in idx_vid [NULL, 1]
INSERT INTO t(pid) VALUES (1);
SELECT * FROM t;
disconnect con1;
DROP TABLE t;

--echo # Testcase-3
CREATE TABLE t (pid int PRIMARY KEY,
                uid int,
                vid int AS (uid) VIRTUAL);
INSERT INTO t(pid, uid) VALUES (1,10);
connect(con1,localhost,root,,);
--echo # Create index on virtual column and stop before applying row logs.
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL start_dml WAIT_FOR resume_ddl';
--send ALTER TABLE t ADD INDEX idx_vid(vid), algorithm=inplace
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR start_dml';
--echo # Update the record changing PK. It should generate 2 row logs for the new index.
--echo # LOG-2 idx_vid : DELETE [10, 1]
--echo # LOG-3 idx_vid : INSERT [10, 2]
UPDATE t SET pid = 2 WHERE pid = 1;
SET DEBUG_SYNC= 'now SIGNAL resume_ddl';
connection con1;
--reap
connection default;
--echo # Read [2, 10, 10] row using idx_vid index key.
--sleep 1
select * from t where VID=10;
disconnect con1;
DROP TABLE t;

--echo # Testcase-4
CREATE TABLE t (pid int PRIMARY KEY,
                uid int,
                vid int AS (uid) VIRTUAL);
INSERT INTO t(pid, uid) VALUES (1,10);
connect(con1,localhost,root,,);
--echo # Create index on virtual column and stop before applying row logs.
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL start_dml WAIT_FOR resume_ddl';
--send ALTER TABLE t ADD INDEX idx_vid(vid), algorithm=inplace
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR start_dml';
--echo # Update the record changing PK. It should generate 2 row logs for the new index.
--echo # LOG-2 idx_vid : DELETE [10, 1]
--echo # LOG-3 idx_vid : INSERT [10, 2]
UPDATE t SET pid = 2 WHERE pid = 1;
SET DEBUG_SYNC= 'now SIGNAL resume_ddl';
connection con1;
--reap
connection default;
--echo # Delete a record.
delete from t limit 1;
disconnect con1;
DROP TABLE t;

Man Man