summaryrefslogtreecommitdiff
path: root/sql/sql_plist.h
diff options
context:
space:
mode:
authorDmitry Lenev <Dmitry.Lenev@oracle.com>2011-11-15 22:00:14 +0400
committerDmitry Lenev <Dmitry.Lenev@oracle.com>2011-11-15 22:00:14 +0400
commit082e0b957d9da894efcb597c000134d74759c4c1 (patch)
treebd48c998427e05c0297d267f7265a34760b1a76c /sql/sql_plist.h
parentb6c0ed9953db444f85240a8131427279b9cacb02 (diff)
downloadmariadb-git-082e0b957d9da894efcb597c000134d74759c4c1.tar.gz
Fix for bug#12695572 - "IMPROVE MDL PERFORMANCE IN PRE-VISTA
BY CACHING OR REDUCING CREATEEVENT CALLS". 5.5 versions of MySQL server performed worse than 5.1 versions under single-connection workload in autocommit mode on Windows XP. Part of this slowdown can be attributed to overhead associated with constant creation/destruction of MDL_lock objects in the MDL subsystem. The problem is that creation/destruction of these objects causes creation and destruction of associated synchronization primitives, which are expensive on Windows XP. This patch tries to alleviate this problem by introducing a cache of unused MDL_object_lock objects. Instead of destroying such objects we put them into the cache and then reuse with a new key when creation of a new object is requested. To limit the size of this cache, a new --metadata-locks-cache-size start-up parameter was introduced. mysql-test/r/mysqld--help-notwin.result: Updated test after adding --metadata-locks-cache-size parameter. mysql-test/r/mysqld--help-win.result: Updated test after adding --metadata-locks-cache-size parameter. mysql-test/suite/sys_vars/r/metadata_locks_cache_size_basic.result: Added test coverage for newly introduced --metadata_locks_cache_size start-up parameter and corresponding global read-only variable. mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic-master.opt: Added test coverage for newly introduced --metadata_locks_cache_size start-up parameter and corresponding global read-only variable. mysql-test/suite/sys_vars/t/metadata_locks_cache_size_basic.test: Added test coverage for newly introduced --metadata_locks_cache_size start-up parameter and corresponding global read-only variable. sql/mdl.cc: Introduced caching of unused MDL_object_lock objects, in order to avoid costs associated with constant creation and destruction of such objects in single-connection workloads run in autocommit mode. Such costs can be pretty high on systems where creation and destruction of synchronization primitives require a system call (e.g. Windows XP). To implement this cache,a list of unused MDL_object_lock instances was added to MDL_map object. Instead of being destroyed MDL_object_lock instances are put into this list and re-used later when creation of a new instance is required. Also added MDL_lock::m_version counter to allow threads having outstanding references to an MDL_object_lock instance to notice that it has been moved to the unused objects list. Added a global variable for a start-up parameter that limits the size of the unused objects list. Note that we don't cache MDL_scoped_lock objects since they are supposed to be created only during execution of DDL statements and therefore should not affect performance much. sql/mdl.h: Added a global variable for start-up parameter that limits the size of the unused MDL_object_lock objects list and constant for its default value. sql/sql_plist.h: Added I_P_List<>::pop_front() function. sql/sys_vars.cc: Introduced --metadata-locks-cache-size start-up parameter for specifying size of the cache of unused MDL_object_lock objects.
Diffstat (limited to 'sql/sql_plist.h')
-rw-r--r--sql/sql_plist.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_plist.h b/sql/sql_plist.h
index ca1d15f3015..2b6f1067321 100644
--- a/sql/sql_plist.h
+++ b/sql/sql_plist.h
@@ -128,6 +128,15 @@ public:
}
inline T* front() { return m_first; }
inline const T *front() const { return m_first; }
+ inline T* pop_front()
+ {
+ T *result= front();
+
+ if (result)
+ remove(result);
+
+ return result;
+ }
void swap(I_P_List<T, B, C> &rhs)
{
swap_variables(T *, m_first, rhs.m_first);