One more comment to the code. It is about how you disable binlogging of backup
logs writes. For all other types of logs existing in the server, e.g., the
general log, this is done on the level of Log_to_csv_event_handler. For example
see this code in Log_to_csv_event_handler::log_general(..) (log.cc:386):
> save_thd_options= thd->options;
> thd->options&= ~OPTION_BIN_LOG;
I suggest that you do the same for the backup logs.
Also, is it really sensible to use server services API from within the server
core (as you do in log.cc)? The way I see it, the API interfaces server core to
the external clients such as online backup module. Server core implements the
API so it is strange if it also uses it, as it knows the internals and knows how
to achieve given effect in a most direct and efficient way.
Rafal
Chuck Bell wrote:
(cut)
> === modified file 'sql/log.cc'
> --- a/sql/log.cc 2008-10-28 14:17:05 +0000
> +++ b/sql/log.cc 2008-10-29 00:10:42 +0000
> @@ -29,6 +29,7 @@
> #include "rpl_filter.h"
> #include "rpl_rli.h"
> #include "sql_audit.h"
> +#include "si_objects.h"
>
> #include <my_dir.h>
> #include <stdarg.h>
> @@ -2031,6 +2032,7 @@ bool LOGGER::general_log_print(THD *thd,
> bool LOGGER::backup_history_log_write(THD *thd,
> st_backup_history *history_data)
> {
> + bool reengage_binlog= FALSE;
> bool error= FALSE;
> Log_event_handler **current_handler= backup_history_log_handler_list;
> ulong id;
> @@ -2046,12 +2048,27 @@ bool LOGGER::backup_history_log_write(TH
> else
> id= 0; /* Log from connect handler */
>
> + /*
> + If binlog is turned on, turn it off and don't replicate the
> + updates to the backup logs.
> + */
> + if (obs::is_binlog_engaged())
> + {
> + obs::engage_binlog(FALSE);
> + reengage_binlog= TRUE;
> + }
> lock_shared();
> while (*current_handler)
> error|= (*current_handler++)->
> log_backup_history(thd, history_data) || error;
> unlock();
>
> + /*
> + Turn binlog back on if disengaged.
> + */
> + if (reengage_binlog)
> + obs::engage_binlog(TRUE);
> +
> return error;
> }
>
> @@ -2086,6 +2103,7 @@ bool LOGGER::backup_progress_log_write(T
> int error_num,
> const char *notes)
> {
> + bool reengage_binlog= FALSE;
> bool error= FALSE;
> Log_event_handler **current_handler= backup_progress_log_handler_list;
> ulong id;
> @@ -2101,6 +2119,16 @@ bool LOGGER::backup_progress_log_write(T
> else
> id= 0; /* Log from connect handler */
>
> +
> + /*
> + If binlog is turned on, turn it off and don't replicate the
> + updates to the backup logs.
> + */
> + if (obs::is_binlog_engaged())
> + {
> + obs::engage_binlog(FALSE);
> + reengage_binlog= TRUE;
> + }
> lock_shared();
> while (*current_handler)
> error|= (*current_handler++)->
> @@ -2108,6 +2136,12 @@ bool LOGGER::backup_progress_log_write(T
> stop, size, progress, error_num, notes) || error;
> unlock();
>
> + /*
> + Turn binlog back on if disengaged.
> + */
> + if (reengage_binlog)
> + obs::engage_binlog(TRUE);
> +
> return error;
> }
>