List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:July 3 2007 3:37pm
Subject:Re: bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983
View as plain text  
Hello,

On Tue, Jul 03, 2007 at 10:36:40AM +0300, kgeorge@stripped wrote:
> ChangeSet@stripped, 2007-07-03 10:36:37+03:00, gkodinov@stripped +1 -0
>   Bug #28983: 'reset master' in multiple threads and innodb tables 
>   asserts debug binary
>   
>   We can't reliably check if the binary log is opened without 
>   acquiring its mutex. 
>   Fixed by removing this check.
> 
>   sql/log.cc@stripped, 2007-07-03 10:29:54+03:00, gkodinov@stripped +5 -5
>     Bug #28983: 
>     can't reliably check if bin_log is open outside of its mutex
> 
> diff -Nrup a/sql/log.cc b/sql/log.cc
> --- a/sql/log.cc	2007-04-27 16:33:46 +03:00
> +++ b/sql/log.cc	2007-07-03 10:29:54 +03:00
> @@ -85,7 +85,7 @@ bool binlog_init()
>  static int binlog_close_connection(THD *thd)
>  {
>    IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot];
> -  DBUG_ASSERT(mysql_bin_log.is_open() && !my_b_tell(trans_log));
> +  DBUG_ASSERT(!my_b_tell(trans_log));
>    close_cached_file(trans_log);
>    my_free((gptr)trans_log, MYF(0));
>    return 0;

If the binlog was disabled from the start (before threads are
created), it cannot be enabled later, and there is issue with
check-without-mutex (all threads see value as it was when it started,
and value didn't change later).
So the issue can only happen if binlog was enabled at the start, and then
later disabled; this happens only if the binlog gets a write error.
We considered it ok to have a debug build assert if there is a binlog
write error (which is extremely rare), compared to the benefit of
ensuring that future coders does not call binlog functions when binlog
is closed.

Are you sure that is_open()-without-mutex is really the cause of the
assertions observed by the bug reports? They were assertions in
binlog_close_connection() and binlog_commit(), which test also
contents of trans_log and of thd->options. In "DBUG_ASSERT(A && B)",
is it A or B which is observed false?


> @@ -126,7 +126,7 @@ static int binlog_commit(THD *thd, bool 
>  {
>    IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot];
>    DBUG_ENTER("binlog_commit");
> -  DBUG_ASSERT(mysql_bin_log.is_open() &&
> +  DBUG_ASSERT(
>       (all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))));
>  
>    if (my_b_tell(trans_log) == 0)
<cut>

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Guilhem Bichot <guilhem@stripped>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Lead Software Engineer
/_/  /_/\_, /___/\___\_\___/   Bordeaux, France
       <___/   www.mysql.com   
Thread
bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983kgeorge3 Jul
  • Re: bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983Guilhem Bichot3 Jul
    • Re: bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983Georgi Kodinov3 Jul
      • Re: bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983Guilhem Bichot3 Jul
        • Re: bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983Georgi Kodinov3 Jul
          • Re: bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983Guilhem Bichot4 Jul
            • Re: bk commit into 5.0 tree (gkodinov:1.2505) BUG#28983Georgi Kodinov30 Jul