24#ifndef PLUGIN_GR_INCLUDE_UDF_UTILS_H
25#define PLUGIN_GR_INCLUDE_UDF_UTILS_H
36 "Member must be ONLINE and in the majority partition.";
38 "All members in the group must be reachable.";
40 "A member is joining the group, wait for it to be ONLINE.";
42 "Wrong arguments: You need to specify a server uuid.";
44 "Wrong arguments: The server uuid is not valid.";
46 "The requested uuid is not a member of the group.";
65 "get_user() can only be called if status == no_privilege");
70 "get_host() can only be called if status == no_privilege");
89 "privilege_result(status) can only be called if status != "
193 const char **error_message);
206bool throw_udf_error(
const char *action_name,
const char *error_message,
223 const char *action_name,
224 char *result_message,
285 UDF_INIT *initid,
const std::string &charset_name =
"latin1");
297 const std::string &charset_name =
"latin1");
#define log_error
Definition: log_client.h:111
Class that acquire/release the udf_metadata_service from registry service.
Definition: udf_utils.h:251
static bool init(const mysql_service_registry_t *reg_srv)
Acquires the udf_metadata_service from the registry service.
Definition: udf_utils.cc:280
static bool deinit(const mysql_service_registry_t *reg_srv)
Release the udf_metadata service.
Definition: udf_utils.cc:289
static bool set_args_charset(UDF_ARGS *args, const std::string &charset_name="latin1")
Set the specified character set of all UDF arguments.
Definition: udf_utils.cc:309
static const mysql_service_mysql_udf_metadata_t * udf_metadata_service
Definition: udf_utils.h:305
static bool set_return_value_charset(UDF_INIT *initid, const std::string &charset_name="latin1")
Set the specified character set of UDF return value.
Definition: udf_utils.cc:299
static const char * arg_type
Definition: udf_utils.h:301
static const char * service_name
Definition: udf_utils.h:303
The parent class for group wide operations.
Definition: group_action.h:35
represent the MySQL version of a Member within the Group Replication group.
Definition: member_version.h:35
Class used to increase an atomic value when UDF functions are being initialized.
Definition: udf_utils.h:106
bool success
Definition: udf_utils.h:120
static bool is_zero()
Definition: udf_utils.h:110
UDF_counter()
Definition: udf_utils.h:112
static void terminated()
Definition: udf_utils.h:109
void succeeded()
Definition: udf_utils.h:117
~UDF_counter()
Definition: udf_utils.h:113
static std::atomic< int > number_udfs_running
Definition: udf_utils.h:108
Definition: udf_utils.h:60
privilege_result(privilege_status status)
Definition: udf_utils.h:86
char const * get_host() const
Definition: udf_utils.h:68
privilege_result(char const *user, char const *host)
Definition: udf_utils.h:92
char const * user
Definition: udf_utils.h:84
static privilege_result error()
Definition: udf_utils.h:76
char const * host
Definition: udf_utils.h:85
char const * get_user() const
Definition: udf_utils.h:63
privilege_status status
Definition: udf_utils.h:62
static privilege_result success()
Definition: udf_utils.h:73
static privilege_result no_privilege(char const *user, char const *host)
Definition: udf_utils.h:79
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
Definition: udf_registration_types.h:48
Information about the result of a user defined function.
Definition: udf_registration_types.h:66
static const mysql_service_registry_t * reg_srv
Initialize parameters required for error logging.
Definition: test_plugin.cc:62
const char *const server_uuid_not_on_group_str
Definition: udf_utils.h:45
const char *const server_uuid_not_present_str
Definition: udf_utils.h:41
bool check_locked_tables(char *message)
Checks if tables are locked, and logs to message if so.
Definition: udf_utils.cc:238
bool group_contains_recovering_member()
Checks if a member in recovery exists in the group.
Definition: udf_utils.cc:151
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.
Definition: udf_utils.cc:203
const char *const recovering_member_on_group_str
Definition: udf_utils.h:39
void log_privilege_status_result(privilege_result const &privilege, char *message)
Logs the privilege status of privilege into message.
Definition: udf_utils.cc:87
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.
Definition: udf_utils.cc:182
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:
Definition: udf_utils.cc:160
bool member_online_with_majority()
Checks whether the server is ONLINE and belongs to the majority partition.
Definition: udf_utils.cc:128
bool group_contains_unreachable_member()
Checks if an unreachable member exists in the group.
Definition: udf_utils.cc:142
std::pair< bool, std::string > check_super_read_only_is_disabled()
Checks that super_read_only is disabled on the server.
Definition: udf_utils.cc:108
privilege_status
Result data type for user_has_gr_admin_privilege.
Definition: udf_utils.h:59
privilege_result user_has_gr_admin_privilege()
Checks whether the user has GROUP_REPLICATION_ADMIN privilege.
Definition: udf_utils.cc:33
const char *const unreachable_member_on_group_str
Definition: udf_utils.h:37
const char *const member_offline_or_minority_str
Definition: udf_utils.h:35
const char *const server_uuid_not_valid_str
Definition: udf_utils.h:43
bool group_contains_member_older_than(Member_version const &min_required_version)
Checks whether the group contains a member older than the specified version.
Definition: udf_utils.cc:253