mirror of
https://github.com/MariaDB/server.git
synced 2025-05-07 04:01:59 +03:00
In RBR, DDL statement will change binlog format to non row-based format before it is binlogged, but the binlog format was not be restored, and then manipulating a temporary table can not reset binlog format to row-based format rightly. So that the manipulated statement is binlogged with statement-based format. To fix the problem, restore the state of binlog format after the DDL statement is binlogged. mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test: Added the test file to verify if executing DDL statement before trying to manipulate a temporary table causes row-based replication to break with error 'table does not exist'. mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Correct the test result, all the above binlog event should be row-based after the bug49132 is fixed IN RBR. mysql-test/suite/ndb/r/ndb_tmp_table_and_DDL.result: Test result for bug#49132 base on ndb engine. mysql-test/suite/ndb/t/ndb_tmp_table_and_DDL.test: Added the test file to verify if executing DDL statement before trying to manipulate a temporary table causes row-based replication to break with error 'table does not exist' base on ndb engine. mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result: Test result for bug#49132 base on myisam engine. mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test: Added the test file to verify if executing DDL statement before trying to manipulate a temporary table causes row-based replication to break with error 'table does not exist' base on myisam engine. sql/event_db_repository.cc: Added code to restore the state of binlog format after the DDL statement is binlogged. sql/events.cc: Added code to restore the state of binlog format after the DDL statement is binlogged. sql/sp.cc: Added code to restore the state of binlog format after the DDL statement is binlogged. sql/sql_acl.cc: Added code to restore the state of binlog format after the DDL statement is binlogged. sql/sql_udf.cc: Added code to restore the state of binlog format after the DDL statement is binlogged.
91 lines
3.1 KiB
Plaintext
91 lines
3.1 KiB
Plaintext
CREATE TEMPORARY TABLE t1 (a INT);
|
|
CREATE TABLE t2 (a INT, b INT) ENGINE= NDB;
|
|
INSERT INTO t1 VALUES (1);
|
|
CREATE EVENT e1 ON SCHEDULE EVERY 10 HOUR DO SELECT 1;
|
|
INSERT INTO t1 VALUES (1);
|
|
ALTER EVENT e1 ON SCHEDULE EVERY 20 HOUR DO SELECT 1;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP EVENT IF EXISTS e1;
|
|
INSERT INTO t1 VALUES (1);
|
|
CREATE PROCEDURE p1() SELECT 1;
|
|
INSERT INTO t1 VALUES (1);
|
|
ALTER PROCEDURE p1 SQL SECURITY INVOKER;
|
|
INSERT INTO t1 VALUES (1);
|
|
CREATE FUNCTION f1() RETURNS INT RETURN 123;
|
|
INSERT INTO t1 VALUES (1);
|
|
ALTER FUNCTION f1 SQL SECURITY INVOKER;
|
|
INSERT INTO t1 VALUES (1);
|
|
CREATE DATABASE mysqltest1;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP DATABASE mysqltest1;
|
|
INSERT INTO t1 VALUES (1);
|
|
CREATE USER test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
GRANT SELECT ON t2 TO test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
GRANT ALL ON f1 TO test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
GRANT ALL ON p1 TO test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
GRANT USAGE ON *.* TO test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
REVOKE ALL PRIVILEGES ON f1 FROM test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
REVOKE ALL PRIVILEGES ON p1 FROM test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
REVOKE ALL PRIVILEGES ON t2 FROM test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
REVOKE USAGE ON *.* FROM test_1@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
RENAME USER test_1@localhost TO test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP USER test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
CREATE PROCEDURE p2()
|
|
BEGIN
|
|
# CREATE USER when a temporary table is open.
|
|
CREATE TEMPORARY TABLE t3 (a INT);
|
|
CREATE USER test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# GRANT select on table to user when a temporary table is open.
|
|
GRANT SELECT ON t2 TO test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# GRANT all on function to user when a temporary table is open.
|
|
GRANT ALL ON f1 TO test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# GRANT all on procedure to user when a temporary table is open.
|
|
GRANT ALL ON p1 TO test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# GRANT usage on *.* to user when a temporary table is open.
|
|
GRANT USAGE ON *.* TO test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# REVOKE ALL PRIVILEGES on function to user when a temporary table is open.
|
|
REVOKE ALL PRIVILEGES ON f1 FROM test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# REVOKE ALL PRIVILEGES on procedure to user when a temporary table is open.
|
|
REVOKE ALL PRIVILEGES ON p1 FROM test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# REVOKE ALL PRIVILEGES on table to user when a temporary table is open.
|
|
REVOKE ALL PRIVILEGES ON t2 FROM test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# REVOKE usage on *.* from user when a temporary table is open.
|
|
REVOKE USAGE ON *.* FROM test_2@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# RENAME USER when a temporary table is open.
|
|
RENAME USER test_2@localhost TO test_3@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
# DROP USER when a temporary table is open.
|
|
DROP USER test_3@localhost;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP TEMPORARY TABLE t3;
|
|
END |
|
|
DROP PROCEDURE p1;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP PROCEDURE p2;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP FUNCTION f1;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP TABLE t2;
|
|
INSERT INTO t1 VALUES (1);
|
|
DROP TEMPORARY TABLE t1;
|