summaryrefslogtreecommitdiff
path: root/mysql-test/t/log_tables.test
diff options
context:
space:
mode:
authorunknown <malff/marcsql@weblab.(none)>2007-10-11 17:55:18 -0600
committerunknown <malff/marcsql@weblab.(none)>2007-10-11 17:55:18 -0600
commit411eba91561ce69307dd23502cc06d03547fae8f (patch)
treeb20f8c12d76bebb755561439798675b5fd58d11f /mysql-test/t/log_tables.test
parent2940daab0c82106a1ef838e281f9acce0b67f994 (diff)
downloadmariadb-git-411eba91561ce69307dd23502cc06d03547fae8f.tar.gz
Bug#27858 (Failing to log to a log table doesn't log anything to error log)
Before this patch, failures to write to the log tables (mysql.slow_log and mysql.general_log) were improperly printed (the time was printed twice), or not printed at all. With this patch, failures to write to the log tables is reported in the error log, for all cases of failures. mysql-test/r/log_tables.result: Bug#27858 (Failing to log to a log table doesn't log anything to error log) mysql-test/t/log_tables.test: Bug#27858 (Failing to log to a log table doesn't log anything to error log) sql/log.cc: Bug#27858 (Failing to log to a log table doesn't log anything to error log)
Diffstat (limited to 'mysql-test/t/log_tables.test')
-rw-r--r--mysql-test/t/log_tables.test56
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index 89c7c255554..1d65c86295f 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -295,6 +295,13 @@ unlock tables;
# Bug #21785 Server crashes after rename of the log table
#
+--disable_warnings
+drop table if exists mysql.renamed_general_log;
+drop table if exists mysql.renamed_slow_log;
+drop table if exists mysql.general_log_new;
+drop table if exists mysql.slow_log_new;
+--enable_warnings
+
use mysql;
# Should result in error
--error ER_CANT_RENAME_LOG_TABLE
@@ -359,6 +366,55 @@ drop table renamed_general_log, renamed_slow_log;
use test;
#
+# Bug#27858 (Failing to log to a log table doesn't log anything to error log)
+#
+# This test works as expected, it's a negative test.
+# The message "[ERROR] Failed to write to mysql.general_log"
+# is printed to master.err when writing to the table mysql.general_log
+# failed.
+# However, this message is picked up by mysql-test-run.pl,
+# and reported as a test failure, which is a false negative.
+# There is no current way to *selectively* filter out these expected error conditions
+# (see mysql-test/lib/mtr_report.pl, mtr_report_stats()).
+# Instead of filtering all occurences of "Failed to write to
+# mysql.general_log", which could hide bugs when the error is not expected,
+# this test case is commented instead.
+# TODO: improve filtering of expected errors in master.err in
+# mysql-test-run.pl (based on the test name ?), and uncomment this test.
+
+# --disable_warnings
+# drop table if exists mysql.bad_general_log;
+# drop table if exists mysql.bad_slow_log;
+# drop table if exists mysql.general_log_hide;
+# drop table if exists mysql.slow_log_hide;
+# --enable_warnings
+#
+# create table mysql.bad_general_log (a int) engine= CSV;
+# create table mysql.bad_slow_log (a int) engine= CSV;
+#
+# # Rename does not perform checks on the table structure,
+# # exploiting this to force a failure to log
+# rename table mysql.general_log to mysql.general_log_hide, mysql.bad_general_log TO mysql.general_log;
+# rename table mysql.slow_log to mysql.slow_log_hide, mysql.bad_slow_log TO mysql.slow_log;
+#
+# # The following message should be printed in master.log:
+# # [ERROR] Failed to write to mysql.general_log
+# # TODO: See how verifying this could be automated
+#
+# flush tables;
+# select "logging this should fail";
+#
+# # Restore the log tables
+#
+# rename table mysql.general_log to mysql.bad_general_log, mysql.general_log_hide TO mysql.general_log;
+# rename table mysql.slow_log to mysql.bad_slow_log, mysql.slow_log_hide TO mysql.slow_log;
+#
+# flush tables;
+#
+# drop table mysql.bad_general_log;
+# drop table mysql.bad_slow_log;
+
+#
# Bug #21966 Strange warnings on repair of the log tables
#