List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:October 22 2007 4:31pm
Subject:Re: bk commit into 5.1 tree (mats:1.2579) BUG#24860
View as plain text  
Hi Mats,

There is something strange with this patch - see comments below.

Moreover, the new test case fails for me. See output after the patch.


Mats Kindahl wrote:
[...]
> diff -Nrup a/sql/slave.cc b/sql/slave.cc
> --- a/sql/slave.cc	2007-10-13 14:58:06 +02:00
> +++ b/sql/slave.cc	2007-10-20 20:16:08 +02:00
[...]
> @@ -1905,7 +1915,8 @@ static int exec_relay_log_event(THD* thd
>      }
>      if (slave_trans_retries)
>      {
> -      if (exec_res && has_temporary_error(thd))
> +      int temp_err;
> +      if (exec_res && (temp_err= has_temporary_error(thd)))
>        {
>          const char *errmsg;
>          /*
> @@ -1953,15 +1964,19 @@ static int exec_relay_log_event(THD* thd
>                            "the slave_transaction_retries variable.",
>                            slave_trans_retries);
>        }
> -      else if (!((thd->options & OPTION_BEGIN) &&
> opt_using_transactions))
> +      else if (exec_res && !temp_err ||
> +               (opt_using_transactions &&
> +                rli->group_relay_log_pos == rli->event_relay_log_pos))

This looks fishy: the condition of the `else if ()' does not depend on 
the truth value of `(opt_using_transactions && rli->group_relay_log_pos 
== rli->event_relay_log_pos)'. In fact, `(opt_using_transactions ...)' 
will never be evaluated due to shortcut evaluation. Consider the 
following case analysis:

1. If exec_res==0 before the `if()', then the
    condition of the `else if()' is never true.
2. If exec_res!=0 before the `if()', there are two cases:
   2.1 if tmp_err!=0 before the `if()', then the condition of
       the if() is true, and hence the `else if()' condition
       is not evaluated.
   2.2 if tmp_err==0 before the `if()', then the `else if()'
       condition holds always due to the !temp_err condition,
       and the (opt_using_transactions&&...) is not evaluated.


## BEGIN OUTPUT #################################################
Logging: ./mtr rpl_temporary_errors
MySQL Version 5.1.23
Using binlog format 'mixed'
Skipping ndbcluster, mysqld not compiled with ndbcluster
Skipping SSL, mysqld not compiled with SSL
Binaries are debug compiled
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using IM_PORT               = 9312
Using IM_MYSQLD1_PORT       = 9313
Using IM_MYSQLD2_PORT       = 9314
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
Installing Master Database
Installing Slave1 Database
=======================================================

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

rpl.rpl_temporary_errors       [ fail ]

mysqltest: In included file "./include/wait_for_slave_sql_to_stop.inc": 
At line 19: Error running query ' SHOW SLAVE STATUS': 2013 Lost 
connection to MySQL server during query

The result from queries just before the failure was:
< snip >
**** On Slave ****
SHOW STATUS LIKE 'Slave_retried_transactions';
Variable_name   Value
Slave_retried_transactions      0
UPDATE t1 SET a = 5, b = 47 WHERE a = 1;
SELECT * FROM t1;
a       b
5       47
2       2
3       3
4       4
**** On Master ****
UPDATE t1 SET a = 5, b = 5 WHERE a = 1;
SELECT * FROM t1;
a       b
5       5
2       2
3       3
4       4
**** On Slave ****

More results from queries before failure can be found in 
/home/sven/bk/b24860-5.1-new-rpl-trans_error_infinite_loop/mysql-test/var/log/rpl_temporary_errors.log

Aborting: rpl.rpl_temporary_errors failed in default mode.
To continue, re-run with '--force'.
Stopping All Servers
## END OUTPUT ###################################################


-- 
Sven Sandberg, Software Engineer
MySQL AB, www.mysql.com
Thread
bk commit into 5.1 tree (mats:1.2579) BUG#24860Mats Kindahl20 Oct
  • Re: bk commit into 5.1 tree (mats:1.2579) BUG#24860Sven Sandberg22 Oct
    • Re: bk commit into 5.1 tree (mats:1.2579) BUG#24860Mats Kindahl22 Oct
      • Re: bk commit into 5.1 tree (mats:1.2579) BUG#24860Sven Sandberg22 Oct
  • Re: bk commit into 5.1 tree (mats:1.2579) BUG#24860Sven Sandberg23 Oct
  • Re: bk commit into 5.1 tree (mats:1.2579) BUG#24860Andrei Elkin23 Oct
    • Re: bk commit into 5.1 tree (mats:1.2579) BUG#24860Mats Kindahl23 Oct