summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2009-06-27 14:18:47 +0100
committerLuis Soares <luis.soares@sun.com>2009-06-27 14:18:47 +0100
commit92536e421321f49abad66f0bd53aa0315fd20ec6 (patch)
treee3c206f742bfa80b43f50ad33e91da0fc18a3fc3 /mysql-test/suite/binlog
parent4c1333e6edc45bd10a23fa836f82d8b59d623fd5 (diff)
downloadmariadb-git-92536e421321f49abad66f0bd53aa0315fd20ec6.tar.gz
BUG#42851: Spurious "Statement is not safe to log in statement
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.
Diffstat (limited to 'mysql-test/suite/binlog')
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result30
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test73
3 files changed, 104 insertions, 0 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
new file mode 100644
index 00000000000..439bff0cfe1
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
@@ -0,0 +1,30 @@
+### 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;
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
new file mode 100644
index 00000000000..24c2027e399
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
@@ -0,0 +1 @@
+--binlog-ignore-db=b42851
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
new file mode 100644
index 00000000000..0bf685ea921
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
@@ -0,0 +1,73 @@
+# 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;