mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 12:01:42 +01:00
92536e4213
format." warnings Despite the fact that a statement would be filtered out from binlog, a warning would still be thrown if it was issued with the LIMIT. This patch addresses this issue by checking the filtering rules before printing out the warning.
73 lines
1.9 KiB
Text
73 lines
1.9 KiB
Text
# BUG#42851: Spurious "Statement is not safe to log in statement
|
|
# format." warnings
|
|
#
|
|
# WHY
|
|
# ===
|
|
#
|
|
# This test aims at checking that the fix that removes spurious
|
|
# entries in the error log when the statement is filtered out from
|
|
# binlog, is working.
|
|
#
|
|
# HOW
|
|
# ===
|
|
#
|
|
# The test case is split into three assertions when issuing statements
|
|
# containing LIMIT and ORDER BY:
|
|
#
|
|
# i) issue statements in database that is not filtered => check
|
|
# that warnings ARE shown;
|
|
#
|
|
# ii) issue statements in database that is not filtered, but with
|
|
# binlog disabled => check that warnings ARE NOT shown;
|
|
#
|
|
# iii) issue statements in database that is filtered => check that
|
|
# warnings ARE NOT shown.
|
|
|
|
-- source include/have_log_bin.inc
|
|
-- source include/have_binlog_format_statement.inc
|
|
|
|
-- echo ### NOT filtered database => assertion: warnings ARE shown
|
|
|
|
-- disable_warnings
|
|
DROP TABLE IF EXISTS t1;
|
|
-- enable_warnings
|
|
|
|
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;
|
|
|
|
-- echo ### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown
|
|
|
|
SET SQL_LOG_BIN= 0;
|
|
|
|
-- disable_warnings
|
|
DROP TABLE IF EXISTS t1;
|
|
-- enable_warnings
|
|
|
|
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;
|
|
|
|
-- echo ### FILTERED database => assertion: warnings ARE NOT shown
|
|
|
|
CREATE DATABASE b42851;
|
|
USE b42851;
|
|
|
|
-- disable_warnings
|
|
DROP TABLE IF EXISTS t1;
|
|
-- enable_warnings
|
|
|
|
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;
|
|
|
|
# clean up
|
|
DROP DATABASE b42851;
|