*** Bug #34164 ***
SET @@storage_engine = 'Falcon';
DROP DATABASE IF EXISTS test2;
SELECT @@GLOBAL.falcon_consistent_read INTO @previous_falcon_consistent_read;
SET GLOBAL FALCON_CONSISTENT_READ=OFF;
CREATE DATABASE test2;
USE test2;
CREATE TABLE t1 (a int primary key, b int) engine=falcon;
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,2);
INSERT INTO t1 VALUES (3,3);
INSERT INTO t1 VALUES (4,4);
# Establish connection conn1 (user = root)
USE test2;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	SERIALIZABLE
SHOW VARIABLES LIKE 'falcon_consistent_read';
Variable_name	Value
falcon_consistent_read	OFF
START TRANSACTION;
SELECT * FROM t1;
a	b
1	1
2	2
3	3
4	4
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 11 WHERE a = 1;
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
# Establish connection conn2 (user = root)
USE test2;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	SERIALIZABLE
START TRANSACTION;
SELECT * FROM t1;
a	b
1	1
2	2
3	3
4	4
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 111 WHERE a = 1;
# Switch to conn1
COMMIT;
# Switch to conn2
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
SELECT * FROM t1;
a	b
1	111
2	2
3	3
4	4
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
COMMIT;
# Switch to conn1
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	READ-UNCOMMITTED
SHOW VARIABLES LIKE 'falcon_consistent_read';
Variable_name	Value
falcon_consistent_read	OFF
START TRANSACTION;
SELECT * FROM t1;
a	b
1	111
2	2
3	3
4	4
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 22 WHERE a = 2;
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
# Switch to conn2
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	READ-UNCOMMITTED
START TRANSACTION;
SELECT * FROM t1;
a	b
1	111
2	2
3	3
4	4
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 222 WHERE a = 2;
# Switch to conn1
COMMIT;
# Switch to conn2
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
SELECT * FROM t1;
a	b
1	111
2	222
3	3
4	4
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
COMMIT;
# Switch to default connection
SET GLOBAL FALCON_CONSISTENT_READ=ON;
# Establish connection conn3 (user = root)
USE test2;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	SERIALIZABLE
SHOW VARIABLES LIKE 'falcon_consistent_read';
Variable_name	Value
falcon_consistent_read	ON
START TRANSACTION;
SELECT * FROM t1;
a	b
1	111
2	222
3	3
4	4
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 33 WHERE a = 3;
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
# Establish connection conn4 (user = root)
USE test2;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	SERIALIZABLE
START TRANSACTION;
SELECT * FROM t1;
a	b
1	111
2	222
3	3
4	4
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 333 WHERE a = 3;
# Switch to conn3
COMMIT;
# Switch to conn4
ERROR HY000: Record has changed since last read in table 't1'
SELECT * FROM t1;
a	b
1	111
2	222
3	3
4	4
Warnings:
Warning	1568	Falcon does not support SERIALIZABLE ISOLATION, using REPEATABLE READ instead.
COMMIT;
# Switch to conn3
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	READ-UNCOMMITTED
SHOW VARIABLES LIKE 'falcon_consistent_read';
Variable_name	Value
falcon_consistent_read	ON
START TRANSACTION;
SELECT * FROM t1;
a	b
1	111
2	222
3	33
4	4
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 44 WHERE a = 4;
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
# Switch to conn4
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SHOW VARIABLES LIKE 'tx_isolation';
Variable_name	Value
tx_isolation	READ-UNCOMMITTED
START TRANSACTION;
SELECT * FROM t1;
a	b
1	111
2	222
3	33
4	4
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
UPDATE t1 SET b = 444 WHERE a = 4;
# Switch to conn3
COMMIT;
# Switch to conn4
ERROR HY000: Record has changed since last read in table 't1'
SELECT * FROM t1;
a	b
1	111
2	222
3	33
4	4
Warnings:
Warning	1568	Falcon does not support READ UNCOMMITTED ISOLATION, using REPEATABLE READ instead.
COMMIT;
SELECT * FROM t1;
a	b
1	111
2	222
3	33
4	44
# Switch to default connection and cleanup other connections
DROP DATABASE test2;
SET GLOBAL falcon_consistent_read = @previous_falcon_consistent_read;
USE test;
