diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-06-03 18:32:56 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-06-03 18:32:56 +0400 |
commit | cbf4019a1b3ec82bdcd9a65db114908a920fb01c (patch) | |
tree | dc96452a806e5479f955180c2478204c9700ca62 | |
parent | e7854c86a7e98a8680f262d39d7497cf76932bee (diff) | |
download | mariadb-git-cbf4019a1b3ec82bdcd9a65db114908a920fb01c.tar.gz |
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.
-rw-r--r-- | sql/mdl.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/mdl.cc b/sql/mdl.cc index 75970396af7..68ac0cc599d 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1854,15 +1854,16 @@ bool MDL_lock::find_deadlock(MDL_ticket *waiting_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 |