mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#50479 DDL stmt on row-only/stmt-only tables generate spurious binlog_format
errors In the fix of BUG#39934 in 5.1-rep+3, errors are generated when binlog_format=row and a statement modifies a table restricted to statement-logging (ER_BINLOG_ROW_MODE_AND_STMT_ENGINE); or if binlog_format=statement and a statement modifies a table restricted to row-logging (ER_BINLOG_STMT_MODE_AND_ROW_ENGINE). However, some DDL statements that lock tables (e.g. ALTER TABLE, CREATE INDEX and CREATE TRIGGER) were causing spurious errors, although no row might be inserted into the binary log. To fix the problem, we tagged statements that may generate rows into the binary log and thence the warning messages are only printed out when the appropriate conditions hold and rows might be changed. sql/log_event.cc: Reorganized the Query_log_event's constructor based on the CF_CAN_GENERATE_ROW_EVENTS flag and as such any statement that has the associated flag should go through a cache before being written to the binary log. sql/share/errmsg-utf8.txt: Improved the error message ER_BINLOG_UNSAFE_MIXED_STATEMENT according to Paul's suggestion. sql/sql_class.cc: Created a hook to be used by innodb that checks if a statement may write rows to the binary log. In other words, if it has the CF_CAN_GENERATE_ROW_EVENTS flag associated. sql/sql_class.h: Defined the CF_CAN_GENERATE_ROW_EVENTS flag. sql/sql_parse.cc: Updated the sql_command_flags and added a function to check the CF_CAN_GENERATE_ROW_EVENTS. sql/sql_parse.h: Added a function to check the CF_CAN_GENERATE_ROW_EVENTS. storage/innobase/handler/ha_innodb.cc: Added a call to the hook thd_generates_rows(). storage/innobase/handler/ha_innodb.h: Defined an external reference to the hook thd_generates_rows().
This commit is contained in:
@ -8,14 +8,14 @@ INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe.
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
|
||||
The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
|
||||
*** Please look in binlog_multi_engine.test if you have a diff here ****
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
||||
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements that read from both transactional (or a temporary table of any engine type) and non-transactional tables and write to any of them are unsafe.
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
|
||||
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
||||
COMMIT;
|
||||
TRUNCATE t1m;
|
||||
|
Reference in New Issue
Block a user