#include <shared_dictionary_cache.h>
|
template<typename K , typename T > |
bool | available (const K &key) |
| Check if an element with the given key is available. More...
|
|
template<typename K , typename T > |
bool | get (THD *thd, const K &key, Cache_element< T > **element) |
| Get an element from the cache, given the key. More...
|
|
template<typename K , typename T > |
bool | get_uncached (THD *thd, const K &key, enum_tx_isolation isolation, const T **object) const |
| Read an object directly from disk, given the key. More...
|
|
template<typename T > |
void | put (const T *object, Cache_element< T > **element) |
| Add an object to the shared cache. More...
|
|
template<typename T > |
void | release (Cache_element< T > *e) |
| Release an element used by a client. More...
|
|
template<typename T > |
void | drop (Cache_element< T > *element) |
| Delete an element from the cache. More...
|
|
template<typename K , typename T > |
void | drop_if_present (const K &key) |
| Delete an element corresponding to the key from the cache if exists. More...
|
|
template<typename T > |
void | replace (Cache_element< T > *element, const T *object) |
| Replace the object and re-create the keys for an element. More...
|
|
template<typename T > |
void | dump () const |
| Debug dump of a shared cache partition to stderr. More...
|
|
◆ Shared_dictionary_cache()
dd::cache::Shared_dictionary_cache::Shared_dictionary_cache |
( |
| ) |
|
|
privatedefault |
◆ available()
template<typename K , typename T >
bool dd::cache::Shared_dictionary_cache::available |
( |
const K & |
key | ) |
|
|
inline |
Check if an element with the given key is available.
- Parameters
-
key | Key to check for presence. |
- Return values
-
true | The key exist. |
false | The key does not exist. |
◆ drop()
template<typename T >
void dd::cache::Shared_dictionary_cache::drop |
( |
Cache_element< T > * |
element | ) |
|
|
inline |
Delete an element from the cache.
This function will remove the element from the cache and delete the object pointed to. This means that all keys associated with the element will be removed from the maps, and the cache element wrapper will be deleted. The object may not be accessed after calling this function.
- Template Parameters
-
- Parameters
-
◆ drop_if_present()
template<typename K , typename T >
void dd::cache::Shared_dictionary_cache::drop_if_present |
( |
const K & |
key | ) |
|
|
inline |
Delete an element corresponding to the key from the cache if exists.
This function will find the element corresponding to the key if it exists. After that it will remove the element from the cache i.e. all maps, and delete the object pointed to. This means that all keys associated with the element will be removed from the maps, and the cache element wrapper will be deleted.
- Template Parameters
-
K | Key type. |
T | Dictionary object type. |
- Parameters
-
◆ dump()
template<typename T >
void dd::cache::Shared_dictionary_cache::dump |
( |
| ) |
const |
|
inline |
Debug dump of a shared cache partition to stderr.
- Template Parameters
-
◆ get()
template<typename K , typename T >
bool dd::cache::Shared_dictionary_cache::get |
( |
THD * |
thd, |
|
|
const K & |
key, |
|
|
Cache_element< T > ** |
element |
|
) |
| |
Get an element from the cache, given the key.
The operation retrieves an element by one of its keys from the cache (possibly involving a cache miss, which will need the thd to handle the miss) and returns it through the parameter. If there is no element for the given key, NULL is returned. The cache owns the returned element, i.e., the caller must not delete it. After using the element, release() must be called for every element received via get(). The reference counter for the element is incremented if the element is retrieved from the shared cache.
- Template Parameters
-
K | Key type. |
T | Dictionary object type. |
- Parameters
-
| thd | Thread context. |
| key | Key to use for looking up the object. |
[out] | element | Element pointer, if present. NULL if not present. |
- Return values
-
false | No error. |
true | Error (from handling a cache miss). |
◆ get_uncached()
template<typename K , typename T >
bool dd::cache::Shared_dictionary_cache::get_uncached |
( |
THD * |
thd, |
|
|
const K & |
key, |
|
|
enum_tx_isolation |
isolation, |
|
|
const T ** |
object |
|
) |
| const |
Read an object directly from disk, given the key.
The operation retrieves an object by one of its keys from the persistent dd tables. The object is returned without being added to the shared cache. The object returned is owned by the caller, who thus becomes responsible of deleting it.
- Template Parameters
-
K | Key type. |
T | Dictionary object type. |
- Parameters
-
| thd | Thread context. |
| key | Key to use for looking up the object. |
| isolation | Isolation level to use. |
[out] | object | Object pointer, if present. NULL if not present. |
- Return values
-
false | No error. |
true | Error (from reading from the DD tables). |
◆ init()
void dd::cache::Shared_dictionary_cache::init |
( |
| ) |
|
|
static |
◆ instance()
◆ m_map() [1/20]
Template function to get a map instance.
To support generic code, the map instances are available through template function instances. This allows looking up the appropriate instance based on the key type. We must use overloading to accomplish this (see above). Const and non-const variants.
- Template Parameters
-
- Returns
- The shared map handling objects of type T.
◆ m_map() [2/20]
template<typename T >
const Shared_multi_map< T > * dd::cache::Shared_dictionary_cache::m_map |
( |
| ) |
const |
|
inlineprivate |
◆ m_map() [3/20]
Overloaded functions to use for selecting map instance based on a key type.
Const and non-const variants.
◆ m_map() [4/20]
◆ m_map() [5/20]
◆ m_map() [6/20]
◆ m_map() [7/20]
◆ m_map() [8/20]
◆ m_map() [9/20]
◆ m_map() [10/20]
◆ m_map() [11/20]
◆ m_map() [12/20]
◆ m_map() [13/20]
◆ m_map() [14/20]
◆ m_map() [15/20]
◆ m_map() [16/20]
◆ m_map() [17/20]
◆ m_map() [18/20]
◆ m_map() [19/20]
◆ m_map() [20/20]
◆ put()
Add an object to the shared cache.
The object may not be present already. The object is added to the cache, the use counter of its element wrapper in incremented, and the element pointer is returned. The user must release the object afterwards. The cache is the owner of the returned element and object.
- Template Parameters
-
- Parameters
-
object | Object pointer to be added. May not be NULL. |
element | Element pointer, if present. NULL if not present. |
◆ release()
template<typename T >
void dd::cache::Shared_dictionary_cache::release |
( |
Cache_element< T > * |
e | ) |
|
|
inline |
Release an element used by a client.
The element must be present and in use. If the element becomes unused, it is added to the free list, which is then rectified to enforce its capacity constraints.
- Template Parameters
-
- Parameters
-
◆ replace()
template<typename T >
void dd::cache::Shared_dictionary_cache::replace |
( |
Cache_element< T > * |
element, |
|
|
const T * |
object |
|
) |
| |
|
inline |
Replace the object and re-create the keys for an element.
The operation removes the current keys from the internal maps in the cache, assigns the new object to the element, generates new keys based on the new object, and inserts the new keys into the internal maps in the cache. The old object is deleted.
- Template Parameters
-
- Parameters
-
element | Element pointer. |
object | New object to replace the old one. |
◆ reset()
void dd::cache::Shared_dictionary_cache::reset |
( |
bool |
keep_dd_entities | ) |
|
|
static |
◆ reset_tables_and_tablespaces()
bool dd::cache::Shared_dictionary_cache::reset_tables_and_tablespaces |
( |
THD * |
thd | ) |
|
|
static |
◆ shutdown()
void dd::cache::Shared_dictionary_cache::shutdown |
( |
| ) |
|
|
static |
◆ charset_capacity
const size_t dd::cache::Shared_dictionary_cache::charset_capacity = 64 |
|
staticprivate |
◆ collation_capacity
const size_t dd::cache::Shared_dictionary_cache::collation_capacity = 256 |
|
staticprivate |
◆ column_statistics_capacity
const size_t dd::cache::Shared_dictionary_cache::column_statistics_capacity = 32 |
|
staticprivate |
◆ event_capacity
const size_t dd::cache::Shared_dictionary_cache::event_capacity = 256 |
|
staticprivate |
◆ m_abstract_table_map
◆ m_charset_map
◆ m_collation_map
◆ m_column_stat_map
◆ m_event_map
◆ m_resource_group_map
◆ m_routine_map
◆ m_schema_map
◆ m_spatial_reference_system_map
◆ m_tablespace_map
◆ resource_group_capacity
const size_t dd::cache::Shared_dictionary_cache::resource_group_capacity = 32 |
|
staticprivate |
Maximum number of DD resource group objects to be kept in cache.
We use value of 32 which is a fairly reasonable upper limit of resource group configurations that may be in use.
◆ spatial_reference_system_capacity
const size_t dd::cache::Shared_dictionary_cache::spatial_reference_system_capacity = 256 |
|
staticprivate |
The documentation for this class was generated from the following files: