MySQL 8.4.3
Source Code Documentation
udf_utils.h File Reference

Go to the source code of this file.

Classes

class  privilege_result
 
class  UDF_counter
 Class used to increase an atomic value when UDF functions are being initialized. More...
 
class  Charset_service
 Class that acquire/release the udf_metadata_service from registry service. More...
 

Enumerations

enum class  privilege_status { ok , no_privilege , error }
 Result data type for user_has_gr_admin_privilege. More...
 

Functions

privilege_result user_has_gr_admin_privilege ()
 Checks whether the user has GROUP_REPLICATION_ADMIN privilege. More...
 
void log_privilege_status_result (privilege_result const &privilege, char *message)
 Logs the privilege status of privilege into message. More...
 
std::pair< bool, std::string > check_super_read_only_is_disabled ()
 Checks that super_read_only is disabled on the server. More...
 
bool member_online_with_majority ()
 Checks whether the server is ONLINE and belongs to the majority partition. More...
 
bool group_contains_unreachable_member ()
 Checks if an unreachable member exists in the group. More...
 
bool group_contains_recovering_member ()
 Checks if a member in recovery exists in the group. More...
 
bool validate_uuid_parameter (std::string &uuid, size_t ulength, const char **error_message)
 Checks if the uuid is valid to use in a function It checks: More...
 
bool throw_udf_error (const char *action_name, const char *error_message, bool log_error=false)
 Throw a error on a UDF function with mysql_error_service_printf. More...
 
bool log_group_action_result_message (Group_action_diagnostics *result_area, const char *action_name, char *result_message, unsigned long *length)
 Logs the group action action_name result from result_area into result_message. More...
 
bool check_locked_tables (char *message)
 Checks if tables are locked, and logs to message if so. More...
 
bool group_contains_member_older_than (Member_version const &min_required_version)
 Checks whether the group contains a member older than the specified version. More...
 

Variables

const char *const member_offline_or_minority_str
 
const char *const unreachable_member_on_group_str
 
const char *const recovering_member_on_group_str
 
const char *const server_uuid_not_present_str
 
const char *const server_uuid_not_valid_str
 
const char *const server_uuid_not_on_group_str
 
const char *const preemptive_garbage_collection_enabled_str
 

Enumeration Type Documentation

◆ privilege_status

enum class privilege_status
strong

Result data type for user_has_gr_admin_privilege.

There are three cases:

error: There was an error fetching the user's privileges ok: The user has the required privileges no_privilege: The user does not have the required privileges

In the no_privilege case, the result contains the user's name and host for the caller to create an helpful error message.

Enumerator
ok 
no_privilege 
error 

Function Documentation

◆ check_locked_tables()

bool check_locked_tables ( char *  message)

Checks if tables are locked, and logs to message if so.

Parameters
[out]messagebuffer where the log message will be written to
Return values
trueif tables are not locked
falseif tables are locked (message is written to)

◆ check_super_read_only_is_disabled()

std::pair< bool, std::string > check_super_read_only_is_disabled ( )

Checks that super_read_only is disabled on the server.

Returns
std::pair<bool, std::string> where each element has the following meaning: first element of the pair is the function error value: false Successful true Error second element of the pair is the error message.

◆ group_contains_member_older_than()

bool group_contains_member_older_than ( Member_version const &  min_required_version)

Checks whether the group contains a member older than the specified version.

Parameters
min_required_versionMinimum version required
Returns
true if there is some older member, false otherwise

◆ group_contains_recovering_member()

bool group_contains_recovering_member ( )

Checks if a member in recovery exists in the group.

Return values
trueif a recovering member exists
falseotherwise

◆ group_contains_unreachable_member()

bool group_contains_unreachable_member ( )

Checks if an unreachable member exists in the group.

Return values
trueif an unreachable member exists
falseotherwise

◆ log_group_action_result_message()

bool log_group_action_result_message ( Group_action_diagnostics result_area,
const char *  action_name,
char *  result_message,
unsigned long *  length 
)

Logs the group action action_name result from result_area into result_message.

Parameters
result_areadescribes the log message level
action_namegroup action name
[out]result_messagebuffer where the log message will be written
[out]lengthsize of the log message written to result_message
Return values
truethe group action failed and this function threw/logged the group action's error
falseeverything went OK

◆ log_privilege_status_result()

void log_privilege_status_result ( privilege_result const &  privilege,
char *  message 
)

Logs the privilege status of privilege into message.

Parameters
privilegethe result of user_has_gr_admin_privilege()
[out]messagethe buffer where the log message will be written

◆ member_online_with_majority()

bool member_online_with_majority ( )

Checks whether the server is ONLINE and belongs to the majority partition.

Return values
trueif the member is online and in the majority partition
falseotherwise

◆ throw_udf_error()

bool throw_udf_error ( const char *  action_name,
const char *  error_message,
bool  log_error = false 
)

Throw a error on a UDF function with mysql_error_service_printf.

Parameters
action_namethe action name when the error occurred
error_messagethe error message to print
log_errorshould the error also go to the log (default = false)
Return values
truethe function failed to use the mysql_runtime_error service to throw the error
falseeverything went OK

◆ user_has_gr_admin_privilege()

privilege_result user_has_gr_admin_privilege ( )

Checks whether the user has GROUP_REPLICATION_ADMIN privilege.

Return values
privilege_result::errorif there was an error fetching the user's privileges
privilege_result::no_privilegeif the user does not have the privilege
privilege_result::successif the user has the privilege

◆ validate_uuid_parameter()

bool validate_uuid_parameter ( std::string &  uuid,
size_t  ulength,
const char **  error_message 
)

Checks if the uuid is valid to use in a function It checks:

  1. It is not empty
  2. It is a valid uuid
  3. It belongs to the group
Parameters
uuidthe uuid string
ulengththe length of the uuid string
[out]error_messagethe returned error message
Return values
trueif uuid is not valid
falseotherwise

Variable Documentation

◆ member_offline_or_minority_str

const char* const member_offline_or_minority_str
Initial value:
=
"Member must be ONLINE and in the majority partition."

◆ preemptive_garbage_collection_enabled_str

const char* const preemptive_garbage_collection_enabled_str
Initial value:
=
"The option group_replication_preemptive_garbage_collection is "
"enabled thence the group mode cannot be changed."

◆ recovering_member_on_group_str

const char* const recovering_member_on_group_str
Initial value:
=
"A member is joining the group, wait for it to be ONLINE."

◆ server_uuid_not_on_group_str

const char* const server_uuid_not_on_group_str
Initial value:
=
"The requested uuid is not a member of the group."

◆ server_uuid_not_present_str

const char* const server_uuid_not_present_str
Initial value:
=
"Wrong arguments: You need to specify a server uuid."

◆ server_uuid_not_valid_str

const char* const server_uuid_not_valid_str
Initial value:
=
"Wrong arguments: The server uuid is not valid."

◆ unreachable_member_on_group_str

const char* const unreachable_member_on_group_str
Initial value:
=
"All members in the group must be reachable."