WL#7060: Group Replication: Plugin
Affects: Server-5.7
—
Status: Complete
EXECUTIVE SUMMARY ================= This task design and implements the GCS plugin, that is, it will be the base plugin where everybody will add their tasks. It should implement (initially with dumb actions) the callers of gcs_interface->join(): 1) On server bootstrap, and when the plugin is loaded and the server is set to automatically join the cluster. 2) When the user stops and starts GCS replication START REPLICATION GCS; and other needed commands.
Functional Requirements : ========================== 1. Two new SQL statements are to be developed for starting and stopping Group Replication. Non-Functional Requirements : ============================== 1. No substantial degradation in the performance of the server should be there in the absence of the plugin.
High level Specification ========================= Prior to 5.7 MySQL supported asynchronous and semi-synchronous replication. In 5.7 we introducing the adding the new replication support ie. Synchronous replication. ============= PLAN ============== This worklog will implement a dynamic plugin, when the plugin is INSTALLED in the system then we provide user with sets of commands that will interact with the server code to implement this virtual-synchronous replication. If any of the above mentioned query is executed and if plugin is installed then this plugin functions will be called which will ensure the synchronous transfer of data from one node in the cluster to other nodes in the cluster. If plugin in not installed then all replication will proceed as usual in the legacy asynchronous way. PLUGIN SPECIFICATION: ===================== A new plugin type to be created. It will have its own plugin API. PLUGIN API: plugin API contains some functions which will interact with the server code using the server replication hooks.
Low level design for the WL#7060 ================================= New Files/Folders to be added ------------------------------ include/mysql/plugin_gcs_rpl.h - (containing API for new plugin type) plugin/gcs_replication/ - The base folder which will contain the entire plugin code. plugin/gcs_replication/CMakeLists.txt - The CMAKE file for the plugin compilation plugin/gcs_replication/gcs_plugin.cc - Containing the plugin plugin/gcs_replication/gcs_replication.cc - uses the new plugin to implement the GCS replication plugin/gcs_replication/gcs_replication.h - The corresponding header file. plugin/gcs_replication/include/ - Subfolder for the " .h " files to be created. plugin/gcs_replication/include/gcs_plugin.h - The header file for the new plugin implemented. New Classes/Functions to be added ---------------------------------- The plugin will have its declaration in the gcs_plugin.cc file in the new plugin directory with the definition of the initialization and the deinitialization of the plugin declared. mysql_declare_plugin(gcs_rpl_plugin) { MYSQL_GCS_RPL_PLUGIN, &gcs_rpl_descriptor, "gcs_plugin", "ORACLE", "GCS replication plugin", PLUGIN_LICENSE_GPL, gcs_replication_init, /* Plugin Init */ gcs_replication_deinit, /* Plugin Deinit */ 0x0001, /* 1.0 Plugin version*/ NULL, /* status variables */ gcs_system_vars, /* system variables */ NULL, /* config options */ 0, /* flags */ } mysql_declare_plugin_end; static MYSQL_SYSVAR_BOOL(boot, gcs_replication_boot, .... static MYSQL_SYSVAR_STR(gcs_group, gcs_replication_group, ..... static SYS_VAR* gcs_system_vars[]= { .... During the initialization the observers of the hook defined in the server will be registered, mainly the server state observers : int gcs_replication_init(void *p) { ..... if (gcs_rpl_handler.gcs_init()) return 1; if (register_server_state_observer(&server_state_observer, p)) return 1; if (gcs_replication_boot) { .... } .... } Similarly during deinitialization the registered observers has to be removed. static int gcs_replication_deinit(void *p) { .... if (unregister_server_state_observer(&server_state_observer, p)) { ..... } ...... } The new Gcs_replication_handler class which has some basic functionality that will be defined in the gcs_replicaton.cc class Gcs_replication_handler { public: Gcs_replication_handler(); ~Gcs_replication_handler(); int gcs_rpl_start(); int gcs_rpl_stop(); int gcs_init(); private: LEX_STRING plugin_name; plugin_ref plugin; st_mysql_gcs_rpl* proto; }; int init_gcs_rpl(); int start_gcs_rpl(); int stop_gcs_rpl(); int cleanup_gcs_rpl(); Plugin API functions : ----------------------- The various plugin functions will be defined in the gcs_replication.cc file. Some basic functionality are start_gcs_replication() /* to start the GCS replication when the user gives the necessary command. */ stop_gcs_replication() /* to stop the GCS replication when the user gives the necessary command. */ Plugin API ----------- struct st_mysql_gcs_rpl { int interface_version; /* This function is to used to start the gcs replication based on the gcs group that is specified by the user. */ int (*start_gcs_rpl)(); /* This function is used by the stop the gcs replication based in a given group. */ int (*stop_gcs_rpl)(); }; New SQL commands to be implemented ------------------------------------ We will be implementing couple of new SQL commands as a part of implementing this worklog. START GCS_REPLICATION STOP GCS_REPLICATION defined in sql_parse.cc This will be a configurable parameter either command line or through the cnf file. case SQLCOM_START_GCS_REPLICATION: { ..... } case SQLCOM_STOP_GCS_REPLICATION: { ..... } Both these commands will be auto committing the current transactions. Similar to stop and start slave.
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.