Have trouble to understand bug 10942

king <[email protected]> Mon, 23 Mar 2009 00:52:30 -0500
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
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/[email protected]