#
# A SELECT run while a table-wide DELETE is blocked by another
# transaction's uncommitted insert, at every isolation level (see the
# .combinations file). Only READ UNCOMMITTED observes the rows the
# waiting DELETE has already delete-marked.
#
# innodb_snapshot_isolation is covered with both values. When it is ON
# (the default in 11.8 and later), at REPEATABLE READ and SERIALIZABLE
# the DELETE fails once the insert is committed, because it cannot see
# that row in its read view. When it is OFF, the DELETE succeeds and
# removes that row too.
#
CREATE TABLE t(c1 INT NOT NULL, c2 INT NOT NULL) ENGINE=InnoDB;
INSERT INTO t VALUES (2,2);
connect  con1,localhost,root,,;
connect  con2,localhost,root,,;
connection con1;
BEGIN;
connection con2;
BEGIN;
INSERT INTO t VALUES (5,5);
SELECT * FROM t;
c1	c2
2	2
5	5
connection con1;
SELECT * FROM t;
c1	c2
2	2
DELETE FROM t WHERE TRUE;
connection con2;
SELECT * FROM t;
c1	c2
2	2
5	5
COMMIT;
connection con1;
ERROR HY000: Record has changed since last read in table 't'; try restarting transaction
COMMIT;
SELECT * FROM t;
c1	c2
2	2
5	5
disconnect con1;
disconnect con2;
connection default;
DROP TABLE t;
