Re: Replication race bug in sequential file cache (mf_iocache.cc)
am 24.06.2002 13:05:51 von Nils Ulltveit-Moe--text follows this line--
Michael Widenius writes:
> The above should not be possible as all writes to the cache is
> protected by the LOCK_log mutex in sql/log.cc
>
> There may of course be some case were we have missed it, but I would
> prefer to know where before trying to patch things in the maybe wrong
> place.
I have tried to see through the code, and the locking with LOG_lock
for the binlog seems OK.
> If you get a corrupted log, without the MySQL server going done in the
> mean time, this does indicate a problem in the IO cache or in the
> mutex that protects it.
>
> I checked the code on sql_log.cc and all my_b_write() and
> flush_io_cache() call are properly protected by the mutex.
> (This is the only place where we write to the binary log file).
>
> Are you 100 % sure that the MySQL didn't go down and that the above
> patch fixes this problem ?
I am positive that MySQL did not go down, as it continued to log to
the same log file after the point of corruption. The fact that MySQL
did not go down is perhaps a greater problem for us than if it went
down, since MySQL then can have a large number of transactions that we
are unable to replicate to the central database, since replication
stops at the corrupt entry.
I have not got any log corruption, even after quite heavy load, with
the patch I mentioned, so I still believe it most probably is a race
bug when accessing my_b_write(). I am not able to get an overview over
the locking that is used for my_b_write(), since this function is used
a lot of places with various locks used in various encapsulating classes.
To try to hunt down the bug, I can modify the patch to use
pthreads_mutex_trylock() instead of pthreads_lock() and then
deliberately dump core if two processes are inside my_b_write() working
on the same buffer at the same time. Hopefully the stack trace will
then be useful to find the bug.
Regards,
Nils Ulltveit-Moe
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread12136@lists.mysql.com
To unsubscribe, e-mail