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
1
/* Copyright (C) 2005 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 */
96
92
Protected with internal locks.
97
93
Must get data_lock when resetting the logs.
99
DRIZZLE_BIN_LOG relay_log;
95
MYSQL_BIN_LOG relay_log;
101
97
IO_CACHE cache_buf,*cur_log;
110
106
created temporary tables. Modified only on init/end and by the SQL
111
107
thread, read only by SQL thread.
113
Table *save_temporary_tables;
109
TABLE *save_temporary_tables;
116
112
standard lock acquistion order to avoid deadlocks:
132
128
Needed to deal properly with cur_log getting closed and re-opened with
133
129
a different log under our feet
135
uint32_t cur_log_old_open_count;
131
uint32 cur_log_old_open_count;
138
134
Let's call a group (of events) :
155
151
char group_relay_log_name[FN_REFLEN];
156
uint64_t group_relay_log_pos;
152
ulonglong group_relay_log_pos;
157
153
char event_relay_log_name[FN_REFLEN];
158
uint64_t event_relay_log_pos;
159
uint64_t future_event_relay_log_pos;
154
ulonglong event_relay_log_pos;
155
ulonglong future_event_relay_log_pos;
161
157
#ifdef HAVE_purify
162
158
bool is_fake; /* Mark that this is a fake relay log info structure */
178
174
threads, the SQL thread sets it to unblock the I/O thread and make it
179
175
temporarily forget about the constraint.
181
uint64_t log_space_limit,log_space_total;
177
ulonglong log_space_limit,log_space_total;
182
178
bool ignore_log_space_limit;
187
183
committing event (the COMMIT query event, or the event if in autocommit
190
uint64_t future_group_master_log_pos;
186
#if MYSQL_VERSION_ID < 40100
187
ulonglong future_master_log_pos;
189
ulonglong future_group_master_log_pos;
192
192
time_t last_master_timestamp;
198
198
skipping one or more events in the master log that have caused
199
199
errors, and have been manually applied by DBA already.
201
volatile uint32_t slave_skip_counter;
202
volatile uint32_t abort_pos_wait; /* Incremented on change master */
203
volatile uint32_t slave_run_id; /* Incremented on slave start */
201
volatile uint32 slave_skip_counter;
202
volatile ulong abort_pos_wait; /* Incremented on change master */
203
volatile ulong slave_run_id; /* Incremented on slave start */
204
204
pthread_mutex_t log_space_lock;
205
205
pthread_cond_t log_space_cond;
207
int32_t events_till_abort;
208
int events_till_abort;
209
211
/* if not set, the value of other members of the structure are undefined */
211
213
volatile bool abort_slave;
212
volatile uint32_t slave_running;
214
volatile uint slave_running;
215
217
Condition and its parameters from START SLAVE UNTIL clause.
225
227
enum {UNTIL_NONE= 0, UNTIL_MASTER_POS, UNTIL_RELAY_POS} until_condition;
226
228
char until_log_name[FN_REFLEN];
227
uint64_t until_log_pos;
228
/* extension extracted from log_name and converted to int32_t */
229
uint32_t until_log_name_extension;
229
ulonglong until_log_pos;
230
/* extension extracted from log_name and converted to int */
231
ulong until_log_name_extension;
231
233
Cached result of comparison of until_log_name and current log name
232
234
-2 means unitialised, -1,0,1 are comarison results
245
247
counter: how many times the slave has retried a transaction (any) since
248
uint32_t trans_retries, retried_trans;
250
ulong trans_retries, retried_trans;
251
253
If the end of the hot relay log is made of master's events ignored by the
286
288
event_relay_log_pos= future_event_relay_log_pos;
289
void inc_group_relay_log_pos(uint64_t log_pos,
291
void inc_group_relay_log_pos(ulonglong log_pos,
290
292
bool skip_lock=0);
292
int32_t wait_for_pos(THD* thd, String* log_name, int64_t log_pos,
294
int wait_for_pos(THD* thd, String* log_name, longlong log_pos,
294
296
void close_temporary_tables();
296
298
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
297
299
bool is_until_satisfied(my_off_t master_beg_pos);
298
inline uint64_t until_pos()
300
inline ulonglong until_pos()
300
302
return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_pos :
301
303
group_relay_log_pos);
304
RPL_TableList *tables_to_lock; /* RBR: Tables to lock */
305
uint32_t tables_to_lock_count; /* RBR: Count of tables to lock */
306
RPL_TABLE_LIST *tables_to_lock; /* RBR: Tables to lock */
307
uint tables_to_lock_count; /* RBR: Count of tables to lock */
306
308
table_mapping m_table_map; /* RBR: Mapping table-id to table */
308
inline table_def *get_tabledef(Table *tbl)
310
inline table_def *get_tabledef(TABLE *tbl)
310
312
table_def *td= 0;
311
for (TableList *ptr= tables_to_lock; ptr && !td; ptr= ptr->next_global)
313
for (TABLE_LIST *ptr= tables_to_lock; ptr && !td; ptr= ptr->next_global)
312
314
if (ptr->table == tbl)
313
td= &((RPL_TableList *)ptr)->m_tabledef;
315
td= &((RPL_TABLE_LIST *)ptr)->m_tabledef;