*** Bug #29151 ***
*** Initialization for 'InnoDB Compatibility Mode'
SET @@storage_engine = Falcon;
SET falcon_consistent_read = off;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int, b int, c char(10), PRIMARY KEY (a));
# Establish connection conn1
SET falcon_consistent_read = off;
# Establish connection conn2
SET falcon_consistent_read = off;
INSERT INTO t1 VALUES(490, 0, 'inserted');
*** Test if an UPDATE will get the new record after waiting
# Switch to connection conn1
BEGIN;
UPDATE t1 SET c = 'updated' WHERE a = 490;
DELETE FROM t1 WHERE a = 490;
INSERT INTO t1 VALUES(490, 1, 'inserted');
SELECT * FROM t1;
a	b	c
490	1	inserted
# Switch to connection conn2
BEGIN;
SELECT * FROM t1;
a	b	c
490	0	inserted
UPDATE t1 SET c = 'updated' WHERE a = 490;
# Switch to connection conn1
SELECT * FROM t1;
a	b	c
490	1	inserted
COMMIT;
# Switch to connection conn2
DELETE FROM t1 WHERE a = 490;
INSERT INTO t1 VALUES(490, 2, 'inserted');
COMMIT;
SELECT * FROM t1;
a	b	c
490	2	inserted
*** Test if a DELETE will get the new record after waiting
BEGIN;
UPDATE t1 SET c = 'updated' WHERE a = 490;
DELETE FROM t1 WHERE a = 490;
INSERT INTO t1 VALUES(490, 3, 'inserted');
# Switch to connection conn1
BEGIN;
SELECT * FROM t1;
a	b	c
490	2	inserted
DELETE FROM t1 WHERE a = 490;
# Switch to connection conn2
SELECT * FROM t1;
a	b	c
490	3	inserted
COMMIT;
# Switch to connection conn1
SELECT * FROM t1;
a	b	c
490	2	inserted
COMMIT;
SELECT * FROM t1;
a	b	c
490	3	inserted
DELETE FROM t1 WHERE a = 490;
SELECT * FROM t1;
a	b	c
*** Test if an INSERT will wait on a pending non-block
INSERT INTO t1 VALUES(490, 4, 'inserted');
BEGIN;
UPDATE t1 SET c = 'updated' WHERE a = 490;
DELETE FROM t1 WHERE a = 490;
SELECT * FROM t1;
a	b	c
# Switch to connection conn2
BEGIN;
SELECT * FROM t1;
a	b	c
490	4	inserted
INSERT INTO t1 VALUES(490, 5, 'inserted');
# Switch to connection conn1
SELECT * FROM t1;
a	b	c
COMMIT;
# Switch to connection conn2
SELECT * FROM t1;
a	b	c
490	4	inserted
490	5	inserted
COMMIT;
# Switch to connection conn1
SELECT * FROM t1;
a	b	c
490	5	inserted
# Switch to connection default
DROP TABLE t1;
