← Back to team overview

maria-developers team mailing list archive

Re: [Commits] Rev 3797: MDEV-4816: rpl.rpl_trunc_temp fails in 10.0-serg in file:///data0/psergey/dev2/10.0-serg/

 

Sergey Petrunya <psergey@xxxxxxxxxxxx> writes:

> revision-id: psergey@xxxxxxxxxxxx-20130802141209-4dqfvx2db8acxwbl
> message:
>   MDEV-4816: rpl.rpl_trunc_temp fails in 10.0-serg
>   Temorary fix for a number of replication tests (rpl.rpl_temp_table_mix_row 
>   rpl.rpl_trunc_temp rpl.rpl_current_user rpl.rpl_gtid_master_promote):

The patch is not ok to push. We should not introduce a special flag just for
the table gtid_slave_pos.

Instead of setting table->no_replicate in the first place in
rpl_slave_state::truncate_state_table() and rpl_slave_state::record_gtid(), we
can clear the OPTION_BIN_LOG option. I checked MySQL 5.6 code and this is what
they do for their similar "crash-safe replication" tables.

So remove the two statements "table->no_replicate= 1" in rpl_gtid.cc and
replace with clear of OPTION_BIN_LOG in thd->variables.option_bits.

Then table->no_replicate is not touched and the new logic in
THD::decide_logging_format() does not trigger, so the problem should be
solved.

In rpl_slave_state::truncate_state_table() we can use tmp_disable_binlog() and
reenable_binlog() I think. In record_gtid() it is probably better to combine
the clearing of OPTION_BIN_LOG with the existing save/restore of
variables.option_bits.

>   The question of what should be done when a user issues a statement that
>   explicitly modifies mysql.gtid_slave_pos table remains open.

I do not think we need to do anything special for this case. User explicitly
modifying the table should be treated no different than any other table.

Hope this helps,

 - Kristian.


> === modified file 'sql/rpl_gtid.cc'
> --- a/sql/rpl_gtid.cc	2013-06-21 09:53:46 +0000
> +++ b/sql/rpl_gtid.cc	2013-08-02 14:12:09 +0000
> @@ -210,6 +210,7 @@ rpl_slave_state::truncate_state_table(TH
>    {
>      table= tlist.table;
>      table->no_replicate= 1;
> +    table->s->is_gtid_slave_pos= TRUE; // TEMPORARY CODE
>      err= table->file->ha_truncate();
>  
>      if (err)
> @@ -346,6 +347,7 @@ rpl_slave_state::record_gtid(THD *thd, c
>      goto end;
>  
>    table->no_replicate= 1;
> +  table->s->is_gtid_slave_pos= TRUE; // TEMPORARY CODE
>    if (!in_transaction)
>      thd->variables.option_bits&=
>        ~(ulonglong)(OPTION_NOT_AUTOCOMMIT|OPTION_BEGIN);
>
> === modified file 'sql/sql_class.cc'
> --- a/sql/sql_class.cc	2013-07-24 10:43:57 +0000
> +++ b/sql/sql_class.cc	2013-08-02 14:12:09 +0000
> @@ -5001,7 +5001,7 @@ int THD::decide_logging_format(TABLE_LIS
>        DBUG_PRINT("info", ("table: %s; ha_table_flags: 0x%llx",
>                            table->table_name, flags));
>  
> -      if (table->table->no_replicate)
> +      if (table->table->no_replicate && !table->table->s->is_gtid_slave_pos)
>        {
>          /*
>            The statement uses a table that is not replicated.
>
> === modified file 'sql/table.cc'
> --- a/sql/table.cc	2013-07-21 14:43:42 +0000
> +++ b/sql/table.cc	2013-08-02 14:12:09 +0000
> @@ -315,6 +315,8 @@ TABLE_SHARE *alloc_table_share(const cha
>      strmov(share->path.str, path);
>      share->normalized_path.str=    share->path.str;
>      share->normalized_path.length= path_length;
> +    /* TEMPORARY FIX: if true, this means this is mysql.gtid_slave_pos table */
> +    share->is_gtid_slave_pos= FALSE;
>      share->table_category= get_table_category(& share->db, & share->table_name);
>      share->set_refresh_version();
>      share->open_errno= ENOENT;
>
> === modified file 'sql/table.h'
> --- a/sql/table.h	2013-07-21 14:39:19 +0000
> +++ b/sql/table.h	2013-08-02 14:12:09 +0000
> @@ -644,6 +644,8 @@ struct TABLE_SHARE
>    LEX_STRING normalized_path;		/* unpack_filename(path) */
>    LEX_STRING connect_string;
>  
> +  bool is_gtid_slave_pos;
> +
>    /* 
>       Set of keys in use, implemented as a Bitmap.
>       Excludes keys disabled by ALTER TABLE ... DISABLE KEYS.
>
> _______________________________________________
> commits mailing list
> commits@xxxxxxxxxxx
> https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits