WL#12544: Component service interface of my_error api
Affects: Server-8.0
—
Status: Complete
The minimal chassis need to use the my_error api to report error message to the mysql client when the dynamic loader load/unload fails. Since my_error is part of mysqld binary, and the my_error code is not visible for the minimal chassis library. This wl adds a new error report service to minimal chassis and it will be override in mysql_server component to call my_error.
FR1: A new service called mysql_runtime_error is added to minimal_chassis FR2: minimal_chassis will have a default implementation for the mysql_runtime_error which prints the error to the stdout. FR3: mysql_server component override mysql_runtime_error service with an implementation that will call my_error. FR4: A utility function will be implemented which can be used directly, without using the acquire mysql_runtime_error service api.
1) Default mysql_runtime_error service implementation, which prints the error message to the stdout. BEGIN_SERVICE_IMPLEMENTATION(mysql_minimal_chassis, mysql_runtime_error) mysql_report_error_imp::emit END_SERVICE_IMPLEMENTATION(); 2) The default mysql_runtime_error service implementation will override with mysql_server mysql_runtime_error. This implementation calls the actual my_error() functionality. BEGIN_SERVICE_IMPLEMENTATION(mysql_server, mysql_runtime_error) mysql_server_report_error_imp::emit END_SERVICE_IMPLEMENTATION(); 3) components/mysql_server/mysql_runtime_error.h class mysql_runtime_error_imp { public: /** This function reports the given error to the caller. @param error_id error id is used to retrieve the error description. @param flags flags for the given error do decide where to print the error @param args variable list arguments which holds error message format string */ static DEFINE_METHOD(void, emit, (int error_id, int flags, va_list args)); }; 4) /** Ease of use utility function to print the error message via @ref mysql_service_mysql_runtime_error_t This function calls the mysql_runtime_error_imp::emit function. @param error_svc_handle The mysql_runtime_error service handle. @param error_id Used to fetch the corresponding error message. @param flags Used to decide, where to print the error message. @param ... variable list which holds error message format string */ inline void mysql_error_service_emit_printf( SERVICE_TYPE(mysql_runtime_error) *error_svc_handle, int error_id, int flags, ...) 5) /** This function calls the mysql_runtime_error_imp::emit function. This function gets the required mysql_runtime_service from REQUIRES_SERVICE_PLACEHOLDER. @param error_id Used to fetch the corresponding error message. @param flags Used to decide, where to print the error message. @param ... variable list which holds error message format string */ inline void mysql_error_service_printf(int nr, myf MyFlags, ...)
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.