Have trouble to understand bug 10942

Have trouble to understand bug 10942

am 23.03.2009 06:52:30 von king

Hi there,

Bug #10942 is deadlock with FLUSH TABLES WITH READ LOCK + STOP SLAVE

On http://bugs.mysql.com/bug.php?id=10942, it says "FLUSH TABLES WITH
READ LOCK will prevent slave SQL thread to start next replicated
statement", and the next STOP SLAVE will lead to deadlock. My questions are:
1. How does FLUSH TABLES WITH READ LOCK prevent START SLAVE? I know
FLUSH TABLES WITH READ LOCK will take the global read lock, but I do not
know if this will fail START SLAVE. I could be totally wrong on this.
2. In which statement does START SLAVE really block,
pthread_mutex_lock(&LOCK_active_mi) or inside
start_slave(thd,active_mi,1 /* net report*/)? If it is the latter case,
can you also point me the statement?
3. Where does STOP SLAVE block, on pthread_mutex_lock(&LOCK_active_mi)?
I think this is the case: if START SLAVE block on
pthread_mutex_lock(&LOCK_active_mi), STOP SLAVE should block on the same
lock; if START SLAVE got LOCK_active_mi, STOP SLAVE should still block
there.
4. Why this will be deadlock, isn't it possible that FLUSH TABLES WITH
READ LOCK finishes, then START SLAVE, and finally STOP SLAVE?

*In general, I do not understand how they deadlock. If you can explain
that, you can also skip my questions. Thanks.*

Any help will be appreciate.

Regards,
king

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: Have trouble to understand bug 10942

am 25.03.2009 15:03:23 von Sergei Golubchik

Hi, king!

On Mar 23, king wrote:
> Hi there,
>
> Bug #10942 is deadlock with FLUSH TABLES WITH READ LOCK + STOP SLAVE
>
> On http://bugs.mysql.com/bug.php?id=10942, it says "FLUSH TABLES WITH READ
> LOCK will prevent slave SQL thread to start next replicated statement", and
> the next STOP SLAVE will lead to deadlock. My questions are:
...
> *In general, I do not understand how they deadlock. If you can explain
> that, you can also skip my questions. Thanks.*

Read the bug report and the 'How to repeat:' test case. Or at least see
the 'show processlist;' output in the bug report.

It's obvious from there that the replication slave is blocked when it
tries to execute 'create database db1', which is a replicated statement
from the master.

Regards / Mit vielen Grüßen,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org