summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2009-09-08 00:50:10 +0400
committerSergey Petrunya <psergey@askmonty.org>2009-09-08 00:50:10 +0400
commit29f0dcb56337a3e352ad7a70dcff6b25bb605325 (patch)
tree84935c21dc958724ae7dcbeeca0c0f08986fc430 /mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
parent915a624cbcb58a10a2cfb2e2e4fd5029191fa86a (diff)
parent8a2454f8e9fce648272577fcf8006ae6e6806cf9 (diff)
downloadmariadb-git-29f0dcb56337a3e352ad7a70dcff6b25bb605325.tar.gz
Merge MySQL->MariaDB
* Finished Monty and Jani's merge * Some InnoDB tests still fail (because it's old xtradb code run against newer testsuite). They are expected to go after mergning with the latest xtradb.
Diffstat (limited to 'mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test')
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test108
1 files changed, 108 insertions, 0 deletions
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..a5472952f08
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
@@ -0,0 +1,108 @@
+# 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
+
+let $old_db= `SELECT DATABASE()`;
+
+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;
+
+eval USE $old_db;
+
+--echo #
+--echo # Bug#46265: Can not disable warning about unsafe statements for binary logging
+--echo #
+
+SET @old_log_warnings = @@log_warnings;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
+SET GLOBAL LOG_WARNINGS = 0;
+INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
+SET GLOBAL LOG_WARNINGS = 1;
+INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
+DROP TABLE t1;
+
+SET GLOBAL log_warnings = @old_log_warnings;
+
+let LOG_ERROR= `SELECT @@GLOBAL.log_error`;
+
+--echo # Count the number of times the "Unsafe" message was printed
+--echo # to the error log.
+
+perl;
+ $log_error= $ENV{'LOG_ERROR'};
+ open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
+ $count = () = grep(/Bug#46265/g,<FILE>);
+ print "Occurrences: $count\n";
+ close(FILE);
+EOF