MySQL  8.0.18
Source Code Documentation
mysql_persistent_dynamic_loader_imp Class Reference

Allows to wrap another Service Implementation of the Dynamic Loader service and add ability to store a list of groups of loaded components. More...

#include <persistent_dynamic_loader.h>

Static Public Member Functions

static bool init (void *thdp)
 Initializes persistence store, loads all groups of components registered in component table. More...
 
static void deinit ()
 De-initializes persistence loader. More...
 
static bool initialized ()
 
Initialisation status of persistence loader. More...
 
static mysql_service_status_t load (void *thd_ptr, const char *urns[], int component_count) noexcept
 Loads specified group of components by URN, initializes them and registers all service implementations present in these components. More...
 
static mysql_service_status_t unload (void *thd_ptr, const char *urns[], int component_count) noexcept
 Unloads specified group of Components by URN, deinitializes them and unregisters all service implementations present in these components. More...
 

Static Private Attributes

static std::atomic< uint64group_id
 Stores last group ID used in component table. More...
 
static std::map< std::string, uint64component_id_by_urn
 Stores mapping of component URNs to their component_id used in component table, to ease row deletion. More...
 
static bool is_initialized = false
 Indicates the initialization status of dynamic loader persistence. More...
 
static mysql_mutex_t component_id_by_urn_mutex
 Serializes access to component_id_by_urn. More...
 

Detailed Description

Allows to wrap another Service Implementation of the Dynamic Loader service and add ability to store a list of groups of loaded components.

It reacts on successful invocations of the underlying Dynamic Loader Service Implementation methods load() and unload() and saves changes. It also loads during the start of the MySQL Server all groups of the Components that were still loaded on last MySQL Server shutdown, they are loaded in order of the original loads. It assumes that components does not any not fully-deterministic loads of another Components, which would break dependencies if they are decided to load other Components than last time. The list of groups of Components is stored in the 'mysql.component' table. It is valid to unload only part of the group of the previously loaded group of Components. In such a situation, as long as all dependencies are met, which is assured by the underlying Service Implementation, the rest of Components in group should load successfully after the MySQL Server restart.

Member Function Documentation

◆ deinit()

void mysql_persistent_dynamic_loader_imp::deinit ( )
static

De-initializes persistence loader.

◆ init()

bool mysql_persistent_dynamic_loader_imp::init ( void *  thdp)
static

Initializes persistence store, loads all groups of components registered in component table.

Shouldn't be called multiple times. We assume the order specified by group ID is correct one. This should be assured by dynamic loader as long as it will not allow to unload the component that has dependency on, in case there would be a possibility to switch that dependency to other component that is not to be unloaded. If this is assured, then it will not be possible for components with lower group IDs to have a dependency on component with higher group ID, even after state is restored in this initialization method.

Parameters
thdpCurrent thread execution context
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ initialized()

bool mysql_persistent_dynamic_loader_imp::initialized ( )
static


Initialisation status of persistence loader.

An helper function.

Returns
Status of performed operation
Return values
trueinitialization is done
falseinitialization is not done

◆ load()

mysql_service_status_t mysql_persistent_dynamic_loader_imp::load ( void *  thd_ptr,
const char *  urns[],
int  component_count 
)
staticnoexcept

Loads specified group of components by URN, initializes them and registers all service implementations present in these components.

Assures all dependencies will be met after loading specified components. The dependencies may be circular, in such case it's necessary to specify all components on cycle to load in one batch. From URNs specified the scheme part of URN (part before "://") is extracted and used to acquire service implementation of scheme component loader service for specified scheme. If the loading process successes then a group of Components by their URN is added to the component table.

Parameters
thd_ptrCurrent thread execution context.
urnsList of URNs of Components to load.
component_countNumber of Components on list to load.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ unload()

mysql_service_status_t mysql_persistent_dynamic_loader_imp::unload ( void *  thd_ptr,
const char *  urns[],
int  component_count 
)
staticnoexcept

Unloads specified group of Components by URN, deinitializes them and unregisters all service implementations present in these components.

Assumes, although does not check it, all dependencies of not unloaded components will still be met after unloading specified components. The dependencies may be circular, in such case it's necessary to specify all components on cycle to unload in one batch. From URNs specified the scheme part of URN (part before "://") is extracted and used to acquire service implementation of scheme component loader service for specified scheme. URN specified should be identical to ones specified in load() method, i.e. all letters must have the same case. If the unloading process successes then a group of Components by their URN is added to the component table.

Parameters
thd_ptrCurrent thread execution context.
urnsList of URNs of components to unload.
component_countNumber of components on list to unload.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

Member Data Documentation

◆ component_id_by_urn

std::map< my_string, uint64 > mysql_persistent_dynamic_loader_imp::component_id_by_urn
staticprivate

Stores mapping of component URNs to their component_id used in component table, to ease row deletion.

◆ component_id_by_urn_mutex

mysql_mutex_t mysql_persistent_dynamic_loader_imp::component_id_by_urn_mutex
staticprivate

Serializes access to component_id_by_urn.

◆ group_id

std::atomic< uint64 > mysql_persistent_dynamic_loader_imp::group_id
staticprivate

Stores last group ID used in component table.

It is initialized on init() on component table scan with maximum group ID used in table.

◆ is_initialized

bool mysql_persistent_dynamic_loader_imp::is_initialized = false
staticprivate

Indicates the initialization status of dynamic loader persistence.


The documentation for this class was generated from the following files: