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.";
48 "The option group_replication_preemptive_garbage_collection is "
49 "enabled thence the group mode cannot be changed.";
68 "get_user() can only be called if status == no_privilege");
73 "get_host() can only be called if status == no_privilege");
92 "privilege_result(status) can only be called if status != "
196 const char **error_message);
209bool throw_udf_error(
const char *action_name,
const char *error_message,
226 const char *action_name,
227 char *result_message,
288 UDF_INIT *initid,
const std::string &charset_name =
"latin1");
300 const std::string &charset_name =
"latin1");
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Class that acquire/release the udf_metadata_service from registry service.
Definition: udf_utils.h:254
static bool init(const mysql_service_registry_t *reg_srv)
Acquires the udf_metadata_service from the registry service.
Definition: udf_utils.cc:282
static bool deinit(const mysql_service_registry_t *reg_srv)
Release the udf_metadata service.
Definition: udf_utils.cc:291
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:311
static const mysql_service_mysql_udf_metadata_t * udf_metadata_service
Definition: udf_utils.h:308
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:301
static const char * arg_type
Definition: udf_utils.h:304
static const char * service_name
Definition: udf_utils.h:306
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:109
bool success
Definition: udf_utils.h:123
static bool is_zero()
Definition: udf_utils.h:113
UDF_counter()
Definition: udf_utils.h:115
static void terminated()
Definition: udf_utils.h:112
void succeeded()
Definition: udf_utils.h:120
~UDF_counter()
Definition: udf_utils.h:116
static std::atomic< int > number_udfs_running
Definition: udf_utils.h:111
Definition: udf_utils.h:63
privilege_result(privilege_status status)
Definition: udf_utils.h:89
char const * get_host() const
Definition: udf_utils.h:71
privilege_result(char const *user, char const *host)
Definition: udf_utils.h:95
char const * user
Definition: udf_utils.h:87
static privilege_result error()
Definition: udf_utils.h:79
char const * host
Definition: udf_utils.h:88
char const * get_user() const
Definition: udf_utils.h:66
privilege_status status
Definition: udf_utils.h:65
static privilege_result success()
Definition: udf_utils.h:76
static privilege_result no_privilege(char const *user, char const *host)
Definition: udf_utils.h:82
#define log_error(...)
Definition: log_client.h:155
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
const char *const preemptive_garbage_collection_enabled_str
Definition: udf_utils.h:47
bool check_locked_tables(char *message)
Checks if tables are locked, and logs to message if so.
Definition: udf_utils.cc:240
bool group_contains_recovering_member()
Checks if a member in recovery exists in the group.
Definition: udf_utils.cc:153
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:205
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:89
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:184
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:162
bool member_online_with_majority()
Checks whether the server is ONLINE and belongs to the majority partition.
Definition: udf_utils.cc:130
bool group_contains_unreachable_member()
Checks if an unreachable member exists in the group.
Definition: udf_utils.cc:144
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:110
privilege_status
Result data type for user_has_gr_admin_privilege.
Definition: udf_utils.h:62
privilege_result user_has_gr_admin_privilege()
Checks whether the user has GROUP_REPLICATION_ADMIN privilege.
Definition: udf_utils.cc:35
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:255