Browse Source
Bug #18199 PURGE BINARY LOGS fails silently with missing logs;
Bug #18199 PURGE BINARY LOGS fails silently with missing logs;
Bug #18453 Warning/error message if there is a mismatch between ... There were three problems: 1. the reported lack of warnings for the BEFORE syntax of PURGE; 2. the similar lack of warnings for the TO syntax; 3. incompatible behaviour between the two in that the latter blanked out regardlessly of presence or lack the actual file corresponding to an index record; the former version gave up at the first mismatch. fixed with deploying the warning's generation and synronizing logics of purge_logs() and purge_logs_before_date(). my_stat() is called in either of two branches of purge_logs() (responsible for the TO syntax of PURGE) similarly to how it has behaved in the BEFORE syntax. If there is no actual binlog file, my_stat returns NULL and my_delete is not invoked. A critical error is reported to the user if a file from the index could not be retrieved info about or deleted with a system error code different than ENOENT. sql/log.cc: generating warning in two functions. refining logics to call my_stat() by purge_logs() as it happens in purge_logs_before_date(). my_delete() is called only if my_stat() ensured existance of the file. A critical error is reported to the user if a file from the index could not be my_stat():ed or my_delete():d with an error different than ENOENT. sql/share/errmsg.txt: new error message mysql-test/include/show_binary_logs.inc: a new macro - shortcut of show binary logs mysql-test/r/binlog_index.result: new results mysql-test/t/binlog_index.test: a regression test for the bugspull/374/head
5 changed files with 240 additions and 26 deletions
-
3mysql-test/include/show_binary_logs.inc
-
39mysql-test/r/binlog_index.result
-
69mysql-test/t/binlog_index.test
-
153sql/log.cc
-
2sql/share/errmsg.txt
@ -0,0 +1,3 @@ |
|||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
|||
--replace_column 2 # |
|||
show binary logs; |
|||
@ -0,0 +1,39 @@ |
|||
flush logs; |
|||
flush logs; |
|||
flush logs; |
|||
show binary logs; |
|||
Log_name File_size |
|||
master-bin.000001 # |
|||
master-bin.000002 # |
|||
master-bin.000003 # |
|||
master-bin.000004 # |
|||
purge binary logs TO 'master-bin.000004'; |
|||
Warnings: |
|||
Warning 1476 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found |
|||
*** must show a list starting from the 'TO' argument of PURGE *** |
|||
show binary logs; |
|||
Log_name File_size |
|||
master-bin.000004 # |
|||
reset master; |
|||
flush logs; |
|||
flush logs; |
|||
flush logs; |
|||
*** must be a warning master-bin.000001 was not found *** |
|||
Warnings: |
|||
Warning 1476 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found |
|||
*** must show one record, of the active binlog, left in the index file after PURGE *** |
|||
show binary logs; |
|||
Log_name File_size |
|||
master-bin.000004 # |
|||
reset master; |
|||
flush logs; |
|||
flush logs; |
|||
flush logs; |
|||
purge binary logs TO 'master-bin.000002'; |
|||
ERROR HY000: Fatal error during log purge |
|||
show warnings; |
|||
Level Code Message |
|||
Error 1377 a problem with deleting MYSQLTEST_VARDIR/log/master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files |
|||
Error 1377 Fatal error during log purge |
|||
reset master; |
|||
End of tests |
|||
@ -0,0 +1,69 @@ |
|||
# |
|||
# testing of purging of binary log files bug#18199/Bug#18453 |
|||
# |
|||
source include/have_log_bin.inc; |
|||
source include/not_embedded.inc; |
|||
|
|||
# |
|||
# testing purge binary logs TO |
|||
# |
|||
|
|||
flush logs; |
|||
flush logs; |
|||
flush logs; |
|||
|
|||
source include/show_binary_logs.inc; |
|||
|
|||
remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; |
|||
|
|||
# there must be a warning with file names |
|||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
|||
purge binary logs TO 'master-bin.000004'; |
|||
|
|||
--echo *** must show a list starting from the 'TO' argument of PURGE *** |
|||
source include/show_binary_logs.inc; |
|||
|
|||
# |
|||
# testing purge binary logs BEFORE |
|||
# |
|||
|
|||
reset master; |
|||
|
|||
flush logs; |
|||
flush logs; |
|||
flush logs; |
|||
remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; |
|||
|
|||
--echo *** must be a warning master-bin.000001 was not found *** |
|||
let $date=`select NOW() + INTERVAL 1 MINUTE`; |
|||
--disable_query_log |
|||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
|||
eval purge binary logs BEFORE '$date'; |
|||
--enable_query_log |
|||
|
|||
--echo *** must show one record, of the active binlog, left in the index file after PURGE *** |
|||
source include/show_binary_logs.inc; |
|||
|
|||
# |
|||
# testing a fatal error |
|||
# Turning a binlog file into a directory must be a portable setup |
|||
# |
|||
|
|||
reset master; |
|||
|
|||
flush logs; |
|||
flush logs; |
|||
flush logs; |
|||
|
|||
remove_file $MYSQLTEST_VARDIR/log/master-bin.000001; |
|||
mkdir $MYSQLTEST_VARDIR/log/master-bin.000001; |
|||
|
|||
--error ER_BINLOG_PURGE_FATAL_ERR |
|||
purge binary logs TO 'master-bin.000002'; |
|||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
|||
show warnings; |
|||
rmdir $MYSQLTEST_VARDIR/log/master-bin.000001; |
|||
--disable_warnings |
|||
reset master; |
|||
--enable_warnings |
|||
--echo End of tests |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue