Commit 967bd206 authored by Dmitry Lenev's avatar Dmitry Lenev

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.
parent 4d0f0c78
......@@ -384,10 +384,14 @@ 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,
if (!(lock= (MDL_lock*) my_hash_search_using_hash_value(&m_locks,
hash_value,
mdl_key->ptr(),
mdl_key->length())))
{
......@@ -418,10 +422,14 @@ MDL_lock* MDL_map::find_or_insert(const MDL_key *mdl_key)
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,
if (!(lock= (MDL_lock*) my_hash_search_using_hash_value(&m_locks,
hash_value,
mdl_key->ptr(),
mdl_key->length())))
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment