3038 Konstantin Osipov 2010-06-03
A follow up for the previous patch, titled:
A code review comment for Bug#52289.
Encapsulate the deadlock detection functionality into
a visitor class...
Remove a race introduced by omission:
initialize iterators under a read lock on the object.
@ sql/mdl.cc
Initialize iterators under a read lock on the object.
modified:
sql/mdl.cc
3037 Konstantin Osipov 2010-06-03
A code review comment for Bug#52289.
Encapsulate the deadlock detection functionality into
a visitor class, and separate it from the wait-for graph
traversal code.
Use "Internal iterator" and "Visitor" patterns to
achieve the desired separation of responsibilities.
Add comments.
@ sql/mdl.cc
Encapsulate deadlock detection into a class.
@ sql/mdl.h
Adjust for a rename of a class.
modified:
sql/mdl.cc
sql/mdl.h
=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc 2010-06-03 14:08:22 +0000
+++ b/sql/mdl.cc 2010-06-03 14:32:56 +0000
@@ -1854,15 +1854,16 @@ bool MDL_lock::find_deadlock(MDL_ticket
MDL_ticket *ticket;
MDL_context *src_ctx= waiting_ticket->get_ctx();
bool result= TRUE;
- Ticket_iterator granted_it(m_granted);
- Ticket_iterator waiting_it(m_waiting);
-
if (dvisitor->enter_node(src_ctx))
return TRUE;
mysql_prlock_rdlock(&m_rwlock);
+ /* Must be initialized after taking a read lock. */
+ Ticket_iterator granted_it(m_granted);
+ Ticket_iterator waiting_it(m_waiting);
+
/*
We do a breadth-first search first -- that is, inspect all
edges of the current node, and only then follow up to the next
Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100603143256-e2oaf8mx0d06qn8o.bundle
Thread |
---|
• bzr push into mysql-trunk-runtime branch (kostja:3037 to 3038)Bug#52289 | Konstantin Osipov | 3 Jun |