← Back to team overview

maria-developers team mailing list archive

Re: 2fdcfaaba09: MDEV-27832 disable binary logging for SQL SERVICE.

 

Hi, Alexey,

Looks good. Minor comments below.
Ok to push after addressing them.

On May 06, Alexey Botchkov wrote:
> revision-id: 2fdcfaaba09 (mariadb-10.7.2-8-g2fdcfaaba09)
> parent(s): 33fd136c61b
> author: Alexey Botchkov
> committer: Alexey Botchkov
> timestamp: 2022-05-05 15:03:38 +0400
> message:
> 
> MDEV-27832 disable binary logging for SQL SERVICE.
> 
> Binary logging is now disabled for the queries run by SQL SERVICE.
> The binlogging can be turned on with the 'SET SQL_LOG_BIN=On' query.
> 
> diff --git a/mysql-test/suite/plugins/t/test_sql_service.test b/mysql-test/suite/plugins/t/test_sql_service.test
> index b80d78fe6e5..0fd86fccd1a 100644
> --- a/mysql-test/suite/plugins/t/test_sql_service.test
> +++ b/mysql-test/suite/plugins/t/test_sql_service.test
> @@ -58,3 +73,7 @@ drop table t1;
>  
>  uninstall plugin test_sql_service;
>  
> +--replace_column 2 # 5 #
> +--replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
> +SHOW BINLOG EVENTS LIMIT 3,100;

use --source include/show_binlog_events.inc
It does all the replaces, provides a unified output everywhere, it'll be
updated if show binlog event output changes.
No need to duplicate that.

> +
> diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
> index e025147c71e..d3b77fbece3 100644
> --- a/sql/sql_prepare.cc
> +++ b/sql/sql_prepare.cc
> @@ -5617,12 +5617,26 @@ class Protocol_local : public Protocol_text
>    THD *new_thd;
>    Security_context empty_ctx;
>  
> +  my_bool do_log_bin;
> +
>    Protocol_local(THD *thd_arg, THD *new_thd_arg, ulong prealloc) :
>      Protocol_text(thd_arg, prealloc),
>      cur_data(0), first_data(0), data_tail(&first_data), alloc(0),
> -    new_thd(new_thd_arg)
> +    new_thd(new_thd_arg), do_log_bin(FALSE)
>    {}
>   
> +  void set_binlog_vars(my_bool *sav_log_bin)
> +  {
> +    *sav_log_bin= thd->variables.sql_log_bin;
> +    thd->variables.sql_log_bin= do_log_bin;
> +    thd->set_binlog_bit();
> +  }
> +  void restore_binlog_vars(my_bool &sav_log_bin)

this doesn't need to be a reference, just a normal pass-by-value will
do.

> +  {
> +    do_log_bin= thd->variables.sql_log_bin;
> +    thd->variables.sql_log_bin= sav_log_bin;
> +    thd->set_binlog_bit();
> +  }
>  protected:
>    bool net_store_data(const uchar *from, size_t length);
>    bool net_store_data_cs(const uchar *from, size_t length,

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