MySQL 8.3.0
Source Code Documentation
udf_utils.cc File Reference

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 length, 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)
 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...
 

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