mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 07:44:22 +01:00
e1c43705b9
If using statement based replication (SBR), repeatedly calling statements which are unsafe for SBR will cause a warning message to be written to the error for each statement. This might lead to filling up the error log and there is no way to disable this behavior. The solution is to only log these message (about statements unsafe for statement based replication) if the log_warnings option is set. For example: SET GLOBAL LOG_WARNINGS = 0; INSERT INTO t1 VALUES(UUID()); SET GLOBAL LOG_WARNINGS = 1; INSERT INTO t1 VALUES(UUID()); In this case the message will be printed only once: [Warning] Statement may not be safe to log in statement format. Statement: INSERT INTO t1 VALUES(UUID())
50 lines
1.7 KiB
Text
50 lines
1.7 KiB
Text
### NOT filtered database => assertion: warnings ARE shown
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (a int, b int, primary key (a));
|
|
INSERT INTO t1 VALUES (1,2), (2,3);
|
|
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
DROP TABLE t1;
|
|
### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown
|
|
SET SQL_LOG_BIN= 0;
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (a int, b int, primary key (a));
|
|
INSERT INTO t1 VALUES (1,2), (2,3);
|
|
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
|
|
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
|
|
DROP TABLE t1;
|
|
SET SQL_LOG_BIN= 1;
|
|
### FILTERED database => assertion: warnings ARE NOT shown
|
|
CREATE DATABASE b42851;
|
|
USE b42851;
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (a int, b int, primary key (a));
|
|
INSERT INTO t1 VALUES (1,2), (2,3);
|
|
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
|
|
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
|
|
DROP TABLE t1;
|
|
DROP DATABASE b42851;
|
|
USE test;
|
|
#
|
|
# Bug#46265: Can not disable warning about unsafe statements for binary logging
|
|
#
|
|
SET @old_log_warnings = @@log_warnings;
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
|
|
SET GLOBAL LOG_WARNINGS = 0;
|
|
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
SET GLOBAL LOG_WARNINGS = 1;
|
|
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
|
|
Warnings:
|
|
Note 1592 Statement may not be safe to log in statement format.
|
|
DROP TABLE t1;
|
|
SET GLOBAL log_warnings = @old_log_warnings;
|
|
# Count the number of times the "Unsafe" message was printed
|
|
# to the error log.
|
|
Occurrences: 1
|