| Bug #37148 | Most callers of mysql_bin_log.write ignore the return result | ||
|---|---|---|---|
| Submitted: | 3 Jun 2008 5:21 | Modified: | 2 Nov 11:55 |
| Reporter: | Mark Callaghan | ||
| Status: | Patch approved | ||
| Category: | Server: Replication | Severity: | S3 (Non-critical) |
| Version: | 5.0.37, 5.0.64, 5.1.26 | OS: | Any |
| Assigned to: | Zhenxing He | Target Version: | 5.4+ |
| Tags: | write, binlog, replication | ||
| Triage: | Triaged: D3 (Medium) / R2 (Low) / E3 (Medium) | ||
[3 Jun 2008 5:21]
Mark Callaghan
[21 Aug 2008 9:38]
Mats Kindahl
Rationale for R3/E3: Adding checks to all the places where they are missing is a low-risk moderate effort, but it is complicated by the fact that refactoring might be necessary to propagate the errors correctly and abort execution in the event of a failure. The refactoring may introduce new bugs and will also increase the amount of work necessary to perform the task.
[21 Aug 2008 16:12]
Mark Callaghan
You could start by writing a message to the db error log when there is a problem. This could be done within MYSQL_LOG::write. Today, it calls my_message() or my_error(). Do either of those write anything to the db error log. It is a bad idea to rely on clients to log and report all error messages especially if the client is the SQL slave thread when the slave is also writing a binlog.
[3 Jun 3:06]
James Day
Perhaps control the risk here by splitting the work into two different bug reports: 1. Log error and handle the easy code changes. 2. Fix any which require more extensive refactoring. That should take care of at least a decent proportion of the error cases fairly soon, while potentially leaving the tougher ones for later. The fix for bug #43929 leaves us knowing that we've failed to log an update to a table into the binary log, so part 1 would communicate "sorry, you now have to reclone all of your slaves and make a new backup because your binlog is no longer reliable" for all cases and presumably fix some of the transactional ones with a rollback if the errors propagate back up the call stack and get handled properly. Because bug #43929 is D2 it seems that both parts of this bug should also be D2 instead of D3. Data loss potential on the master, actual if binlog recovery is needed before the next backup; actual on the slaves immediately.
[24 Jun 21:29]
James Day
Alfranio, it sounds as though there's merit in doing the easy and low risk error message part of the job first, in a different bug report. That'll deliver a lot of benefit to end users.
[8 Jul 15:30]
Bugs System
Pushed into 5.1.37 (revid:joro@sun.com-20090708131116-kyz8iotbum8w9yic) (version source revid:alfranio.correia@sun.com-20090618141614-uifzzw8e1quuo5gn) (merge vers: 5.1.36) (pib:11)
[9 Jul 9:36]
Bugs System
Pushed into 5.1.37 (revid:joro@sun.com-20090708131116-kyz8iotbum8w9yic) (version source revid:alfranio.correia@sun.com-20090618141614-uifzzw8e1quuo5gn) (merge vers: 5.1.36) (pib:11)
[10 Jul 13:21]
Bugs System
Pushed into 5.4.4-alpha (revid:anozdrin@bk-internal.mysql.com-20090710111017-bnh2cau84ug1hvei) (version source revid:alfranio.correia@sun.com-20090618170901-02r8xonuztg8005r) (merge vers: 5.4.4-alpha) (pib:11)
[13 Jul 6:01]
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/78490 2973 He Zhenxing 2009-07-13 BUG#37148 Most callers of mysql_bin_log.write ignore the return result The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases.
[13 Aug 0:02]
Paul DuBois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[15 Aug 0:54]
Paul DuBois
Ignore previous comment about 5.4.2.
[20 Aug 11:57]
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/81137 2973 He Zhenxing 2009-08-20 BUG#37148 Most callers of mysql_bin_log.write ignore the return result The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases.
[26 Aug 15:46]
Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 15:46]
Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 15:48]
Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 18:33]
Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[30 Sep 3:49]
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/85111 2973 He Zhenxing 2009-09-30 BUG#37148 Most callers of mysql_bin_log.write ignore the return result The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ mysql-test/include/binlog_inject_error.inc inject binlog write error when doing a query @ mysql-test/suite/binlog/t/binlog_write_error.test Simple test case to check if proper error is reported when injecting binlog write errors.
[30 Oct 10:59]
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/88719 2973 He Zhenxing 2009-10-30 BUG#37148 Most callers of mysql_bin_log.write ignore the return result The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ mysql-test/include/binlog_inject_error.inc inject binlog write error when doing a query @ mysql-test/suite/binlog/t/binlog_write_error.test Simple test case to check if proper error is reported when injecting binlog write errors. @ sql/events.cc check return value of mysql_bin_log.write @ sql/ha_ndbcluster_binlog.cc Changed ndb_binlog_query to return int instead of void, and return 1 if there is error writing the binlog @ sql/log.cc check return value of mysql_bin_log.write @ sql/log_event.cc check return value of mysql_bin_log.write @ sql/log_event_old.cc check return value of mysql_bin_log.write @ sql/mysql_priv.h Change write_bin_log to return int instead of void @ sql/rpl_injector.cc check return value of writing binlog @ sql/sp.cc check return value of writing binlog @ sql/sp_head.cc return 1 if writing binlog failed @ sql/sql_acl.cc check return value of writing binlog @ sql/sql_base.cc check return value of writing binlog @ sql/sql_class.h Change binlog_show_create_table to return int @ sql/sql_db.cc Change write_to_binlog to return int check return value of writing binlog @ sql/sql_delete.cc check return value of writing binlog @ sql/sql_insert.cc check return value of writing binlog @ sql/sql_load.cc check return value of writing binlog @ sql/sql_parse.cc check return value of writing binlog @ sql/sql_partition.cc check return value of writing binlog @ sql/sql_rename.cc check return value of writing binlog @ sql/sql_repl.cc check return value of writing binlog @ sql/sql_table.cc Change write_bin_log to return int, and return 1 if there was error writing binlog @ sql/sql_tablespace.cc check return value of writing binlog @ sql/sql_trigger.cc check return value of writing binlog @ sql/sql_udf.cc check return value of writing binlog @ sql/sql_update.cc check return value of writing binlog @ sql/sql_view.cc check return value of writing binlog
[2 Nov 9:26]
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/88884 2973 He Zhenxing 2009-11-02 BUG#37148 Most callers of mysql_bin_log.write ignore the return result The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ mysql-test/include/binlog_inject_error.inc inject binlog write error when doing a query @ mysql-test/suite/binlog/t/binlog_write_error.test Simple test case to check if proper error is reported when injecting binlog write errors. @ sql/events.cc check return value of mysql_bin_log.write @ sql/ha_ndbcluster_binlog.cc Changed ndb_binlog_query to return int instead of void, and return 1 if there is error writing the binlog @ sql/log.cc check return value of mysql_bin_log.write @ sql/log_event.cc check return value of mysql_bin_log.write @ sql/log_event_old.cc check return value of mysql_bin_log.write @ sql/mysql_priv.h Change write_bin_log to return int instead of void @ sql/rpl_injector.cc check return value of writing binlog @ sql/sp.cc check return value of writing binlog @ sql/sp_head.cc return 1 if writing binlog failed @ sql/sql_acl.cc check return value of writing binlog @ sql/sql_base.cc check return value of writing binlog @ sql/sql_class.h Change binlog_show_create_table to return int @ sql/sql_db.cc Change write_to_binlog to return int check return value of writing binlog @ sql/sql_delete.cc check return value of writing binlog @ sql/sql_insert.cc check return value of writing binlog @ sql/sql_load.cc check return value of writing binlog @ sql/sql_parse.cc check return value of writing binlog @ sql/sql_partition.cc check return value of writing binlog @ sql/sql_rename.cc check return value of writing binlog @ sql/sql_repl.cc check return value of writing binlog @ sql/sql_table.cc Change write_bin_log to return int, and return 1 if there was error writing binlog @ sql/sql_tablespace.cc check return value of writing binlog @ sql/sql_trigger.cc check return value of writing binlog @ sql/sql_udf.cc check return value of writing binlog @ sql/sql_update.cc check return value of writing binlog @ sql/sql_view.cc check return value of writing binlog
[19 Nov 9:37]
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/90923 3201 He Zhenxing 2009-11-19 BUG#37148 Most callers of mysql_bin_log.write ignore the return result The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ mysql-test/include/binlog_inject_error.inc inject binlog write error when doing a query @ mysql-test/suite/binlog/t/binlog_write_error.test Simple test case to check if proper error is reported when injecting binlog write errors. @ sql/events.cc check return value of mysql_bin_log.write @ sql/ha_ndbcluster_binlog.cc Changed ndb_binlog_query to return int instead of void, and return 1 if there is error writing the binlog @ sql/log.cc check return value of mysql_bin_log.write @ sql/log_event.cc check return value of mysql_bin_log.write @ sql/log_event_old.cc check return value of mysql_bin_log.write @ sql/mysql_priv.h Change write_bin_log to return int instead of void @ sql/rpl_injector.cc check return value of writing binlog @ sql/sp.cc check return value of writing binlog @ sql/sp_head.cc return 1 if writing binlog failed @ sql/sql_acl.cc check return value of writing binlog @ sql/sql_base.cc check return value of writing binlog @ sql/sql_class.h Change binlog_show_create_table to return int @ sql/sql_db.cc Change write_to_binlog to return int check return value of writing binlog @ sql/sql_delete.cc check return value of writing binlog @ sql/sql_insert.cc check return value of writing binlog @ sql/sql_load.cc check return value of writing binlog @ sql/sql_parse.cc check return value of writing binlog @ sql/sql_partition.cc check return value of writing binlog @ sql/sql_rename.cc check return value of writing binlog @ sql/sql_repl.cc check return value of writing binlog @ sql/sql_table.cc Change write_bin_log to return int, and return 1 if there was error writing binlog @ sql/sql_tablespace.cc check return value of writing binlog @ sql/sql_trigger.cc check return value of writing binlog @ sql/sql_udf.cc check return value of writing binlog @ sql/sql_update.cc check return value of writing binlog @ sql/sql_view.cc check return value of writing binlog
[19 Nov 10: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/90927 3201 He Zhenxing 2009-11-19 BUG#37148 Most callers of mysql_bin_log.write ignore the return result This is the non-ndb part of the patch. The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ mysql-test/include/binlog_inject_error.inc inject binlog write error when doing a query @ mysql-test/suite/binlog/t/binlog_write_error.test Simple test case to check if proper error is reported when injecting binlog write errors. @ sql/events.cc check return value of mysql_bin_log.write @ sql/log.cc check return value of mysql_bin_log.write @ sql/log_event.cc check return value of mysql_bin_log.write @ sql/log_event_old.cc check return value of mysql_bin_log.write @ sql/mysql_priv.h Change write_bin_log to return int instead of void @ sql/rpl_injector.cc check return value of writing binlog @ sql/sp.cc check return value of writing binlog @ sql/sp_head.cc return 1 if writing binlog failed @ sql/sql_acl.cc check return value of writing binlog @ sql/sql_base.cc check return value of writing binlog @ sql/sql_class.h Change binlog_show_create_table to return int @ sql/sql_db.cc Change write_to_binlog to return int check return value of writing binlog @ sql/sql_delete.cc check return value of writing binlog @ sql/sql_insert.cc check return value of writing binlog @ sql/sql_load.cc check return value of writing binlog @ sql/sql_parse.cc check return value of writing binlog @ sql/sql_partition.cc check return value of writing binlog @ sql/sql_rename.cc check return value of writing binlog @ sql/sql_repl.cc check return value of writing binlog @ sql/sql_table.cc Change write_bin_log to return int, and return 1 if there was error writing binlog @ sql/sql_tablespace.cc check return value of writing binlog @ sql/sql_trigger.cc check return value of writing binlog @ sql/sql_udf.cc check return value of writing binlog @ sql/sql_update.cc check return value of writing binlog @ sql/sql_view.cc check return value of writing binlog
[19 Nov 10:13]
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/90928 3038 He Zhenxing 2009-11-19 BUG#37148 Most callers of mysql_bin_log.write ignore the return result This is the ndb part of the patch. The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ sql/ha_ndbcluster_binlog.cc Changed ndb_binlog_query to return int instead of void, and return 1 if there is error writing the binlog
[20 Nov 5:20]
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/91030 3209 He Zhenxing 2009-11-20 BUG#37148 Most callers of mysql_bin_log.write ignore the return result This is the non-ndb part of the patch. The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ mysql-test/include/binlog_inject_error.inc inject binlog write error when doing a query @ mysql-test/suite/binlog/t/binlog_write_error.test Simple test case to check if proper error is reported when injecting binlog write errors. @ sql/events.cc check return value of mysql_bin_log.write @ sql/log.cc check return value of mysql_bin_log.write @ sql/log_event.cc check return value of mysql_bin_log.write @ sql/log_event_old.cc check return value of mysql_bin_log.write @ sql/mysql_priv.h Change write_bin_log to return int instead of void @ sql/rpl_injector.cc check return value of writing binlog @ sql/sp.cc check return value of writing binlog @ sql/sp_head.cc return 1 if writing binlog failed @ sql/sql_acl.cc check return value of writing binlog @ sql/sql_base.cc check return value of writing binlog @ sql/sql_class.h Change binlog_show_create_table to return int @ sql/sql_db.cc Change write_to_binlog to return int check return value of writing binlog @ sql/sql_delete.cc check return value of writing binlog @ sql/sql_insert.cc check return value of writing binlog @ sql/sql_load.cc check return value of writing binlog @ sql/sql_parse.cc check return value of writing binlog @ sql/sql_partition.cc check return value of writing binlog @ sql/sql_rename.cc check return value of writing binlog @ sql/sql_repl.cc check return value of writing binlog @ sql/sql_table.cc Change write_bin_log to return int, and return 1 if there was error writing binlog @ sql/sql_tablespace.cc check return value of writing binlog @ sql/sql_trigger.cc check return value of writing binlog @ sql/sql_udf.cc check return value of writing binlog @ sql/sql_update.cc check return value of writing binlog @ sql/sql_view.cc check return value of writing binlog
[21 Nov 5: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/91196 2956 He Zhenxing 2009-11-21 BUG#37148 Most callers of mysql_bin_log.write ignore the return result This is the non-ndb part of the patch. The return value of mysql_bin_log.write was ignored by most callers, which may lead to inconsistent on master and slave if the transaction was committed while the binlog was not correctly written. If my_error() is call in mysql_bin_log.write, this could also lead to assertion issue if my_ok() or my_error() is called after. This fixed the problem by let the caller to check and handle the return value of mysql_bin_log.write. This patch only adresses the simple cases. @ mysql-test/include/binlog_inject_error.inc inject binlog write error when doing a query @ mysql-test/suite/binlog/t/binlog_write_error.test Simple test case to check if proper error is reported when injecting binlog write errors. @ sql/events.cc check return value of mysql_bin_log.write @ sql/log.cc check return value of mysql_bin_log.write @ sql/log_event.cc check return value of mysql_bin_log.write @ sql/log_event_old.cc check return value of mysql_bin_log.write @ sql/mysql_priv.h Change write_bin_log to return int instead of void @ sql/rpl_injector.cc check return value of writing binlog @ sql/sp.cc check return value of writing binlog @ sql/sp_head.cc return 1 if writing binlog failed @ sql/sql_acl.cc check return value of writing binlog @ sql/sql_base.cc check return value of writing binlog @ sql/sql_class.h Change binlog_show_create_table to return int @ sql/sql_db.cc Change write_to_binlog to return int check return value of writing binlog @ sql/sql_delete.cc check return value of writing binlog @ sql/sql_insert.cc check return value of writing binlog @ sql/sql_load.cc check return value of writing binlog @ sql/sql_parse.cc check return value of writing binlog @ sql/sql_partition.cc check return value of writing binlog @ sql/sql_rename.cc check return value of writing binlog @ sql/sql_repl.cc check return value of writing binlog @ sql/sql_table.cc Change write_bin_log to return int, and return 1 if there was error writing binlog @ sql/sql_tablespace.cc check return value of writing binlog @ sql/sql_trigger.cc check return value of writing binlog @ sql/sql_udf.cc check return value of writing binlog @ sql/sql_update.cc check return value of writing binlog @ sql/sql_view.cc check return value of writing binlog
[21 Nov 12:49]
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/91207 2958 He Zhenxing 2009-11-21 Post fix for previous patch of bug#37148 @ sql/sql_table.cc Add the missing return 0
