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
#define RPL_LOG_NAME (rli->group_master_log_name.length() ? rli->group_master_log_name.c_str() : "FIRST")
138
#define IO_RPL_LOG_NAME (mi->getLogName() ? mi->getLogName() : "FIRST")
135
#define RPL_LOG_NAME (rli->group_master_log_name[0] ? rli->group_master_log_name :\
137
#define IO_RPL_LOG_NAME (mi->master_log_name[0] ? mi->master_log_name :\
141
141
If the following is set, if first gives an error, second will be
197
197
int32_t purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
198
198
const char** errmsg);
199
199
void set_slave_thread_options(THD* thd);
200
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli);
200
201
void rotate_relay_log(Master_info* mi);
201
202
int32_t apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli,