|
| 1 | +/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
| 2 | +
|
| 3 | + This program is free software; you can redistribute it and/or modify |
| 4 | + it under the terms of the GNU General Public License as published by |
| 5 | + the Free Software Foundation; version 2 of the License. |
| 6 | +
|
| 7 | + This program is distributed in the hope that it will be useful, |
| 8 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | + GNU General Public License for more details. |
| 11 | +
|
| 12 | + You should have received a copy of the GNU General Public License |
| 13 | + along with this program; if not, write to the Free Software Foundation, |
| 14 | + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ |
| 15 | + |
| 16 | +#ifndef GROUP_REPLICATION_PRIV_INCLUDE |
| 17 | +#define GROUP_REPLICATION_PRIV_INCLUDE |
| 18 | + |
| 19 | +#ifndef MYSQL_SERVER |
| 20 | +#define MYSQL_SERVER |
| 21 | +#endif |
| 22 | + |
| 23 | +#ifndef HAVE_REPLICATION |
| 24 | +#define HAVE_REPLICATION |
| 25 | +#endif |
| 26 | + |
| 27 | +#include <my_global.h> |
| 28 | +#include <my_thread.h> |
| 29 | +#include <my_sys.h> |
| 30 | + |
| 31 | +#include <debug_sync.h> |
| 32 | +#include <log_event.h> |
| 33 | +#include <replication.h> |
| 34 | +#include <rpl_channel_service_interface.h> |
| 35 | +#include <rpl_gtid.h> |
| 36 | + |
| 37 | + |
| 38 | +/** |
| 39 | + Server side initializations and cleanup. |
| 40 | +*/ |
| 41 | +int group_replication_init(const char* plugin_name); |
| 42 | +int group_replication_cleanup(); |
| 43 | +int group_replication_start(); |
| 44 | +int group_replication_stop(); |
| 45 | + |
| 46 | + |
| 47 | +/** |
| 48 | + Returns the server connection attribute |
| 49 | +
|
| 50 | + @Note This method implementation is on sql_class.cc |
| 51 | +
|
| 52 | + @return the pthread for the connection attribute. |
| 53 | +*/ |
| 54 | +my_thread_attr_t *get_connection_attrib(); |
| 55 | + |
| 56 | + |
| 57 | +/** |
| 58 | + Returns the server hostname, port and uuid. |
| 59 | +
|
| 60 | + @param[out] hostname |
| 61 | + @param[out] port |
| 62 | + @param[out] uuid |
| 63 | +*/ |
| 64 | +void get_server_host_port_uuid(char **hostname, uint *port, char** uuid); |
| 65 | + |
| 66 | + |
| 67 | +/** |
| 68 | + Returns a struct containing all server startup information needed to evaluate |
| 69 | + if one has conditions to proceed executing master-master replication. |
| 70 | +
|
| 71 | + @param[out] requirements |
| 72 | + */ |
| 73 | +void get_server_startup_prerequirements(Trans_context_info& requirements); |
| 74 | + |
| 75 | + |
| 76 | +/** |
| 77 | + Returns if the server engine initialization as ended or not. |
| 78 | +
|
| 79 | + @return is the server ready |
| 80 | + @retval false not ready |
| 81 | + @retval true ready |
| 82 | +*/ |
| 83 | +bool is_server_engine_ready(); |
| 84 | + |
| 85 | + |
| 86 | +/** |
| 87 | + Returns the server GTID_EXECUTED encoded as a binary string. |
| 88 | +
|
| 89 | + @note Memory allocated to encoded_gtid_executed must be release by caller. |
| 90 | +
|
| 91 | + @param[out] encoded_gtid_executed binary string |
| 92 | + @param[out] length binary string length |
| 93 | +*/ |
| 94 | +bool get_server_encoded_gtid_executed(uchar **encoded_gtid_executed, |
| 95 | + uint *length); |
| 96 | + |
| 97 | +#if !defined(DBUG_OFF) |
| 98 | +/** |
| 99 | + Returns a text representation of a encoded GTID set. |
| 100 | +
|
| 101 | + @note Memory allocated to returned pointer must be release by caller. |
| 102 | +
|
| 103 | + @param[in] encoded_gtid_set binary string |
| 104 | + @param[in] length binary string length |
| 105 | +
|
| 106 | + @return a pointer to text representation of the encoded set |
| 107 | +*/ |
| 108 | +char* encoded_gtid_set_to_string(uchar *encoded_gtid_set, uint length); |
| 109 | +#endif |
| 110 | + |
| 111 | + |
| 112 | +/** |
| 113 | + Return last gno for a given sidno, see |
| 114 | + Gtid_state::get_last_executed_gno() for details. |
| 115 | +*/ |
| 116 | +rpl_gno get_last_executed_gno(rpl_sidno sidno); |
| 117 | + |
| 118 | + |
| 119 | +/** |
| 120 | + Return sidno for a given sid, see Sid_map::add_sid() for details. |
| 121 | +*/ |
| 122 | +rpl_sidno get_sidno_from_global_sid_map(rpl_sid sid); |
| 123 | + |
| 124 | + |
| 125 | +/** |
| 126 | + Set slave thread default options. |
| 127 | +
|
| 128 | + @param[in] thd The thread |
| 129 | +*/ |
| 130 | +void set_slave_thread_options(THD* thd); |
| 131 | + |
| 132 | + |
| 133 | +/** |
| 134 | + Add thread to Global_THD_manager singleton. |
| 135 | +
|
| 136 | + @param[in] thd The thread |
| 137 | +*/ |
| 138 | +void global_thd_manager_add_thd(THD *thd); |
| 139 | + |
| 140 | + |
| 141 | +/** |
| 142 | + Remove thread from Global_THD_manager singleton. |
| 143 | +
|
| 144 | + @param[in] thd The thread |
| 145 | +*/ |
| 146 | +void global_thd_manager_remove_thd(THD *thd); |
| 147 | + |
| 148 | + |
| 149 | +#endif /* GROUP_REPLICATION_PRIV_INCLUDE */ |
| 150 | + |
0 commit comments