Patch approved.
/ magnus
Andrei Elkin skrev:
> Below is the list of changes that have just been committed into a local
> 5.1 repository of aelkin. When aelkin does a push these changes
> will be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>
> ChangeSet@stripped, 2008-05-06 21:52:05+03:00, aelkin@stripped +3 -0
> Bug #36524 incident of deadlock on slave is overdramatized
>
> In cases of temporary errors of a replication event execution (deadlock, timeout)
> the error log gained an overreacted error message whereas just a warning would be
> fine.
>
> Fixed with checking if an error is temporary at the end of execution events that
> prone to
> temporary errors (Query_log_event, Rows_log_event).
>
> sql/log_event.cc@stripped, 2008-05-06 21:52:03+03:00, aelkin@stripped +8
> -6
> Demoting a temprorary error such as deadlock into a warning to show in the error
> log.
>
> sql/slave.cc@stripped, 2008-05-06 21:52:03+03:00, aelkin@stripped +1 -1
> exporting the function to be used in log_event.cc
>
> sql/slave.h@stripped, 2008-05-06 21:52:03+03:00, aelkin@stripped +1 -0
> the function starts to be shared by log_event.cc as well.
>
> diff -Nrup a/sql/log_event.cc b/sql/log_event.cc
> --- a/sql/log_event.cc 2008-04-02 13:36:30 +03:00
> +++ b/sql/log_event.cc 2008-05-06 21:52:03 +03:00
> @@ -2500,11 +2500,12 @@ Default database: '%s'. Query: '%s'",
> */
> else if (thd->is_slave_error || thd->is_fatal_error)
> {
> - rli->report(ERROR_LEVEL, actual_error,
> - "Error '%s' on query. Default database: '%s'. Query: '%s'",
> - (actual_error ? thd->main_da.message() :
> - "unexpected success or fatal error"),
> - print_slave_db_safe(thd->db), query_arg);
> + rli->report(has_temporary_error(thd)? WARNING_LEVEL : ERROR_LEVEL,
> + actual_error,
> + "Error '%s' on query. Default database: '%s'. Query: '%s'",
> + (actual_error ? thd->main_da.message() :
> + "unexpected success or fatal error"),
> + print_slave_db_safe(thd->db), query_arg);
> thd->is_slave_error= 1;
> }
>
> @@ -6723,7 +6724,8 @@ int Rows_log_event::do_apply_event(Relay
>
> if (error)
> { /* error has occured during the transaction */
> - slave_rows_error_report(ERROR_LEVEL, error, rli, thd, table,
> + slave_rows_error_report(has_temporary_error(thd)? WARNING_LEVEL : ERROR_LEVEL,
> + error, rli, thd, table,
> get_type_str(), RPL_LOG_NAME, (ulong) log_pos);
> }
> if (error)
> diff -Nrup a/sql/slave.cc b/sql/slave.cc
> --- a/sql/slave.cc 2008-03-31 11:55:42 +03:00
> +++ b/sql/slave.cc 2008-05-06 21:52:03 +03:00
> @@ -1780,7 +1780,7 @@ int check_expected_error(THD* thd, Relay
> that the error is temporary by pushing a warning with the error code
> ER_GET_TEMPORARY_ERRMSG, if the originating error is temporary.
> */
> -static int has_temporary_error(THD *thd)
> +int has_temporary_error(THD *thd)
> {
> DBUG_ENTER("has_temporary_error");
>
> diff -Nrup a/sql/slave.h b/sql/slave.h
> --- a/sql/slave.h 2008-03-29 14:19:49 +02:00
> +++ b/sql/slave.h 2008-05-06 21:52:03 +03:00
> @@ -190,6 +190,7 @@ void set_slave_thread_default_charset(TH
> void rotate_relay_log(Master_info* mi);
> int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,
> bool skip);
> +inline int has_temporary_error(THD *thd);
>
> pthread_handler_t handle_slave_io(void *arg);
> pthread_handler_t handle_slave_sql(void *arg);
>