diff options
author | Dmitry Lenev <dlenev@mysql.com> | 2010-02-04 09:25:32 +0300 |
---|---|---|
committer | Dmitry Lenev <dlenev@mysql.com> | 2010-02-04 09:25:32 +0300 |
commit | f1f0228f8497b074a0417caf268888f4277811ef (patch) | |
tree | f6feb67d55966421505503eaf915c54b404e12d4 /sql/mdl.cc | |
parent | 4c94f28becce45b9986b6e813c6d619b9e72102c (diff) | |
download | mariadb-git-f1f0228f8497b074a0417caf268888f4277811ef.tar.gz |
Improve concurrency in metadata locking subsystem by
moving calculation of hash value when looking up
MDL_lock objects in MDL_map out of critical section.
Diffstat (limited to 'sql/mdl.cc')
-rw-r--r-- | sql/mdl.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/mdl.cc b/sql/mdl.cc index 6ecde849d80..46b8c089b88 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -384,12 +384,16 @@ void MDL_map::destroy() MDL_lock* MDL_map::find_or_insert(const MDL_key *mdl_key) { MDL_lock *lock; + my_hash_value_type hash_value; + + hash_value= my_calc_hash(&m_locks, mdl_key->ptr(), mdl_key->length()); retry: pthread_mutex_lock(&m_mutex); - if (!(lock= (MDL_lock*) my_hash_search(&m_locks, - mdl_key->ptr(), - mdl_key->length()))) + if (!(lock= (MDL_lock*) my_hash_search_using_hash_value(&m_locks, + hash_value, + mdl_key->ptr(), + mdl_key->length()))) { lock= MDL_lock::create(mdl_key); if (!lock || my_hash_insert(&m_locks, (uchar*)lock)) @@ -418,12 +422,16 @@ retry: MDL_lock* MDL_map::find(const MDL_key *mdl_key) { MDL_lock *lock; + my_hash_value_type hash_value; + + hash_value= my_calc_hash(&m_locks, mdl_key->ptr(), mdl_key->length()); retry: pthread_mutex_lock(&m_mutex); - if (!(lock= (MDL_lock*) my_hash_search(&m_locks, - mdl_key->ptr(), - mdl_key->length()))) + if (!(lock= (MDL_lock*) my_hash_search_using_hash_value(&m_locks, + hash_value, + mdl_key->ptr(), + mdl_key->length()))) { pthread_mutex_unlock(&m_mutex); return NULL; |