diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-27 16:26:53 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-27 16:26:53 +0300 |
commit | 9b5cdeeb0f3fa9540df50d7feec8a703db4777ab (patch) | |
tree | c487800462d4705f07ac6f0bfd4234646fa688d7 /storage/innobase/sync | |
parent | ea2b19dee6a6ed69faffa368c9b1ce9338556299 (diff) | |
parent | 2911a9a693512ec7d4903313028d252a8374e56e (diff) | |
download | mariadb-git-9b5cdeeb0f3fa9540df50d7feec8a703db4777ab.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase/sync')
-rw-r--r-- | storage/innobase/sync/sync0rw.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index d05b9475b34..2795fc902fc 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -986,13 +986,22 @@ rw_lock_own( ut_ad(lock); ut_ad(rw_lock_validate(lock)); + const os_thread_id_t thread_id = os_thread_get_curr_id(); + + if (!os_thread_eq(lock->writer_thread, thread_id)) { + } else if (lock_type == RW_LOCK_X && rw_lock_get_x_lock_count(lock)) { + return TRUE; + } else if (lock_type == RW_LOCK_SX && rw_lock_get_sx_lock_count(lock)) { + return TRUE; + } + rw_lock_debug_mutex_enter(); for (const rw_lock_debug_t* info = UT_LIST_GET_FIRST(lock->debug_list); info != NULL; info = UT_LIST_GET_NEXT(list, info)) { - if (os_thread_eq(info->thread_id, os_thread_get_curr_id()) + if (os_thread_eq(info->thread_id, thread_id) && info->pass == 0 && info->lock_type == lock_type) { @@ -1017,12 +1026,23 @@ bool rw_lock_own_flagged(const rw_lock_t* lock, rw_lock_flags_t flags) { ut_ad(rw_lock_validate(lock)); + const os_thread_id_t thread_id = os_thread_get_curr_id(); + + if (!os_thread_eq(lock->writer_thread, thread_id)) { + } else if ((flags & RW_LOCK_FLAG_X) + && rw_lock_get_x_lock_count(lock)) { + return true; + } else if ((flags & RW_LOCK_FLAG_SX) + && rw_lock_get_sx_lock_count(lock)) { + return true; + } + rw_lock_debug_mutex_enter(); for (rw_lock_debug_t* info = UT_LIST_GET_FIRST(lock->debug_list); info != NULL; info = UT_LIST_GET_NEXT(list, info)) { - if (!os_thread_eq(info->thread_id, os_thread_get_curr_id()) + if (!os_thread_eq(info->thread_id, thread_id) || info->pass) { continue; } |