1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLE_SERVER_SLAVE_H
21
#define DRIZZLE_SERVER_SLAVE_H
1
/* Copyright (C) 2000-2003 MySQL AB
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.
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.
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
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24
20
@defgroup Replication Replication
95
93
run_lock protects all information about the run state: slave_running, thd
96
94
and the existence of the I/O thread to stop/start it, you need this mutex).
97
95
data_lock protects some moving members of the struct: counters (log name,
98
position) and relay log (DRIZZLE_BIN_LOG object).
96
position) and relay log (MYSQL_BIN_LOG object).
100
98
In Relay_log_info: run_lock, data_lock
103
101
Order of acquisition: if you want to have LOCK_active_mi and a run_lock, you
104
102
must acquire LOCK_active_mi first.
106
In DRIZZLE_BIN_LOG: LOCK_log, LOCK_index of the binlog and the relay log
104
In MYSQL_BIN_LOG: LOCK_log, LOCK_index of the binlog and the relay log
107
105
LOCK_log: when you write to it. LOCK_index: when you create/delete a binlog
108
106
(so that you have to update the .index file).
130
128
I started with using an enum, but
131
129
enum_variable=1; is not legal so would have required many line changes.
133
#define DRIZZLE_SLAVE_NOT_RUN 0
134
#define DRIZZLE_SLAVE_RUN_NOT_CONNECT 1
135
#define DRIZZLE_SLAVE_RUN_CONNECT 2
131
#define MYSQL_SLAVE_NOT_RUN 0
132
#define MYSQL_SLAVE_RUN_NOT_CONNECT 1
133
#define MYSQL_SLAVE_RUN_CONNECT 2
137
135
#define RPL_LOG_NAME (rli->group_master_log_name[0] ? rli->group_master_log_name :\
148
146
int32_t init_slave();
149
147
void init_slave_skip_errors(const char* arg);
150
148
bool flush_relay_log_info(Relay_log_info* rli);
151
int32_t register_slave_on_master(DRIZZLE *drizzle);
149
int32_t register_slave_on_master(MYSQL* mysql);
152
150
int32_t terminate_slave_threads(Master_info* mi, int32_t thread_mask,
153
151
bool skip_lock = 0);
154
152
int32_t start_slave_threads(bool need_slave_mutex, bool wait_for_start,
175
173
/* retrieve table from master and copy to slave*/
176
174
int32_t fetch_master_table(THD* thd, const char* db_name, const char* table_name,
177
Master_info* mi, DRIZZLE *drizzle, bool overwrite);
175
Master_info* mi, MYSQL* mysql, bool overwrite);
179
177
bool show_master_info(THD* thd, Master_info* mi);
180
178
bool show_binlog_info(THD* thd);
209
207
extern bool volatile abort_loop;
210
208
extern Master_info main_mi, *active_mi; /* active_mi for multi-master */
211
209
extern LIST master_list;
212
extern bool replicate_same_server_id;
210
extern my_bool replicate_same_server_id;
214
212
extern int32_t disconnect_slave_event_count, abort_slave_event_count ;
219
217
extern char *master_info_file, *relay_log_info_file, *report_user;
220
218
extern char *report_host, *report_password;
222
extern bool master_ssl;
220
extern my_bool master_ssl;
223
221
extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert;
224
222
extern char *master_ssl_cipher, *master_ssl_key;
226
224
extern I_List<THD> threads;
226
#endif /* HAVE_REPLICATION */
228
228
/* masks for start/stop operations on io and sql slave threads */
229
229
#define SLAVE_IO 1
230
230
#define SLAVE_SQL 2