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).
114
112
extern char *slave_load_tmpdir;
115
113
extern char *master_info_file, *relay_log_info_file;
116
114
extern char *opt_relay_logname, *opt_relaylog_index_name;
117
extern bool opt_skip_slave_start;
118
extern bool opt_reckless_slave;
119
extern bool opt_log_slave_updates;
115
extern my_bool opt_skip_slave_start, opt_reckless_slave;
116
extern my_bool opt_log_slave_updates;
120
117
extern uint64_t relay_log_space_limit;
130
127
I started with using an enum, but
131
128
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
130
#define MYSQL_SLAVE_NOT_RUN 0
131
#define MYSQL_SLAVE_RUN_NOT_CONNECT 1
132
#define MYSQL_SLAVE_RUN_CONNECT 2
137
134
#define RPL_LOG_NAME (rli->group_master_log_name[0] ? rli->group_master_log_name :\
148
145
int32_t init_slave();
149
146
void init_slave_skip_errors(const char* arg);
150
147
bool flush_relay_log_info(Relay_log_info* rli);
151
int32_t register_slave_on_master(DRIZZLE *drizzle);
148
int32_t register_slave_on_master(MYSQL* mysql);
152
149
int32_t terminate_slave_threads(Master_info* mi, int32_t thread_mask,
153
150
bool skip_lock = 0);
154
151
int32_t start_slave_threads(bool need_slave_mutex, bool wait_for_start,
175
172
/* retrieve table from master and copy to slave*/
176
173
int32_t fetch_master_table(THD* thd, const char* db_name, const char* table_name,
177
Master_info* mi, DRIZZLE *drizzle, bool overwrite);
174
Master_info* mi, MYSQL* mysql, bool overwrite);
179
176
bool show_master_info(THD* thd, Master_info* mi);
180
177
bool show_binlog_info(THD* thd);
209
206
extern bool volatile abort_loop;
210
207
extern Master_info main_mi, *active_mi; /* active_mi for multi-master */
211
208
extern LIST master_list;
212
extern bool replicate_same_server_id;
209
extern my_bool replicate_same_server_id;
214
211
extern int32_t disconnect_slave_event_count, abort_slave_event_count ;
219
216
extern char *master_info_file, *relay_log_info_file, *report_user;
220
217
extern char *report_host, *report_password;
222
extern bool master_ssl;
219
extern my_bool master_ssl;
223
220
extern char *master_ssl_ca, *master_ssl_capath, *master_ssl_cert;
224
221
extern char *master_ssl_cipher, *master_ssl_key;
226
223
extern I_List<THD> threads;
225
#endif /* HAVE_REPLICATION */
228
227
/* masks for start/stop operations on io and sql slave threads */
229
228
#define SLAVE_IO 1
230
229
#define SLAVE_SQL 2