Bug #46166 | MYSQL_BIN_LOG::new_file_impl is not propagating error when generating new name. | ||
---|---|---|---|
Submitted: | 14 Jul 2009 11:19 | Modified: | 18 Dec 2010 22:51 |
Reporter: | Luis Soares | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S3 (Non-critical) |
Version: | 5.1, 5.4 | OS: | Any |
Assigned to: | Luis Soares | CPU Architecture: | Any |
[14 Jul 2009 11:19]
Luis Soares
[14 Jul 2009 11:20]
Luis Soares
This bug needs fix for BUG#37148.
[23 Jul 2009 14:49]
Luis Soares
See also BUG#40611.
[12 Nov 2009 17:33]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/90269 3139 Luis Soares 2009-11-12 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). This patch addresses this by propagating the error up in the execution stack. Additionally, when rotation fails, mysqld stops accepting new commands by raising BINLOGGING IMPOSSIBLE error. Then the super user is only allowed to disable binary log and proceed to do some recovery or forensics operations. In detail: - Ongoing statements 1. first statement causing rotation failure sets an invalid flag and raises error (NO UNIQ FILENAME). For transactional statements, at commit time a commit is performed (ie, change data) and events are written to the binlog. Then error is reported back regarding failure to rotate. If statement is non-transactional, then it changes the database and writes event to the binlog. 2. Subsequent stmts notice that invalid flag was set but only when writing to the binlog. At that time, they fail and return error (BINLOGGING IMPOSSIBLE) without writing to the binlog. - New statements (after rotation failed) 1. Fail immediately on mysql_execute_command with BINLOGGING IMPOSSIBLE error, thence statements are not even executed. One exception to the rule: if user is super then we allow one command (SET ...) so that he can turn off binlogging and proceed with forensics analysis/repair. This patch is even more important after BUG 40611 is completely backported. It also requires BUG 37148 patch. @ mysql-test/suite/binlog/r/binlog_uniq_filename.result Result file. @ mysql-test/suite/binlog/t/binlog_uniq_filename-master.opt Limit binlog size to 4096. @ mysql-test/suite/binlog/t/binlog_uniq_filename.test Test case. @ sql/handler.cc Added error propagation when rotate_and_purge fail inside unlog method. @ sql/log.cc Added invalid_flags (re)setting. Added check point for evaluating invalid_flags when trying to write to the binlog. Added error propagation for rotate_and_purge. @ sql/log.h Added invalig_flags and changed signature of rotate_and_purge so that it returns an error. @ sql/rpl_injector.cc Added propagation of rotate errors. @ sql/slave.cc Added propagation of rotate errors. @ sql/slave.h Changed signature of rotate_relay_log so that it returns error. @ sql/sql_load.cc Added error propagation for write_execute_load_query_log_event (should be redundant after BUG 37148). @ sql/sql_parse.cc Added blocking point in mysql_execute_command. Added error propagation for rotate_and_purge and rotate_relay_log. @ sql/sql_table.cc Added error propagation when writing to the binlog (should be redundant after BUG 37148).
[10 Mar 2010 8:20]
Zhenxing He
See also bug#51014
[26 Apr 2010 10:27]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/106493 3356 Luis Soares 2010-04-26 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/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 a test case 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/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.
[10 Sep 2010 10:23]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/117993 3503 Luis Soares 2010-09-10 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/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.
[9 Nov 2010 23:08]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/123342 3553 Luis Soares 2010-11-09 [merge] 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.
[10 Nov 2010 0:06]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/123347 3553 Luis Soares 2010-11-10 [merge] 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.
[11 Nov 2010 11:05]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/123581 3553 Luis Soares 2010-11-11 [merge] 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.
[30 Nov 2010 23:34]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/125578 3532 Luis Soares 2010-11-30 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.
[16 Dec 2010 19:11]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/127106 3525 Luis Soares 2010-12-16 [merge] BUG#46166 Merging to latest mysql-5.1-bugteam.
[16 Dec 2010 19:12]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/127107 3205 Luis Soares 2010-12-16 [merge] BUG#46166 Merging to latest mysql-5.5-bugteam.
[16 Dec 2010 19:14]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/127108 3438 Luis Soares 2010-12-16 [merge] BUG#46166 Merging to latest mysql-trunk-bugfixing.
[16 Dec 2010 19:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/127110 3439 Luis Soares 2010-12-16 [merge] BUG#46166 Merging to latest mysql-trunk-bugfixing.
[16 Dec 2010 21:12]
Luis Soares
Queued in mysql-5.1-bugteam, mysql-5.5-bugteam and mysql-trunk-bugfixing.
[17 Dec 2010 1:22]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/127122 3526 Luis Soares 2010-12-17 BUG#46166 Post-push fixes: - fixed platform dependent result files - appeasing valgrind warnings: Fault injection was also uncovering a previously existing potential mem leaks. For BUG#46166 testing purposes, fixed by forcing handling the leak when injecting faults.
[17 Dec 2010 1:31]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/127123 3207 Luis Soares 2010-12-17 [merge] BUG#46166 Automerge from mysql-5.1-bugteam.
[17 Dec 2010 2:02]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/127124 3441 Luis Soares 2010-12-17 [merge] BUG#46166 Manual merge from mysql-5.5-bugteam.
[17 Dec 2010 2:05]
Luis Soares
Post-push fixes pushed to mysql-5.1-bugteam, mysql-5.5-bugteam and mysql-trunk-bugfixing.
[17 Dec 2010 12:48]
Bugs System
Pushed into mysql-5.1 5.1.55 (revid:georgi.kodinov@oracle.com-20101217124435-9imm43geck5u55qw) (version source revid:georgi.kodinov@oracle.com-20101217110649-y0ojr21m63ei3bhe) (merge vers: 5.1.55) (pib:24)
[17 Dec 2010 12:51]
Bugs System
Pushed into mysql-5.5 5.5.9 (revid:georgi.kodinov@oracle.com-20101217124733-p1ivu6higouawv8l) (version source revid:georgi.kodinov@oracle.com-20101217111134-n5htzj2bnehvnv4w) (merge vers: 5.5.9) (pib:24)
[17 Dec 2010 12:55]
Bugs System
Pushed into mysql-trunk 5.6.1 (revid:georgi.kodinov@oracle.com-20101217125013-y8pb3az32rtbplc9) (version source revid:luis.soares@oracle.com-20101217020132-e4f35jq8ok63dhwp) (merge vers: 5.6.1) (pib:24)
[18 Dec 2010 22:58]
Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html