MySQL 8.0.39
Source Code Documentation
Rpl_info_handler Class Referenceabstract

#include <rpl_info_handler.h>

Inheritance diagram for Rpl_info_handler:
[legend]

Public Types

enum class  enum_field_get_status : int { FIELD_VALUE_NOT_NULL = 0 , FIELD_VALUE_IS_NULL = 1 , FAILURE = 2 }
 

Public Member Functions

 Rpl_info_handler (const Rpl_info_handler &handler)=delete
 
Rpl_info_handleroperator= (const Rpl_info_handler &handler)=delete
 
int init_info ()
 After creating an object and assembling components, this method is used to initialize internal structures. More...
 
enum_return_check check_info ()
 Checks the repository's status. More...
 
int flush_info (const bool force)
 Flushes and syncs in-memory information into a stable storage (i.e. More...
 
int remove_info ()
 Deletes any information in it and in some cases the repository. More...
 
int clean_info ()
 Deletes any information in the repository. More...
 
void end_info ()
 Closes access to the repository. More...
 
int prepare_info_for_read ()
 Enables the storage system to receive reads, i.e. More...
 
int prepare_info_for_write ()
 Enables the storage system to receive writes, i.e. More...
 
uint get_rpl_info_type ()
 Gets the type of the repository that is used. More...
 
const char * get_rpl_info_type_str ()
 Returns a string corresponding to the type. More...
 
template<class TypeHandler >
bool set_info (TypeHandler const value)
 Sets the value of a field to value. More...
 
template<class TypeHandler >
bool set_info (TypeHandler const value, const size_t size)
 
template<class TypeHandler >
bool set_info (int pk_cursor, TypeHandler const value)
 set the value of a field pointed at pk_cursor to @ value. More...
 
template<class TypeHandlerPointer , class TypeHandler >
enum_field_get_status get_info (TypeHandlerPointer value, TypeHandler const default_value)
 Returns the value of a field. More...
 
template<class TypeHandler >
enum_field_get_status get_info (TypeHandler value, const size_t size, std::add_const_t< std::remove_pointer_t< TypeHandler > > *default_value)
 Returns the value of a string field. More...
 
enum_field_get_status get_info (Server_ids *value, const Server_ids *default_value)
 Returns the value of a Server_id field. More...
 
int get_number_info ()
 Returns the number of fields handled by this handler. More...
 
void set_sync_period (uint period)
 Configures the number of events after which the info (e.g. More...
 
char * get_description_info ()
 Returns a string describing the repository. More...
 
bool is_transactional ()
 Any transactional repository may have its updates rolled back in case of a failure. More...
 
bool update_is_transactional ()
 Updates the value returned by the member function is_transactional() because it may be expensive to compute it whenever is_transactional() is called. More...
 
virtual ~Rpl_info_handler ()
 

Public Attributes

Rpl_info_valuesfield_values
 

Protected Member Functions

 Rpl_info_handler (const int nparam, MY_BITMAP const *nullable_bitmap)
 
bool is_field_nullable (int pos)
 Checks whether or not the field at position pos is allowed to be NULL. More...
 

Protected Attributes

int ninfo
 
int cursor
 
bool prv_error
 
enum_field_get_status prv_get_error
 
uint sync_counter
 
uint sync_period
 
MY_BITMAP nullable_fields
 Bitset holding which of the fields are allowed to be NULL. More...
 

Private Member Functions

virtual int do_init_info ()=0
 
virtual int do_init_info (uint instance)=0
 
virtual enum_return_check do_check_info ()=0
 
virtual enum_return_check do_check_info (uint instance)=0
 
virtual int do_flush_info (const bool force)=0
 
virtual int do_remove_info ()=0
 
virtual int do_clean_info ()=0
 
virtual void do_end_info ()=0
 
virtual int do_prepare_info_for_read ()=0
 
virtual int do_prepare_info_for_write ()=0
 
virtual bool do_set_info (const int pos, const char *value)=0
 
virtual bool do_set_info (const int pos, const uchar *value, const size_t size)=0
 
virtual bool do_set_info (const int pos, const ulong value)=0
 
virtual bool do_set_info (const int pos, const int value)=0
 
virtual bool do_set_info (const int pos, const float value)=0
 
virtual bool do_set_info (const int pos, const Server_ids *value)=0
 
virtual bool do_set_info (const int pos, const std::nullptr_t value)=0
 
virtual bool do_set_info (const int pos, const std::nullptr_t value, const size_t size)=0
 
virtual enum_field_get_status do_get_info (const int pos, char *value, const size_t size, const char *default_value)=0
 
virtual enum_field_get_status do_get_info (const int pos, uchar *value, const size_t size, const uchar *default_value)=0
 
virtual enum_field_get_status do_get_info (const int pos, ulong *value, const ulong default_value)=0
 
virtual enum_field_get_status do_get_info (const int pos, int *value, const int default_value)=0
 
virtual enum_field_get_status do_get_info (const int pos, float *value, const float default_value)=0
 
virtual enum_field_get_status do_get_info (const int pos, Server_ids *value, const Server_ids *default_value)=0
 
virtual char * do_get_description_info ()=0
 
virtual bool do_is_transactional ()=0
 
virtual bool do_update_is_transactional ()=0
 
virtual uint do_get_rpl_info_type ()=0
 

Friends

class Rpl_info_factory
 

Member Enumeration Documentation

◆ enum_field_get_status

enum class Rpl_info_handler::enum_field_get_status : int
strong
Enumerator
FIELD_VALUE_NOT_NULL 
FIELD_VALUE_IS_NULL 
FAILURE 

Constructor & Destructor Documentation

◆ Rpl_info_handler() [1/2]

Rpl_info_handler::Rpl_info_handler ( const Rpl_info_handler handler)
delete

◆ ~Rpl_info_handler()

Rpl_info_handler::~Rpl_info_handler ( )
virtual

◆ Rpl_info_handler() [2/2]

Rpl_info_handler::Rpl_info_handler ( const int  nparam,
MY_BITMAP const *  nullable_bitmap 
)
protected

Member Function Documentation

◆ check_info()

enum_return_check Rpl_info_handler::check_info ( )
inline

Checks the repository's status.

Return values
REPOSITORY_EXISTSreposistory is ready to be used.
REPOSITORY_DOES_NOT_EXISTrepository needs to be configured.
ERROR_CHECKING_REPOSITORYerror while checking the reposistory.

◆ clean_info()

int Rpl_info_handler::clean_info ( )
inline

Deletes any information in the repository.

In contrast to the remove_info() method, the repository is not removed.

Return values
falseNo error
trueFailure

◆ do_check_info() [1/2]

virtual enum_return_check Rpl_info_handler::do_check_info ( )
privatepure virtual

◆ do_check_info() [2/2]

virtual enum_return_check Rpl_info_handler::do_check_info ( uint  instance)
privatepure virtual

◆ do_clean_info()

virtual int Rpl_info_handler::do_clean_info ( )
privatepure virtual

◆ do_end_info()

virtual void Rpl_info_handler::do_end_info ( )
privatepure virtual

◆ do_flush_info()

virtual int Rpl_info_handler::do_flush_info ( const bool  force)
privatepure virtual

◆ do_get_description_info()

virtual char * Rpl_info_handler::do_get_description_info ( )
privatepure virtual

◆ do_get_info() [1/6]

virtual enum_field_get_status Rpl_info_handler::do_get_info ( const int  pos,
char *  value,
const size_t  size,
const char *  default_value 
)
privatepure virtual

◆ do_get_info() [2/6]

virtual enum_field_get_status Rpl_info_handler::do_get_info ( const int  pos,
float *  value,
const float  default_value 
)
privatepure virtual

◆ do_get_info() [3/6]

virtual enum_field_get_status Rpl_info_handler::do_get_info ( const int  pos,
int *  value,
const int  default_value 
)
privatepure virtual

◆ do_get_info() [4/6]

virtual enum_field_get_status Rpl_info_handler::do_get_info ( const int  pos,
Server_ids value,
const Server_ids default_value 
)
privatepure virtual

◆ do_get_info() [5/6]

virtual enum_field_get_status Rpl_info_handler::do_get_info ( const int  pos,
uchar value,
const size_t  size,
const uchar default_value 
)
privatepure virtual

◆ do_get_info() [6/6]

virtual enum_field_get_status Rpl_info_handler::do_get_info ( const int  pos,
ulong *  value,
const ulong  default_value 
)
privatepure virtual

◆ do_get_rpl_info_type()

virtual uint Rpl_info_handler::do_get_rpl_info_type ( )
privatepure virtual

◆ do_init_info() [1/2]

virtual int Rpl_info_handler::do_init_info ( )
privatepure virtual

◆ do_init_info() [2/2]

virtual int Rpl_info_handler::do_init_info ( uint  instance)
privatepure virtual

◆ do_is_transactional()

virtual bool Rpl_info_handler::do_is_transactional ( )
privatepure virtual

◆ do_prepare_info_for_read()

virtual int Rpl_info_handler::do_prepare_info_for_read ( )
privatepure virtual

◆ do_prepare_info_for_write()

virtual int Rpl_info_handler::do_prepare_info_for_write ( )
privatepure virtual

◆ do_remove_info()

virtual int Rpl_info_handler::do_remove_info ( )
privatepure virtual

◆ do_set_info() [1/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const char *  value 
)
privatepure virtual

◆ do_set_info() [2/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const float  value 
)
privatepure virtual

◆ do_set_info() [3/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const int  value 
)
privatepure virtual

◆ do_set_info() [4/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const Server_ids value 
)
privatepure virtual

◆ do_set_info() [5/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const std::nullptr_t  value 
)
privatepure virtual

◆ do_set_info() [6/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const std::nullptr_t  value,
const size_t  size 
)
privatepure virtual

◆ do_set_info() [7/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const uchar value,
const size_t  size 
)
privatepure virtual

◆ do_set_info() [8/8]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const ulong  value 
)
privatepure virtual

◆ do_update_is_transactional()

virtual bool Rpl_info_handler::do_update_is_transactional ( )
privatepure virtual

◆ end_info()

void Rpl_info_handler::end_info ( )
inline

Closes access to the repository.

◆ flush_info()

int Rpl_info_handler::flush_info ( const bool  force)
inline

Flushes and syncs in-memory information into a stable storage (i.e.

repository). Usually, syncing after flushing depends on other options such as relay-log-info-sync, master-info-sync. These options dictate after how many events or transactions the information should be synced. We can ignore them and always sync by setting the parameter force, which is by default false, to true.

So if the number of events is below a threshold, the parameter force is false and we are using a file system as a storage system, it may happen that the changes will only end up in the operating system's cache and a crash may lead to inconsistencies.

Return values
falseNo error
trueFailure

◆ get_description_info()

char * Rpl_info_handler::get_description_info ( )
inline

Returns a string describing the repository.

For instance, if the repository is a file, the returned string is path where data is stored.

Returns
a pointer to a string.

◆ get_info() [1/3]

enum_field_get_status Rpl_info_handler::get_info ( Server_ids value,
const Server_ids default_value 
)
inline

Returns the value of a Server_id field.

Any call must be done in the right order which is defined by the caller that wants to return the information.

Parameters
[out]valueValue to be return.
[in]default_valueReturns a default value if the field is empty.
Return values
falseNo error
trueFailure

◆ get_info() [2/3]

template<class TypeHandler >
enum_field_get_status Rpl_info_handler::get_info ( TypeHandler  value,
const size_t  size,
std::add_const_t< std::remove_pointer_t< TypeHandler > > *  default_value 
)
inline

Returns the value of a string field.

Any call must be done in the right order which is defined by the caller that wants to return the information.

Parameters
[in]valueValue to be returned.
[in]sizeMax size of the string to be returned.
[in]default_valueReturns a default value if the field is empty.

TypeHandler is either char* or uchar*, while default_value is const char* or const uchar*. Some type trait magic is required to make char* / uchar* into const char* / uchar*.

Return values
falseNo error
trueFailure

◆ get_info() [3/3]

template<class TypeHandlerPointer , class TypeHandler >
enum_field_get_status Rpl_info_handler::get_info ( TypeHandlerPointer  value,
TypeHandler const  default_value 
)
inline

Returns the value of a field.

Any call must be done in the right order which is defined by the caller that wants to return the information.

Parameters
[in]valueValue to be set.
[in]default_valueReturns a default value if the field is empty.
Return values
falseNo error
trueFailure

◆ get_number_info()

int Rpl_info_handler::get_number_info ( )
inline

Returns the number of fields handled by this handler.

Returns
Number of fields handled by the handler.

◆ get_rpl_info_type()

uint Rpl_info_handler::get_rpl_info_type ( )
inline

Gets the type of the repository that is used.

Returns
Type of repository.

◆ get_rpl_info_type_str()

const char * Rpl_info_handler::get_rpl_info_type_str ( )

Returns a string corresponding to the type.

◆ init_info()

int Rpl_info_handler::init_info ( )
inline

After creating an object and assembling components, this method is used to initialize internal structures.

Everything that does not depend on other components (e.g. mutexes) should be placed in the object's constructor though.

Return values
falsesuccess,
trueotherwise error.

◆ is_field_nullable()

bool Rpl_info_handler::is_field_nullable ( int  pos)
protected

Checks whether or not the field at position pos is allowed to be NULL.

Returns
true if the field is allowed to be NULL and false otherwise.

◆ is_transactional()

bool Rpl_info_handler::is_transactional ( )
inline

Any transactional repository may have its updates rolled back in case of a failure.

If this is possible, the repository is classified as transactional.

Return values
trueIf transactional.
falseOtherwise.

◆ operator=()

Rpl_info_handler & Rpl_info_handler::operator= ( const Rpl_info_handler handler)
delete

◆ prepare_info_for_read()

int Rpl_info_handler::prepare_info_for_read ( )
inline

Enables the storage system to receive reads, i.e.

getters.

Return values
falseNo error
trueFailure

◆ prepare_info_for_write()

int Rpl_info_handler::prepare_info_for_write ( )
inline

Enables the storage system to receive writes, i.e.

setters.

Return values
falseNo error
trueFailure

◆ remove_info()

int Rpl_info_handler::remove_info ( )
inline

Deletes any information in it and in some cases the repository.

The decision to remove the repository is delegated to the developer.

Return values
falseNo error
trueFailure

◆ set_info() [1/3]

template<class TypeHandler >
bool Rpl_info_handler::set_info ( int  pk_cursor,
TypeHandler const  value 
)
inline

set the value of a field pointed at pk_cursor to @ value.

Parameters
[in]pk_cursorcursor for the field value.
[in]valuefield[pk_cursor] is set to this value.
Return values
falseok
trueerror.

◆ set_info() [2/3]

template<class TypeHandler >
bool Rpl_info_handler::set_info ( TypeHandler const  value)
inline

Sets the value of a field to value.

Any call must be done in the right order which is defined by the caller that wants to persist the information.

Parameters
[in]valueValue to be set.
Return values
falseNo error
trueFailure

◆ set_info() [3/3]

template<class TypeHandler >
bool Rpl_info_handler::set_info ( TypeHandler const  value,
const size_t  size 
)
inline

◆ set_sync_period()

void Rpl_info_handler::set_sync_period ( uint  period)

Configures the number of events after which the info (e.g.

master info, relay log info) must be synced when flush() is called.

Parameters
[in]periodNumber of events.

◆ update_is_transactional()

bool Rpl_info_handler::update_is_transactional ( )
inline

Updates the value returned by the member function is_transactional() because it may be expensive to compute it whenever is_transactional() is called.

In the current implementation, the type of the repository can only be changed when replication, i.e. slave, is stopped. For that reason, this member function, i.e. update_is__transactional(), must be called when slave is starting.

Return values
falseNo error
trueFailure

Friends And Related Function Documentation

◆ Rpl_info_factory

friend class Rpl_info_factory
friend

Member Data Documentation

◆ cursor

int Rpl_info_handler::cursor
protected

◆ field_values

Rpl_info_values* Rpl_info_handler::field_values

◆ ninfo

int Rpl_info_handler::ninfo
protected

◆ nullable_fields

MY_BITMAP Rpl_info_handler::nullable_fields
protected

Bitset holding which of the fields are allowed to be NULL.

◆ prv_error

bool Rpl_info_handler::prv_error
protected

◆ prv_get_error

enum_field_get_status Rpl_info_handler::prv_get_error
protected

◆ sync_counter

uint Rpl_info_handler::sync_counter
protected

◆ sync_period

uint Rpl_info_handler::sync_period
protected

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