-
Daogang Qu authored
1. Allow CREATE/DROP TEMPORARY TABLE inside a transaction when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. (More specifically, we allow the statements when @@global.enforce_gtid_consistency=ON, which then implies that it is allowed when @@global.gtid_mode=ON). Suppose user executes the following transactions: BEGIN; CREATE TEMPORARY TABLE t (a INT); COMMIT; BEGIN; DROP TEMPORARY TABLE t (a INT); COMMIT; Then both transactions shall succeed and not be written to the binary log. Suppose user executes the following transactions: BEGIN; DML on a non-temporary table; CREATE TEMPORARY TABLE t (a INT); COMMIT; BEGIN; DML on a non-temporary table; DROP TEMPORARY TABLE t (a INT); COMMIT; Then, both transactions shall succeed, be written to the binary log without the CREATE/DROP TEMPORARY TABLE statements, and replicate to the slave. Slave_open_temp_tables shall be 0 before, between, and after the two transactions. Suppose user executes the following transactions: BEGIN; CREATE TEMPORARY TABLE t (a INT); ROLLBACK; BEGIN; DROP TEMPORARY TABLE t (a INT); ROLLBACK; BEGIN; DML on a non-temporary table; CREATE TEMPORARY TABLE temp1 (a INT); DML on a temporary table; ROLLBACK; BEGIN; DML on a non-temporary table; DML on a temporary table; DROP TEMPORARY TABLE temp1 (a INT); ROLLBACK; After rollback, any above transaction shall roll back with a warning "The creation of some temporary tables could not be rolled back.", and not be written to the binary log. 2. Allow CREATE/DROP TEMPORARY TABLE inside a PROCDURE when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. Suppose user creates the following single statement procedures: delimiter //; CREATE PROCEDURE sp1 () BEGIN CREATE TEMPORARY TABLE temp1 (i INT); END// CREATE PROCEDURE sp2 () BEGIN DROP TEMPORARY TABLE temp1; END// delimiter ;// CREATE/DROP TEMPORARY TABLE shall not be written to the binary log when calling the two procedures. Suppose user creates the following multi statements procedures: CREATE TABLE t1 (c1 INT); delimiter //; CREATE PROCEDURE sp3 () BEGIN INSERT INTO t1 VALUES (9); CREATE TEMPORARY TABLE temp1 (i INT); INSERT INTO temp1 VALUES (1); END// CREATE PROCEDURE sp4 () BEGIN INSERT INTO t1 VALUES (10); INSERT INTO temp1 VALUES (2); DROP TEMPORARY TABLE temp1; END// delimiter ;// CREATE/DROP TEMPORARY TABLE shall not be written to the binary log when calling the two procedures. 3. Allow CREATE/DROP TEMPORARY TABLE inside a FUNCTION when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. CREATE/DROP TEMPORARY TABLE in the FUNCTION are not written into binlog when using the FUNCTION in SELECT QUERY and in INSERT/UPDATE/DELETE QUERY. 4. Allow CREATE/DROP TEMPORARY TABLE inside a TRIGGER when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. CREATE/DROP TEMPORARY TABLE in the TRIGGER are not written into binlog when the TRIGGER is triggered before/after INSERT/UPDATE/DELETE QUERY.
Daogang Qu authored1. Allow CREATE/DROP TEMPORARY TABLE inside a transaction when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. (More specifically, we allow the statements when @@global.enforce_gtid_consistency=ON, which then implies that it is allowed when @@global.gtid_mode=ON). Suppose user executes the following transactions: BEGIN; CREATE TEMPORARY TABLE t (a INT); COMMIT; BEGIN; DROP TEMPORARY TABLE t (a INT); COMMIT; Then both transactions shall succeed and not be written to the binary log. Suppose user executes the following transactions: BEGIN; DML on a non-temporary table; CREATE TEMPORARY TABLE t (a INT); COMMIT; BEGIN; DML on a non-temporary table; DROP TEMPORARY TABLE t (a INT); COMMIT; Then, both transactions shall succeed, be written to the binary log without the CREATE/DROP TEMPORARY TABLE statements, and replicate to the slave. Slave_open_temp_tables shall be 0 before, between, and after the two transactions. Suppose user executes the following transactions: BEGIN; CREATE TEMPORARY TABLE t (a INT); ROLLBACK; BEGIN; DROP TEMPORARY TABLE t (a INT); ROLLBACK; BEGIN; DML on a non-temporary table; CREATE TEMPORARY TABLE temp1 (a INT); DML on a temporary table; ROLLBACK; BEGIN; DML on a non-temporary table; DML on a temporary table; DROP TEMPORARY TABLE temp1 (a INT); ROLLBACK; After rollback, any above transaction shall roll back with a warning "The creation of some temporary tables could not be rolled back.", and not be written to the binary log. 2. Allow CREATE/DROP TEMPORARY TABLE inside a PROCDURE when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. Suppose user creates the following single statement procedures: delimiter //; CREATE PROCEDURE sp1 () BEGIN CREATE TEMPORARY TABLE temp1 (i INT); END// CREATE PROCEDURE sp2 () BEGIN DROP TEMPORARY TABLE temp1; END// delimiter ;// CREATE/DROP TEMPORARY TABLE shall not be written to the binary log when calling the two procedures. Suppose user creates the following multi statements procedures: CREATE TABLE t1 (c1 INT); delimiter //; CREATE PROCEDURE sp3 () BEGIN INSERT INTO t1 VALUES (9); CREATE TEMPORARY TABLE temp1 (i INT); INSERT INTO temp1 VALUES (1); END// CREATE PROCEDURE sp4 () BEGIN INSERT INTO t1 VALUES (10); INSERT INTO temp1 VALUES (2); DROP TEMPORARY TABLE temp1; END// delimiter ;// CREATE/DROP TEMPORARY TABLE shall not be written to the binary log when calling the two procedures. 3. Allow CREATE/DROP TEMPORARY TABLE inside a FUNCTION when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. CREATE/DROP TEMPORARY TABLE in the FUNCTION are not written into binlog when using the FUNCTION in SELECT QUERY and in INSERT/UPDATE/DELETE QUERY. 4. Allow CREATE/DROP TEMPORARY TABLE inside a TRIGGER when @@global.gtid_mode=ON and @@session.binlog_format=ROW/MIXED. CREATE/DROP TEMPORARY TABLE in the TRIGGER are not written into binlog when the TRIGGER is triggered before/after INSERT/UPDATE/DELETE QUERY.
Loading