diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-03-09 08:06:59 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-03-09 08:06:59 +0100 |
commit | 4933d21e5d93840ddcf41bf25ed92fbe253ae92d (patch) | |
tree | a4d892b86aa46927978f82976fff61f1e5193383 /sql/sp_cache.cc | |
parent | 97ee59d27d3daca806fdb3577df5a0e0a45a0a30 (diff) | |
parent | 7009bf411a8cb9a6e035b761b5e6352b4f474303 (diff) | |
download | mariadb-git-4933d21e5d93840ddcf41bf25ed92fbe253ae92d.tar.gz |
merge with mysql-5.5.21
Diffstat (limited to 'sql/sp_cache.cc')
-rw-r--r-- | sql/sp_cache.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index f0875b9c3f4..f88aed7ab3d 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -57,6 +57,20 @@ public: { my_hash_delete(&m_hashtable, (uchar *)sp); } + + /** + Remove all elements from a stored routine cache if the current + number of elements exceeds the argument value. + + @param[in] upper_limit_for_elements Soft upper limit of elements that + can be stored in the cache. + */ + void enforce_limit(ulong upper_limit_for_elements) + { + if (m_hashtable.records > upper_limit_for_elements) + my_hash_reset(&m_hashtable); + } + private: void init(); void cleanup(); @@ -234,6 +248,21 @@ ulong sp_cache_version() } +/** + Enforce that the current number of elements in the cache don't exceed + the argument value by flushing the cache if necessary. + + @param[in] c Cache to check + @param[in] upper_limit_for_elements Soft upper limit for number of sp_head + objects that can be stored in the cache. +*/ +void +sp_cache_enforce_limit(sp_cache *c, ulong upper_limit_for_elements) +{ + if (c) + c->enforce_limit(upper_limit_for_elements); +} + /************************************************************************* Internal functions *************************************************************************/ |