1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
SET @saved_value_super= @@GLOBAL.SUPER_READ_ONLY;
SET @saved_value= @@GLOBAL.read_only;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
include/save_binlog_position.inc
BEGIN;
UPDATE t1 SET a = 1;
SET GLOBAL SUPER_READ_ONLY=1;
COMMIT;
ERROR HY000: The MySQL server is running with the --super-read-only option so it cannot execute this statement
include/assert.inc [Binlog position did not advance]
check RO transaction still commits
BEGIN;
SELECT * FROM t1;
a
1
COMMIT;
check RO txs still can use implicit temporary tables
BEGIN;
SELECT * FROM t1 UNION SELECT * FROM t1;
a
1
COMMIT;
SET GLOBAL SUPER_READ_ONLY=0;
CREATE TEMPORARY TABLE t2 (a INT ) ENGINE=INNODB;
include/save_binlog_position.inc
BEGIN;
UPDATE t1 SET a = 1;
INSERT INTO t2 values(10);
SET GLOBAL SUPER_READ_ONLY=1;
COMMIT;
ERROR HY000: The MySQL server is running with the --super-read-only option so it cannot execute this statement
include/assert.inc [Binlog position did not advance]
DROP TABLE t2;
SET GLOBAL SUPER_READ_ONLY=0;
SET GLOBAL READ_ONLY=0;
CREATE USER test@localhost;
GRANT CREATE TEMPORARY TABLES, UPDATE, DROP ON *.* TO test@localhost;
include/save_binlog_position.inc
BEGIN;
UPDATE t1 SET a = 1;
SET GLOBAL READ_ONLY=1;
COMMIT;
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
include/assert.inc [Binlog position did not advance]
SET GLOBAL READ_ONLY=0;
CREATE TEMPORARY TABLE t2 (a INT) ENGINE=INNODB;
include/save_binlog_position.inc
BEGIN;
UPDATE t1 SET a = 1;
INSERT INTO t2 values(10);
SET GLOBAL READ_ONLY=1;
COMMIT;
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
include/assert.inc [Binlog position did not advance]
DROP TABLE t2;
DROP USER test@localhost;
SET GLOBAL SUPER_READ_ONLY= @saved_value_super;
SET GLOBAL read_only= @saved_value;
DROP TABLE t1;
|