2008-03-17 20:19:04 +02:00
|
|
|
#
|
|
|
|
# testing of purging of binary log files bug#18199/Bug#18453
|
|
|
|
#
|
|
|
|
source include/have_log_bin.inc;
|
|
|
|
source include/not_embedded.inc;
|
2009-12-08 16:03:19 +00:00
|
|
|
# Don't test this under valgrind, memory leaks will occur
|
|
|
|
--source include/not_valgrind.inc
|
2009-12-05 22:09:41 +00:00
|
|
|
source include/have_debug.inc;
|
2011-03-15 16:06:59 +01:00
|
|
|
# Avoid CrashReporter popup on Mac
|
|
|
|
--source include/not_crashrep.inc
|
2009-12-04 14:40:42 +00:00
|
|
|
call mtr.add_suppression('Attempting backtrace');
|
|
|
|
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
|
|
|
|
call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file');
|
|
|
|
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
|
|
|
call mtr.add_suppression('Could not open .*');
|
2009-12-04 14:40:42 +00:00
|
|
|
call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
|
2010-04-07 01:47:08 +03:00
|
|
|
flush tables;
|
|
|
|
|
2009-12-04 14:40:42 +00:00
|
|
|
let $old=`select @@debug`;
|
|
|
|
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
|
|
|
RESET MASTER;
|
|
|
|
|
2009-12-04 14:40:42 +00:00
|
|
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
|
|
|
let $INDEX=$MYSQLD_DATADIR/master-bin.index;
|
2008-03-17 20:19:04 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# testing purge binary logs TO
|
|
|
|
#
|
|
|
|
|
|
|
|
flush logs;
|
|
|
|
flush logs;
|
|
|
|
flush logs;
|
|
|
|
|
|
|
|
source include/show_binary_logs.inc;
|
2008-04-03 21:40:10 +02:00
|
|
|
remove_file $MYSQLD_DATADIR/master-bin.000001;
|
2010-03-20 15:12:53 +01:00
|
|
|
flush tables;
|
2008-03-17 20:19:04 +02:00
|
|
|
|
|
|
|
# there must be a warning with file names
|
2008-04-05 15:09:53 +04:00
|
|
|
replace_regex /\.[\\\/]master/master/;
|
2008-03-17 20:19:04 +02:00
|
|
|
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;
|
2008-04-03 21:40:10 +02:00
|
|
|
remove_file $MYSQLD_DATADIR/master-bin.000001;
|
2008-03-17 20:19:04 +02:00
|
|
|
|
|
|
|
--echo *** must be a warning master-bin.000001 was not found ***
|
|
|
|
let $date=`select NOW() + INTERVAL 1 MINUTE`;
|
|
|
|
--disable_query_log
|
2008-04-05 15:09:53 +04:00
|
|
|
replace_regex /\.[\\\/]master/master/;
|
2008-03-17 20:19:04 +02:00
|
|
|
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;
|
|
|
|
|
2008-04-03 21:40:10 +02:00
|
|
|
remove_file $MYSQLD_DATADIR/master-bin.000001;
|
|
|
|
mkdir $MYSQLD_DATADIR/master-bin.000001;
|
2008-03-17 20:19:04 +02:00
|
|
|
|
|
|
|
--error ER_BINLOG_PURGE_FATAL_ERR
|
|
|
|
purge binary logs TO 'master-bin.000002';
|
2008-04-05 15:09:53 +04:00
|
|
|
replace_regex /\.[\\\/]master/master/;
|
2008-03-17 20:19:04 +02:00
|
|
|
show warnings;
|
2008-04-03 21:40:10 +02:00
|
|
|
rmdir $MYSQLD_DATADIR/master-bin.000001;
|
2008-03-17 20:19:04 +02:00
|
|
|
--disable_warnings
|
|
|
|
reset master;
|
|
|
|
--enable_warnings
|
2009-12-04 14:40:42 +00:00
|
|
|
|
|
|
|
--echo # crash_purge_before_update_index
|
|
|
|
flush logs;
|
|
|
|
|
|
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,crash_purge_before_update_index";
|
2009-12-04 14:40:42 +00:00
|
|
|
--error 2013
|
|
|
|
purge binary logs TO 'master-bin.000002';
|
|
|
|
|
|
|
|
--enable_reconnect
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000001;
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000002;
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000003;
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
|
|
|
--echo # crash_purge_non_critical_after_update_index
|
|
|
|
flush logs;
|
|
|
|
|
|
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,crash_purge_non_critical_after_update_index";
|
2009-12-04 14:40:42 +00:00
|
|
|
--error 2013
|
|
|
|
purge binary logs TO 'master-bin.000004';
|
|
|
|
|
|
|
|
--enable_reconnect
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000001;
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000002;
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000003;
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
|
|
|
--echo # crash_purge_critical_after_update_index
|
|
|
|
flush logs;
|
|
|
|
|
|
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,crash_purge_critical_after_update_index";
|
2009-12-04 14:40:42 +00:00
|
|
|
--error 2013
|
|
|
|
purge binary logs TO 'master-bin.000006';
|
|
|
|
|
|
|
|
--enable_reconnect
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000004;
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000005;
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000006;
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000007;
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000008;
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
|
|
|
--echo # crash_create_non_critical_before_update_index
|
|
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,crash_create_non_critical_before_update_index";
|
2009-12-04 14:40:42 +00:00
|
|
|
--error 2013
|
|
|
|
flush logs;
|
|
|
|
|
|
|
|
--enable_reconnect
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000008;
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000009;
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
|
|
|
--echo # crash_create_critical_before_update_index
|
|
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,crash_create_critical_before_update_index";
|
2009-12-04 14:40:42 +00:00
|
|
|
--error 2013
|
|
|
|
flush logs;
|
|
|
|
|
|
|
|
--enable_reconnect
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000009;
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000010;
|
|
|
|
--error 1
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000011;
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
|
|
|
--echo # crash_create_after_update_index
|
|
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,crash_create_after_update_index";
|
2009-12-04 14:40:42 +00:00
|
|
|
--error 2013
|
|
|
|
flush logs;
|
|
|
|
|
|
|
|
--enable_reconnect
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000010;
|
|
|
|
file_exists $MYSQLD_DATADIR/master-bin.000011;
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # This should put the server in unsafe state and stop
|
|
|
|
--echo # accepting any command. If we inject a fault at this
|
|
|
|
--echo # point and continue the execution the server crashes.
|
|
|
|
--echo #
|
|
|
|
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
2009-12-04 14:40:42 +00:00
|
|
|
--echo # fault_injection_registering_index
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,fault_injection_registering_index";
|
2010-12-17 01:17:03 +00:00
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
|
|
|
-- error ER_CANT_OPEN_FILE
|
2009-12-04 14:40:42 +00:00
|
|
|
flush logs;
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
|
|
|
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
2009-12-04 14:40:42 +00:00
|
|
|
--source include/restart_mysqld.inc
|
|
|
|
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
|
|
|
--echo # fault_injection_updating_index
|
2011-12-15 22:07:58 +01:00
|
|
|
SET SESSION debug_dbug="+d,fault_injection_updating_index";
|
2010-12-17 01:17:03 +00:00
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
|
|
|
-- error ER_CANT_OPEN_FILE
|
2009-12-04 14:40:42 +00:00
|
|
|
flush logs;
|
BUG#46166: MYSQL_BIN_LOG::new_file_impl is not propagating error
when generating new name.
If find_uniq_filename returns an error, then this error is not
being propagated upwards, and execution does not report error to
the user (although a entry in the error log is generated).
Additionally, some more errors were ignored in new_file_impl:
- when writing the rotate event
- when reopening the index and binary log file
This patch addresses this by propagating the error up in the
execution stack. Furthermore, when rotation of the binary log
fails, an incident event is written, because there may be a
chance that some changes for a given statement, were not properly
logged. For example, in SBR, LOAD DATA INFILE statement requires
more than one event to be logged, should rotation fail while
logging part of the LOAD DATA events, then the logged data would
become inconsistent with the data in the storage engine.
mysql-test/include/restart_mysqld.inc:
Refactored restart_mysqld so that it is not hardcoded for
mysqld.1, but rather for the current server.
mysql-test/suite/binlog/t/binlog_index.test:
The error on open of index and binary log on new_file_impl
is now caught. Thence the user will get an error message.
We need to accomodate this change in the test case for the
failing FLUSH LOGS.
mysql-test/suite/rpl/t/rpl_binlog_errors-master.opt:
Sets max_binlog_size to 4096.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
Added some test cases for asserting that the error is found
and reported.
sql/handler.cc:
Catching error now returned by unlog (in ha_commit_trans) and
returning it.
sql/log.cc:
Propagating errors from new_file_impl upwards. The errors that
new_file_impl catches now are:
- error on generate_new_name
- error on writing the rotate event
- error when opening the index or the binary log file.
sql/log.h:
Changing declaration of:
- rotate_and_purge
- new_file
- new_file_without_locking
- new_file_impl
- unlog
They now return int instead of void.
sql/mysql_priv.h:
Change signature of reload_acl_and_cache so that write_to_binlog
is an int instead of bool.
sql/mysqld.cc:
Redeclaring not_used var as int instead of bool.
sql/rpl_injector.cc:
Changes to catch the return from rotate_and_purge.
sql/slave.cc:
Changes to catch the return values for new_file and rotate_relay_log.
sql/slave.h:
Changes to rotate_relay_log declaration (now returns int
instead of void).
sql/sql_load.cc:
In SBR, some logging of LOAD DATA events goes through
IO_CACHE_CALLBACK invocation at mf_iocache.c:_my_b_get. The
IO_CACHE implementation is ignoring the return value for from
these callbacks (pre_read and post_read), so we need to find out
at the end of the execution if the error is set or not in THD.
sql/sql_parse.cc:
Catching the rotate_relay_log and rotate_and_purge return values.
Semantic change in reload_acl_and_cache so that we report errors
in binlog interactions through the write_to_binlog output parameter.
If there was any failure while rotating the binary log, we should
then report the error to the client when handling SQLCOMM_FLUSH.
2010-11-30 23:32:51 +00:00
|
|
|
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
2009-12-04 14:40:42 +00:00
|
|
|
--source include/restart_mysqld.inc
|
|
|
|
|
|
|
|
--chmod 0644 $INDEX
|
|
|
|
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
|
|
-- eval SET @index=LOAD_FILE('$index')
|
|
|
|
-- replace_regex /\.[\\\/]master/master/
|
|
|
|
SELECT @index;
|
|
|
|
|
2011-12-15 22:07:58 +01:00
|
|
|
eval SET SESSION debug_dbug="$old";
|
2009-12-04 14:40:42 +00:00
|
|
|
|
2008-03-17 20:19:04 +02:00
|
|
|
--echo End of tests
|