MySQL 8.0.40
Source Code Documentation
|
Handling of access to persistent storage. More...
#include <storage_adapter.h>
Public Member Functions | |
template<typename T > | |
size_t | core_size () |
Get the number of core objects in a registry partition. More... | |
template<typename T > | |
Object_id | core_get_id (const typename T::Name_key &key) |
Get a dictionary object id from core storage. More... | |
template<typename T > | |
void | core_update (const T *) |
Update the dd object in the core registry. More... | |
void | core_update (const dd::Tablespace *new_tsp) |
Overload of core_update for dd::Tablespace. More... | |
template<typename T > | |
void | core_drop (THD *thd, const T *object) |
Drop a dictionary object from core storage. More... | |
template<typename T > | |
void | core_store (THD *thd, T *object) |
Store a dictionary object to core storage. More... | |
template<typename T > | |
bool | core_sync (THD *thd, const typename T::Name_key &key, const T *object) |
Sync a dictionary object from persistent to core storage. More... | |
void | erase_all () |
Remove and delete all elements and objects from core storage. More... | |
void | dump () |
Dump the contents of the core storage. More... | |
template<> | |
void | core_get (const Table_stat::Name_key &, const Table_stat **) |
template<> | |
void | core_get (const Index_stat::Name_key &, const Index_stat **) |
template<> | |
void | core_drop (THD *, const Table_stat *) |
template<> | |
void | core_drop (THD *, const Index_stat *) |
template<> | |
void | core_store (THD *, Table_stat *) |
template<> | |
void | core_store (THD *, Index_stat *) |
Static Public Member Functions | |
static Storage_adapter * | instance () |
template<typename K , typename T > | |
static bool | get (THD *thd, const K &key, enum_tx_isolation isolation, bool bypass_core_registry, const T **object) |
Get a dictionary object from persistent storage. More... | |
template<typename T > | |
static bool | drop (THD *thd, const T *object) |
Drop a dictionary object from persistent storage. More... | |
template<typename T > | |
static bool | store (THD *thd, T *object) |
Store a dictionary object to persistent storage. More... | |
Private Member Functions | |
template<typename T > | |
Object_id | next_oid () |
Generate a new object id for a registry partition. More... | |
template<typename K , typename T > | |
void | core_get (const K &key, const T **object) |
Get a dictionary object from core storage. More... | |
Storage_adapter () | |
~Storage_adapter () | |
Private Attributes | |
Object_registry | m_core_registry |
mysql_mutex_t | m_lock |
Static Private Attributes | |
static const Object_id | FIRST_OID = 10001 |
Use an id not starting at 1 to make it easy to recognize ids generated before objects are stored persistently. More... | |
static bool | s_use_fake_storage = false |
Friends | |
class | dd_cache_unittest::CacheStorageTest |
Handling of access to persistent storage.
This class provides static template functions that manipulates an object on persistent storage based on the submitted key and object type. There is also an object registry instance to keep the core DD objects that are needed to handle cache misses for table meta data. The storage adapter owns the objects in the core registry. When adding objects to the registry using core_store(), the storage adapter will clone the object and take ownership of the clone. When retrieving objects from the registry using core_get(), a clone of the object will be returned, and this is therefore owned by the caller.
|
inlineprivate |
|
inlineprivate |
void dd::cache::Storage_adapter::core_drop | ( | THD * | , |
const Index_stat * | |||
) |
void dd::cache::Storage_adapter::core_drop | ( | THD * | , |
const Table_stat * | |||
) |
void dd::cache::Storage_adapter::core_drop | ( | THD * | thd, |
const T * | object | ||
) |
Drop a dictionary object from core storage.
T | Dictionary object type. |
thd | Thread context. |
object | Object to be dropped. |
void dd::cache::Storage_adapter::core_get | ( | const Index_stat::Name_key & | , |
const Index_stat ** | |||
) |
|
private |
Get a dictionary object from core storage.
A clone of the registry object will be returned, owned by the caller.
K | Key type. |
T | Dictionary object type. |
key | Key for which to get the object. | |
[out] | object | Object retrieved, possibly nullptr if not present. |
void dd::cache::Storage_adapter::core_get | ( | const Table_stat::Name_key & | , |
const Table_stat ** | |||
) |
template Object_id dd::cache::Storage_adapter::core_get_id< Tablespace > | ( | const typename T::Name_key & | key | ) |
Get a dictionary object id from core storage.
T | Dictionary object type. |
key | Name key for which to get the object id. |
template size_t dd::cache::Storage_adapter::core_size< Tablespace > | ( | ) |
Get the number of core objects in a registry partition.
T | Dictionary object type. |
void dd::cache::Storage_adapter::core_store | ( | THD * | , |
Index_stat * | |||
) |
void dd::cache::Storage_adapter::core_store | ( | THD * | , |
Table_stat * | |||
) |
void dd::cache::Storage_adapter::core_store | ( | THD * | thd, |
T * | object | ||
) |
Store a dictionary object to core storage.
A clone of the submitted object will be added to the core storage. The caller is still the owner of the submitted objecct.
T | Dictionary object type. |
thd | Thread context. |
object | Object to be stored. |
template bool dd::cache::Storage_adapter::core_sync | ( | THD * | thd, |
const typename T::Name_key & | key, | ||
const T * | object | ||
) |
Sync a dictionary object from persistent to core storage.
T | Dictionary object type. |
thd | Thread context. |
key | Key for object to get from persistent storage. |
object | Object to drop from the core registry. |
void dd::cache::Storage_adapter::core_update | ( | const dd::Tablespace * | new_tsp | ) |
Overload of core_update for dd::Tablespace.
Currently the core registry can only be updated for the DD tablespace when encrypting it. A clone of the dd::Tablespace object passed in is stored in the registry.
new_tsp | the new dd::Tablespace object to keep in the core registry. |
|
inline |
Update the dd object in the core registry.
This is a noop unless this member function is overloaded for a given type. See below.
|
static |
Drop a dictionary object from persistent storage.
T | Dictionary object type. |
thd | Thread context. |
object | Object to be dropped. |
false | No error. |
true | Error. |
void dd::cache::Storage_adapter::dump | ( | ) |
Dump the contents of the core storage.
void dd::cache::Storage_adapter::erase_all | ( | ) |
Remove and delete all elements and objects from core storage.
|
static |
Get a dictionary object from persistent storage.
Create an access key based on the submitted key, and find the record from the appropriate table. Restore the record into a new dictionary object.
K | Key type. |
T | Dictionary object type. |
thd | Thread context. | |
key | Key for which to get the object. | |
isolation | Isolation level. | |
bypass_core_registry | If set to true, get the object from the DD tables. Needed during DD bootstrap. | |
[out] | object | Object retrieved, possibly NULL if not present. |
false | No error. |
true | Error. |
|
static |
|
private |
Generate a new object id for a registry partition.
Simulate an auto increment column. Used when the server is starting, while the scaffolding is being built.
T | Object registry partition. |
|
static |
Store a dictionary object to persistent storage.
T | Dictionary object type. |
thd | Thread context. |
object | Object to be stored. |
false | No error. |
true | Error. |
|
friend |
|
staticprivate |
Use an id not starting at 1 to make it easy to recognize ids generated before objects are stored persistently.
|
private |
|
private |
|
staticprivate |