← Back to team overview

maria-developers team mailing list archive

Re: 73c4fd41afc: Do not ignore sql_mode when replicating

 

Hi, Nikita,

On Jul 07, Nikita Malyavin wrote:
> 
> diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc
> index aba846453e9..89ca2a41937 100644
> --- a/sql/log_event_server.cc
> +++ b/sql/log_event_server.cc
> @@ -6045,9 +6045,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
>        extra columns on the slave. In that case, do not force
>        MODE_NO_AUTO_VALUE_ON_ZERO.
>      */
> +    Rpl_table_data rpl_data{};
> +    if (rgi) rgi->get_table_data(table, &rpl_data);
>      sql_mode_t saved_sql_mode= thd->variables.sql_mode;
>      if (!is_auto_inc_in_extra_columns())
> -      thd->variables.sql_mode= MODE_NO_AUTO_VALUE_ON_ZERO;
> +      thd->variables.sql_mode= (rpl_data.copy_fields ? saved_sql_mode : 0)

you start using this condition in many places and it's quite cryptic for
those, who don't know the code. I'd suggest to add method, like

 struct Rpl_table_data
 {
   ...
   bool is_online_alter() { return copy_fields != NULL; }
   ...
 };

btw, it fits very well in your Rpl_table_data simplification.

> +                               | MODE_NO_AUTO_VALUE_ON_ZERO;

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx


Follow ups