|
1346.96.1
by monty at mysql
Added timeout for wait_for_master_pos |
1 |
/* Copyright (C) 2000-2003 MySQL AB
|
|
1659.83.6
by serg at serg
open binlog index file *before* tc_log->open() and binlog itself *after* |
2 |
|
|
2
by bk at mysql
Import changeset |
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
|
|
|
1810.2403.4
by kent at mysql
Many files: |
5 |
the Free Software Foundation; version 2 of the License.
|
|
1659.83.6
by serg at serg
open binlog index file *before* tc_log->open() and binlog itself *after* |
6 |
|
|
2
by bk at mysql
Import changeset |
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.
|
|
|
1659.83.6
by serg at serg
open binlog index file *before* tc_log->open() and binlog itself *after* |
11 |
|
|
2
by bk at mysql
Import changeset |
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 */
|
|
15 |
||
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
16 |
|
17 |
/**
|
|
18 |
@addtogroup Replication
|
|
19 |
@{
|
|
20 |
||
21 |
@file
|
|
22 |
||
23 |
@brief Code to run the io thread and the sql thread on the
|
|
24 |
replication slave.
|
|
25 |
*/
|
|
26 |
||
|
2
by bk at mysql
Import changeset |
27 |
#include "mysql_priv.h"
|
|
1409
by hf at r18
SCRUM |
28 |
|
|
2
by bk at mysql
Import changeset |
29 |
#include <mysql.h>
|
|
365
by monty at mysql
Fixed delete in tables with hidden primary key |
30 |
#include <myisam.h>
|
|
2469.135.1
by mats at romeo
BUG#25688 (RBR: circular replication may cause STMT_END_F flags to be |
31 |
#include "slave.h"
|
32 |
#include "rpl_mi.h"
|
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
33 |
#include "rpl_rli.h"
|
|
689.2.1
by sasha at sashanet
updates for LOAD DATA FROM MASTER + some cleanup of replication code |
34 |
#include "sql_repl.h"
|
|
1700.355.12
by lars at mysql
WL#2472: |
35 |
#include "rpl_filter.h"
|
|
818.22.1
by sasha at sashanet
fixes for mysql-test to run without manager |
36 |
#include "repl_failsafe.h"
|
|
2
by bk at mysql
Import changeset |
37 |
#include <thr_alarm.h>
|
|
1174.1.7
by monty at mysql
Fix after merge |
38 |
#include <my_dir.h>
|
|
1538.4.15
by hf at deer
SCRUM: |
39 |
#include <sql_common.h>
|
|
1810.2686.1
by kaa at polly
Fix for bug #23775 "Replicated event larger that max_allowed_packet infinitely re-transmits". |
40 |
#include <errmsg.h>
|
|
1810.3174.1
by kaa at polly
Fix for bug #24192 "MySQL replication does not exit server when running out of memory" |
41 |
#include <mysys_err.h>
|
|
1409
by hf at r18
SCRUM |
42 |
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
43 |
#ifdef HAVE_REPLICATION
|
44 |
||
45 |
#include "rpl_tblmap.h"
|
|
46 |
||
|
2303.190.1
by mats at romeo
BUG#22864 (Rollback following CREATE... SELECT discards 'CREATE TABLE' |
47 |
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
|
|
2303.68.4
by lars at mysql
Refactoring: Moved rli code to new file rpl_rli.cc. The idea being that rli |
48 |
|
|
1616.1759.1
by gbichot at mysql
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication": |
49 |
#define MAX_SLAVE_RETRY_PAUSE 5
|
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
50 |
bool use_slave_mask = 0; |
51 |
MY_BITMAP slave_error_mask; |
|
52 |
||
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
53 |
typedef bool (*CHECK_KILLED_FUNC)(THD*,void*); |
54 |
||
|
721
by sasha at sashanet
LOAD DATA INFILE is now replicated properly, except for cleanup on |
55 |
char* slave_load_tmpdir = 0; |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
56 |
Master_info *active_mi= 0; |
|
1810.832.3
by jani at omakaista
Fixed several boolean type options used in my_long_options[]. |
57 |
my_bool replicate_same_server_id; |
|
1238
by monty at mysql
Changed relay_log_space to ulonglong |
58 |
ulonglong relay_log_space_limit = 0; |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
59 |
|
60 |
/*
|
|
61 |
When slave thread exits, we need to remember the temporary tables so we
|
|
62 |
can re-use them on slave start.
|
|
63 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
64 |
TODO: move the vars below under Master_info
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
65 |
*/
|
66 |
||
|
301.1.1
by sasha at sashanet
added loops and other cool stuff to mysqltest |
67 |
int disconnect_slave_event_count = 0, abort_slave_event_count = 0; |
|
1238
by monty at mysql
Changed relay_log_space to ulonglong |
68 |
int events_till_abort = -1; |
|
2
by bk at mysql
Import changeset |
69 |
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
70 |
enum enum_slave_reconnect_actions |
71 |
{
|
|
72 |
SLAVE_RECON_ACT_REG= 0, |
|
73 |
SLAVE_RECON_ACT_DUMP= 1, |
|
74 |
SLAVE_RECON_ACT_EVENT= 2, |
|
75 |
SLAVE_RECON_ACT_MAX
|
|
76 |
};
|
|
77 |
||
78 |
enum enum_slave_reconnect_messages |
|
79 |
{
|
|
80 |
SLAVE_RECON_MSG_WAIT= 0, |
|
81 |
SLAVE_RECON_MSG_KILLED_WAITING= 1, |
|
82 |
SLAVE_RECON_MSG_AFTER= 2, |
|
83 |
SLAVE_RECON_MSG_FAILED= 3, |
|
84 |
SLAVE_RECON_MSG_COMMAND= 4, |
|
85 |
SLAVE_RECON_MSG_KILLED_AFTER= 5, |
|
86 |
SLAVE_RECON_MSG_MAX
|
|
87 |
};
|
|
88 |
||
89 |
static const char *reconnect_messages[SLAVE_RECON_ACT_MAX][SLAVE_RECON_MSG_MAX]= |
|
90 |
{
|
|
91 |
{
|
|
92 |
"Waiting to reconnect after a failed registration on master", |
|
93 |
"Slave I/O thread killed while waitnig to reconnect after a failed \
|
|
94 |
registration on master", |
|
95 |
"Reconnecting after a failed registration on master", |
|
96 |
"failed registering on master, reconnecting to try again, \
|
|
97 |
log '%s' at postion %s", |
|
98 |
"COM_REGISTER_SLAVE", |
|
99 |
"Slave I/O thread killed during or after reconnect"
|
|
100 |
},
|
|
101 |
{
|
|
102 |
"Waiting to reconnect after a failed binlog dump request", |
|
103 |
"Slave I/O thread killed while retrying master dump", |
|
104 |
"Reconnecting after a failed binlog dump request", |
|
105 |
"failed dump request, reconnecting to try again, log '%s' at postion %s", |
|
106 |
"COM_BINLOG_DUMP", |
|
107 |
"Slave I/O thread killed during or after reconnect"
|
|
108 |
},
|
|
109 |
{
|
|
110 |
"Waiting to reconnect after a failed master event read", |
|
111 |
"Slave I/O thread killed while waiting to reconnect after a failed read", |
|
112 |
"Reconnecting after a failed master event read", |
|
113 |
"Slave I/O thread: Failed reading log event, reconnecting to retry, \
|
|
114 |
log '%s' at postion %s", |
|
115 |
"", |
|
116 |
"Slave I/O thread killed during or after a reconnect done to recover from \
|
|
117 |
failed read"
|
|
118 |
}
|
|
119 |
};
|
|
120 |
||
121 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
122 |
typedef enum { SLAVE_THD_IO, SLAVE_THD_SQL} SLAVE_THD_TYPE; |
|
270
by sasha at sashanet
fixed warning in sql_class.cc |
123 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
124 |
static int process_io_rotate(Master_info* mi, Rotate_log_event* rev); |
125 |
static int process_io_create_file(Master_info* mi, Create_file_log_event* cev); |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
126 |
static bool wait_for_relay_log_space(Relay_log_info* rli); |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
127 |
static inline bool io_slave_killed(THD* thd,Master_info* mi); |
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
128 |
static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
129 |
static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type); |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
130 |
static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi); |
131 |
static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, |
|
|
2181.142.1
by grog at lemis
slave.cc: |
132 |
bool suppress_warnings); |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
133 |
static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, |
|
2181.142.1
by grog at lemis
slave.cc: |
134 |
bool reconnect, bool suppress_warnings); |
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
135 |
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, |
|
2181.142.1
by grog at lemis
slave.cc: |
136 |
void* thread_killed_arg); |
|
689.2.1
by sasha at sashanet
updates for LOAD DATA FROM MASTER + some cleanup of replication code |
137 |
static int request_table_dump(MYSQL* mysql, const char* db, const char* table); |
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
138 |
static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, |
|
2181.142.1
by grog at lemis
slave.cc: |
139 |
const char* table_name, bool overwrite); |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
140 |
static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi); |
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
141 |
static Log_event* next_event(Relay_log_info* rli); |
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
142 |
static int queue_event(Master_info* mi,const char* buf,ulong event_len); |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
143 |
static int terminate_slave_thread(THD *thd, |
144 |
pthread_mutex_t* term_lock, |
|
145 |
pthread_cond_t* term_cond, |
|
146 |
volatile uint *slave_running, |
|
147 |
bool skip_lock); |
|
|
2476.488.6
by kaa at polly
Fix for bug #29976: Excessive Slave I/O errors in replication tests |
148 |
static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info); |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
149 |
|
150 |
/*
|
|
|
1439
by monty at mysql
Merge with 4.0.11 |
151 |
Find out which replications threads are running
|
152 |
||
153 |
SYNOPSIS
|
|
154 |
init_thread_mask()
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
155 |
mask Return value here
|
156 |
mi master_info for slave
|
|
157 |
inverse If set, returns which threads are not running
|
|
|
1439
by monty at mysql
Merge with 4.0.11 |
158 |
|
159 |
IMPLEMENTATION
|
|
160 |
Get a bit mask for which threads are running so that we can later restart
|
|
161 |
these threads.
|
|
162 |
||
163 |
RETURN
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
164 |
mask If inverse == 0, running threads
|
165 |
If inverse == 1, stopped threads
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
166 |
*/
|
167 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
168 |
void init_thread_mask(int* mask,Master_info* mi,bool inverse) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
169 |
{
|
170 |
bool set_io = mi->slave_running, set_sql = mi->rli.slave_running; |
|
171 |
register int tmp_mask=0; |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
172 |
DBUG_ENTER("init_thread_mask"); |
173 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
174 |
if (set_io) |
175 |
tmp_mask |= SLAVE_IO; |
|
176 |
if (set_sql) |
|
177 |
tmp_mask |= SLAVE_SQL; |
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
178 |
if (inverse) |
179 |
tmp_mask^= (SLAVE_IO | SLAVE_SQL); |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
180 |
*mask = tmp_mask; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
181 |
DBUG_VOID_RETURN; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
182 |
}
|
183 |
||
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
184 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
185 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
186 |
lock_slave_threads()
|
|
1439
by monty at mysql
Merge with 4.0.11 |
187 |
*/
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
188 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
189 |
void lock_slave_threads(Master_info* mi) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
190 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
191 |
DBUG_ENTER("lock_slave_threads"); |
192 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
193 |
//TODO: see if we can do this without dual mutex
|
194 |
pthread_mutex_lock(&mi->run_lock); |
|
195 |
pthread_mutex_lock(&mi->rli.run_lock); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
196 |
DBUG_VOID_RETURN; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
197 |
}
|
198 |
||
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
199 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
200 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
201 |
unlock_slave_threads()
|
|
1439
by monty at mysql
Merge with 4.0.11 |
202 |
*/
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
203 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
204 |
void unlock_slave_threads(Master_info* mi) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
205 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
206 |
DBUG_ENTER("unlock_slave_threads"); |
207 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
208 |
//TODO: see if we can do this without dual mutex
|
209 |
pthread_mutex_unlock(&mi->rli.run_lock); |
|
210 |
pthread_mutex_unlock(&mi->run_lock); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
211 |
DBUG_VOID_RETURN; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
212 |
}
|
213 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
214 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
215 |
/* Initialize slave structures */
|
216 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
217 |
int init_slave() |
218 |
{
|
|
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
219 |
DBUG_ENTER("init_slave"); |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
220 |
|
|
1346.548.1
by guilhem at mysql
Fix for BUG#2921 "Replication problem on mutex lock in mySQL-4.0.18": |
221 |
/*
|
222 |
This is called when mysqld starts. Before client connections are
|
|
223 |
accepted. However bootstrap may conflict with us if it does START SLAVE.
|
|
224 |
So it's safer to take the lock.
|
|
225 |
*/
|
|
226 |
pthread_mutex_lock(&LOCK_active_mi); |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
227 |
/*
|
228 |
TODO: re-write this to interate through the list of files
|
|
229 |
for multi-master
|
|
230 |
*/
|
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
231 |
active_mi= new Master_info; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
232 |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
233 |
/*
|
234 |
If master_host is not specified, try to read it from the master_info file.
|
|
235 |
If master_host is specified, create the master_info file if it doesn't
|
|
236 |
exists.
|
|
237 |
*/
|
|
|
1346.235.1
by guilhem at mysql
More error messages. This is intended to help debugging; presently I have a |
238 |
if (!active_mi) |
239 |
{
|
|
240 |
sql_print_error("Failed to allocate memory for the master info structure"); |
|
241 |
goto err; |
|
242 |
}
|
|
|
1659.83.6
by serg at serg
open binlog index file *before* tc_log->open() and binlog itself *after* |
243 |
|
|
1346.226.44
by monty at mysql
Simple code cleanup |
244 |
if (init_master_info(active_mi,master_info_file,relay_log_info_file, |
|
2181.142.1
by grog at lemis
slave.cc: |
245 |
!master_host, (SLAVE_IO | SLAVE_SQL))) |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
246 |
{
|
|
1346.235.1
by guilhem at mysql
More error messages. This is intended to help debugging; presently I have a |
247 |
sql_print_error("Failed to initialize the master info structure"); |
|
1346.96.3
by monty at mysql
Fixes for Netware |
248 |
goto err; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
249 |
}
|
250 |
||
251 |
if (server_id && !master_host && active_mi->host[0]) |
|
252 |
master_host= active_mi->host; |
|
253 |
||
|
1346.619.1
by guilhem at mysql
Fix for BUG#3829 "Setting server_id on fly doesn't allow replication to start" |
254 |
/* If server id is not set, start_slave_thread() will say it */
|
255 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
256 |
if (master_host && !opt_skip_slave_start) |
257 |
{
|
|
258 |
if (start_slave_threads(1 /* need mutex */, |
|
|
2181.142.1
by grog at lemis
slave.cc: |
259 |
0 /* no wait for start*/, |
260 |
active_mi, |
|
261 |
master_info_file, |
|
262 |
relay_log_info_file, |
|
263 |
SLAVE_IO | SLAVE_SQL)) |
|
|
1346.96.3
by monty at mysql
Fixes for Netware |
264 |
{
|
|
1346.235.1
by guilhem at mysql
More error messages. This is intended to help debugging; presently I have a |
265 |
sql_print_error("Failed to create slave threads"); |
|
1346.96.3
by monty at mysql
Fixes for Netware |
266 |
goto err; |
267 |
}
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
268 |
}
|
|
1346.548.1
by guilhem at mysql
Fix for BUG#2921 "Replication problem on mutex lock in mySQL-4.0.18": |
269 |
pthread_mutex_unlock(&LOCK_active_mi); |
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
270 |
DBUG_RETURN(0); |
|
1346.96.3
by monty at mysql
Fixes for Netware |
271 |
|
272 |
err:
|
|
|
1346.548.1
by guilhem at mysql
Fix for BUG#2921 "Replication problem on mutex lock in mySQL-4.0.18": |
273 |
pthread_mutex_unlock(&LOCK_active_mi); |
|
1346.96.3
by monty at mysql
Fixes for Netware |
274 |
DBUG_RETURN(1); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
275 |
}
|
276 |
||
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
277 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
278 |
/*
|
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
279 |
Init function to set up array for errors that should be skipped for slave
|
|
1439
by monty at mysql
Merge with 4.0.11 |
280 |
|
281 |
SYNOPSIS
|
|
282 |
init_slave_skip_errors()
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
283 |
arg List of errors numbers to skip, separated with ','
|
|
1439
by monty at mysql
Merge with 4.0.11 |
284 |
|
285 |
NOTES
|
|
286 |
Called from get_options() in mysqld.cc on start-up
|
|
287 |
*/
|
|
|
973.163.12
by monty at mysql
Portability fix |
288 |
|
289 |
void init_slave_skip_errors(const char* arg) |
|
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
290 |
{
|
|
973.163.12
by monty at mysql
Portability fix |
291 |
const char *p; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
292 |
DBUG_ENTER("init_slave_skip_errors"); |
293 |
||
|
1563.83.7
by serg at serg
key_map with more that 64 bits width |
294 |
if (bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0)) |
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
295 |
{
|
296 |
fprintf(stderr, "Badly out of memory, please check your system status\n"); |
|
297 |
exit(1); |
|
298 |
}
|
|
299 |
use_slave_mask = 1; |
|
|
973.215.17
by bar at izhnet
New ctype functions/macros to support many charsets at a time |
300 |
for (;my_isspace(system_charset_info,*arg);++arg) |
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
301 |
/* empty */; |
|
1504.1.7
by bar at r18
my_strncasecmp() is not used anymore. Use my_strncoll() instead. |
302 |
if (!my_strnncoll(system_charset_info,(uchar*)arg,4,(const uchar*)"all",4)) |
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
303 |
{
|
304 |
bitmap_set_all(&slave_error_mask); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
305 |
DBUG_VOID_RETURN; |
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
306 |
}
|
307 |
for (p= arg ; *p; ) |
|
308 |
{
|
|
309 |
long err_code; |
|
310 |
if (!(p= str2int(p, 10, 0, LONG_MAX, &err_code))) |
|
311 |
break; |
|
312 |
if (err_code < MAX_SLAVE_ERROR) |
|
313 |
bitmap_set_bit(&slave_error_mask,(uint)err_code); |
|
|
973.215.17
by bar at izhnet
New ctype functions/macros to support many charsets at a time |
314 |
while (!my_isdigit(system_charset_info,*p) && *p) |
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
315 |
p++; |
316 |
}
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
317 |
DBUG_VOID_RETURN; |
|
973.26.16
by sasha at sashanet
post-merge fixes, including slave-skip-errors backport |
318 |
}
|
319 |
||
|
1346.590.1
by guilhem at mysql
This is a fix for a bug in 3.23 -> 4.0 replication: Exec_master_log_pos is always |
320 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
321 |
int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
322 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
323 |
DBUG_ENTER("terminate_slave_threads"); |
324 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
325 |
if (!mi->inited) |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
326 |
DBUG_RETURN(0); /* successfully do nothing */ |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
327 |
int error,force_all = (thread_mask & SLAVE_FORCE_ALL); |
328 |
pthread_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock; |
|
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
329 |
|
330 |
if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))) |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
331 |
{
|
|
1346.83.1
by monty at mysql
Portability fixes |
332 |
DBUG_PRINT("info",("Terminating IO thread")); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
333 |
mi->abort_slave=1; |
334 |
if ((error=terminate_slave_thread(mi->io_thd,io_lock, |
|
|
2181.142.1
by grog at lemis
slave.cc: |
335 |
&mi->stop_cond, |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
336 |
&mi->slave_running, |
337 |
skip_lock)) && |
|
|
2181.142.1
by grog at lemis
slave.cc: |
338 |
!force_all) |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
339 |
DBUG_RETURN(error); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
340 |
}
|
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
341 |
if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL))) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
342 |
{
|
|
1346.83.1
by monty at mysql
Portability fixes |
343 |
DBUG_PRINT("info",("Terminating SQL thread")); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
344 |
mi->rli.abort_slave=1; |
345 |
if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock, |
|
|
2181.142.1
by grog at lemis
slave.cc: |
346 |
&mi->rli.stop_cond, |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
347 |
&mi->rli.slave_running, |
348 |
skip_lock)) && |
|
|
2181.142.1
by grog at lemis
slave.cc: |
349 |
!force_all) |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
350 |
DBUG_RETURN(error); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
351 |
}
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
352 |
DBUG_RETURN(0); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
353 |
}
|
354 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
355 |
|
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
356 |
/**
|
357 |
Wait for a slave thread to terminate.
|
|
358 |
||
359 |
This function is called after requesting the thread to terminate
|
|
360 |
(by setting @c abort_slave member of @c Relay_log_info or @c
|
|
361 |
Master_info structure to 1). Termination of the thread is
|
|
362 |
controlled with the the predicate <code>*slave_running</code>.
|
|
363 |
||
364 |
Function will acquire @c term_lock before waiting on the condition
|
|
365 |
unless @c skip_lock is true in which case the mutex should be owned
|
|
366 |
by the caller of this function and will remain acquired after
|
|
367 |
return from the function.
|
|
368 |
||
369 |
@param term_lock
|
|
370 |
Associated lock to use when waiting for @c term_cond
|
|
371 |
||
372 |
@param term_cond
|
|
373 |
Condition that is signalled when the thread has terminated
|
|
374 |
||
375 |
@param slave_running
|
|
376 |
Pointer to predicate to check for slave thread termination
|
|
377 |
||
378 |
@param skip_lock
|
|
379 |
If @c true the lock will not be acquired before waiting on
|
|
380 |
the condition. In this case, it is assumed that the calling
|
|
381 |
function acquires the lock before calling this function.
|
|
382 |
||
383 |
@retval 0 All OK
|
|
384 |
*/
|
|
385 |
static int |
|
386 |
terminate_slave_thread(THD *thd, |
|
387 |
pthread_mutex_t* term_lock, |
|
388 |
pthread_cond_t* term_cond, |
|
389 |
volatile uint *slave_running, |
|
390 |
bool skip_lock) |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
391 |
{
|
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
392 |
int error; |
393 |
||
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
394 |
DBUG_ENTER("terminate_slave_thread"); |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
395 |
|
396 |
if (!skip_lock) |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
397 |
pthread_mutex_lock(term_lock); |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
398 |
|
399 |
safe_mutex_assert_owner(term_lock); |
|
400 |
||
401 |
if (!*slave_running) |
|
402 |
{
|
|
403 |
if (!skip_lock) |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
404 |
pthread_mutex_unlock(term_lock); |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
405 |
DBUG_RETURN(ER_SLAVE_NOT_RUNNING); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
406 |
}
|
407 |
DBUG_ASSERT(thd != 0); |
|
|
1659.83.7
by serg at serg
auto-ROLLBACK if binlog was not closed properly |
408 |
THD_CHECK_SENTRY(thd); |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
409 |
|
|
1009.2.1
by monty at mysql
Added the following new privleges: |
410 |
/*
|
|
1659.83.7
by serg at serg
auto-ROLLBACK if binlog was not closed properly |
411 |
Is is critical to test if the slave is running. Otherwise, we might
|
|
1009.2.1
by monty at mysql
Added the following new privleges: |
412 |
be referening freed memory trying to kick it
|
|
973.116.1
by sasha at sashanet
replication updates and bugfixes. Still not perfect - there is some strange |
413 |
*/
|
|
1346.144.2
by monty at mysql
Simple fixes (nothing notable) |
414 |
|
|
2181.142.1
by grog at lemis
slave.cc: |
415 |
while (*slave_running) // Should always be true |
|
973.116.1
by sasha at sashanet
replication updates and bugfixes. Still not perfect - there is some strange |
416 |
{
|
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
417 |
DBUG_PRINT("loop", ("killing slave thread")); |
|
1810.3605.18
by sven at riska
BUG#31024: STOP SLAVE does not stop attempted connect()s |
418 |
|
419 |
pthread_mutex_lock(&thd->LOCK_delete); |
|
420 |
#ifndef DONT_USE_THR_ALARM
|
|
421 |
/*
|
|
422 |
Error codes from pthread_kill are:
|
|
423 |
EINVAL: invalid signal number (can't happen)
|
|
424 |
ESRCH: thread already killed (can happen, should be ignored)
|
|
425 |
*/
|
|
426 |
IF_DBUG(int err= ) pthread_kill(thd->real_id, thr_client_alarm); |
|
427 |
DBUG_ASSERT(err != EINVAL); |
|
428 |
#endif
|
|
429 |
thd->awake(THD::NOT_KILLED); |
|
430 |
pthread_mutex_unlock(&thd->LOCK_delete); |
|
431 |
||
|
1009.2.1
by monty at mysql
Added the following new privleges: |
432 |
/*
|
433 |
There is a small chance that slave thread might miss the first
|
|
434 |
alarm. To protect againts it, resend the signal until it reacts
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
435 |
*/
|
436 |
struct timespec abstime; |
|
|
1009.2.1
by monty at mysql
Added the following new privleges: |
437 |
set_timespec(abstime,2); |
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
438 |
error= pthread_cond_timedwait(term_cond, term_lock, &abstime); |
439 |
DBUG_ASSERT(error == ETIMEDOUT || error == 0); |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
440 |
}
|
|
2476.359.1
by mats at dnsalias
BUG#29968 (rpl_ndb_circular.test and rpl_ndb_log.test fail): |
441 |
|
442 |
DBUG_ASSERT(*slave_running == 0); |
|
443 |
||
444 |
if (!skip_lock) |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
445 |
pthread_mutex_unlock(term_lock); |
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
446 |
DBUG_RETURN(0); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
447 |
}
|
448 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
449 |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
450 |
int start_slave_thread(pthread_handler h_func, pthread_mutex_t *start_lock, |
|
2181.142.1
by grog at lemis
slave.cc: |
451 |
pthread_mutex_t *cond_lock, |
452 |
pthread_cond_t *start_cond, |
|
453 |
volatile uint *slave_running, |
|
454 |
volatile ulong *slave_run_id, |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
455 |
Master_info* mi, |
|
1491
by papa at gbichot
Replication: give the slave I/O thread a higher priority than the slave SQL thread |
456 |
bool high_priority) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
457 |
{
|
458 |
pthread_t th; |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
459 |
ulong start_id; |
460 |
DBUG_ENTER("start_slave_thread"); |
|
461 |
||
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
462 |
DBUG_ASSERT(mi->inited); |
463 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
464 |
if (start_lock) |
465 |
pthread_mutex_lock(start_lock); |
|
466 |
if (!server_id) |
|
467 |
{
|
|
468 |
if (start_cond) |
|
469 |
pthread_cond_broadcast(start_cond); |
|
470 |
if (start_lock) |
|
471 |
pthread_mutex_unlock(start_lock); |
|
472 |
sql_print_error("Server id not set, will not start slave"); |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
473 |
DBUG_RETURN(ER_BAD_SLAVE); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
474 |
}
|
|
2181.142.1
by grog at lemis
slave.cc: |
475 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
476 |
if (*slave_running) |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
477 |
{
|
478 |
if (start_cond) |
|
479 |
pthread_cond_broadcast(start_cond); |
|
480 |
if (start_lock) |
|
481 |
pthread_mutex_unlock(start_lock); |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
482 |
DBUG_RETURN(ER_SLAVE_MUST_STOP); |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
483 |
}
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
484 |
start_id= *slave_run_id; |
485 |
DBUG_PRINT("info",("Creating new slave thread")); |
|
|
1491
by papa at gbichot
Replication: give the slave I/O thread a higher priority than the slave SQL thread |
486 |
if (high_priority) |
487 |
my_pthread_attr_setprio(&connection_attrib,CONNECT_PRIOR); |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
488 |
if (pthread_create(&th, &connection_attrib, h_func, (void*)mi)) |
489 |
{
|
|
490 |
if (start_lock) |
|
491 |
pthread_mutex_unlock(start_lock); |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
492 |
DBUG_RETURN(ER_SLAVE_THREAD); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
493 |
}
|
|
1346.652.48
by guilhem at mysql
Fix for: |
494 |
if (start_cond && cond_lock) // caller has cond_lock |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
495 |
{
|
496 |
THD* thd = current_thd; |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
497 |
while (start_id == *slave_run_id) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
498 |
{
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
499 |
DBUG_PRINT("sleep",("Waiting for slave thread to start")); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
500 |
const char* old_msg = thd->enter_cond(start_cond,cond_lock, |
|
2181.142.1
by grog at lemis
slave.cc: |
501 |
"Waiting for slave thread to start"); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
502 |
pthread_cond_wait(start_cond,cond_lock); |
503 |
thd->exit_cond(old_msg); |
|
|
1346.652.48
by guilhem at mysql
Fix for: |
504 |
pthread_mutex_lock(cond_lock); // re-acquire it as exit_cond() released |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
505 |
if (thd->killed) |
|
2181.142.1
by grog at lemis
slave.cc: |
506 |
DBUG_RETURN(thd->killed_errno()); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
507 |
}
|
508 |
}
|
|
509 |
if (start_lock) |
|
510 |
pthread_mutex_unlock(start_lock); |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
511 |
DBUG_RETURN(0); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
512 |
}
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
513 |
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
514 |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
515 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
516 |
start_slave_threads()
|
517 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
518 |
NOTES
|
519 |
SLAVE_FORCE_ALL is not implemented here on purpose since it does not make
|
|
520 |
sense to do that for starting a slave--we always care if it actually
|
|
521 |
started the threads that were not previously running
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
522 |
*/
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
523 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
524 |
int start_slave_threads(bool need_slave_mutex, bool wait_for_start, |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
525 |
Master_info* mi, const char* master_info_fname, |
|
2181.142.1
by grog at lemis
slave.cc: |
526 |
const char* slave_info_fname, int thread_mask) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
527 |
{
|
528 |
pthread_mutex_t *lock_io=0,*lock_sql=0,*lock_cond_io=0,*lock_cond_sql=0; |
|
529 |
pthread_cond_t* cond_io=0,*cond_sql=0; |
|
530 |
int error=0; |
|
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
531 |
DBUG_ENTER("start_slave_threads"); |
|
2181.142.1
by grog at lemis
slave.cc: |
532 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
533 |
if (need_slave_mutex) |
534 |
{
|
|
535 |
lock_io = &mi->run_lock; |
|
536 |
lock_sql = &mi->rli.run_lock; |
|
537 |
}
|
|
538 |
if (wait_for_start) |
|
539 |
{
|
|
540 |
cond_io = &mi->start_cond; |
|
541 |
cond_sql = &mi->rli.start_cond; |
|
542 |
lock_cond_io = &mi->run_lock; |
|
543 |
lock_cond_sql = &mi->rli.run_lock; |
|
544 |
}
|
|
545 |
||
|
1346.524.34
by guilhem at mysql
Undoing 2 parts of changeset 1.1730.1.1 : |
546 |
if (thread_mask & SLAVE_IO) |
547 |
error=start_slave_thread(handle_slave_io,lock_io,lock_cond_io, |
|
|
2181.142.1
by grog at lemis
slave.cc: |
548 |
cond_io, |
549 |
&mi->slave_running, &mi->slave_run_id, |
|
550 |
mi, 1); //high priority, to read the most possible |
|
|
1346.524.34
by guilhem at mysql
Undoing 2 parts of changeset 1.1730.1.1 : |
551 |
if (!error && (thread_mask & SLAVE_SQL)) |
552 |
{
|
|
|
1346.541.1
by monty at mysql
Fixed memory leak in DROP DATABASE when using RAID tables (Bug #2882) |
553 |
error=start_slave_thread(handle_slave_sql,lock_sql,lock_cond_sql, |
|
2181.142.1
by grog at lemis
slave.cc: |
554 |
cond_sql, |
555 |
&mi->rli.slave_running, &mi->rli.slave_run_id, |
|
556 |
mi, 0); |
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
557 |
if (error) |
|
1346.524.34
by guilhem at mysql
Undoing 2 parts of changeset 1.1730.1.1 : |
558 |
terminate_slave_threads(mi, thread_mask & SLAVE_IO, 0); |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
559 |
}
|
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
560 |
DBUG_RETURN(error); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
561 |
}
|
|
973.1.31
by monty at mysql
Merge with 3.23.47 |
562 |
|
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
563 |
|
|
1238
by monty at mysql
Changed relay_log_space to ulonglong |
564 |
#ifdef NOT_USED_YET
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
565 |
static int end_slave_on_walk(Master_info* mi, uchar* /*unused*/) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
566 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
567 |
DBUG_ENTER("end_slave_on_walk"); |
568 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
569 |
end_master_info(mi); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
570 |
DBUG_RETURN(0); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
571 |
}
|
|
1238
by monty at mysql
Changed relay_log_space to ulonglong |
572 |
#endif
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
573 |
|
|
1346.96.3
by monty at mysql
Fixes for Netware |
574 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
575 |
/*
|
576 |
Free all resources used by slave
|
|
577 |
||
578 |
SYNOPSIS
|
|
579 |
end_slave()
|
|
580 |
*/
|
|
581 |
||
|
358
by sasha at sashanet
fixed up leaks found by --exit-info=256 |
582 |
void end_slave() |
583 |
{
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
584 |
DBUG_ENTER("end_slave"); |
585 |
||
|
1346.548.1
by guilhem at mysql
Fix for BUG#2921 "Replication problem on mutex lock in mySQL-4.0.18": |
586 |
/*
|
587 |
This is called when the server terminates, in close_connections().
|
|
588 |
It terminates slave threads. However, some CHANGE MASTER etc may still be
|
|
589 |
running presently. If a START SLAVE was in progress, the mutex lock below
|
|
590 |
will make us wait until slave threads have started, and START SLAVE
|
|
591 |
returns, then we terminate them here.
|
|
592 |
*/
|
|
593 |
pthread_mutex_lock(&LOCK_active_mi); |
|
|
1346.96.3
by monty at mysql
Fixes for Netware |
594 |
if (active_mi) |
595 |
{
|
|
596 |
/*
|
|
597 |
TODO: replace the line below with
|
|
598 |
list_walk(&master_list, (list_walk_action)end_slave_on_walk,0);
|
|
599 |
once multi-master code is ready.
|
|
600 |
*/
|
|
601 |
terminate_slave_threads(active_mi,SLAVE_FORCE_ALL); |
|
602 |
end_master_info(active_mi); |
|
603 |
delete active_mi; |
|
604 |
active_mi= 0; |
|
605 |
}
|
|
|
1346.548.1
by guilhem at mysql
Fix for BUG#2921 "Replication problem on mutex lock in mySQL-4.0.18": |
606 |
pthread_mutex_unlock(&LOCK_active_mi); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
607 |
DBUG_VOID_RETURN; |
|
358
by sasha at sashanet
fixed up leaks found by --exit-info=256 |
608 |
}
|
|
270
by sasha at sashanet
fixed warning in sql_class.cc |
609 |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
610 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
611 |
static bool io_slave_killed(THD* thd, Master_info* mi) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
612 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
613 |
DBUG_ENTER("io_slave_killed"); |
614 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
615 |
DBUG_ASSERT(mi->io_thd == thd); |
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
616 |
DBUG_ASSERT(mi->slave_running); // tracking buffer overrun |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
617 |
DBUG_RETURN(mi->abort_slave || abort_loop || thd->killed); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
618 |
}
|
619 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
620 |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
621 |
static bool sql_slave_killed(THD* thd, Relay_log_info* rli) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
622 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
623 |
DBUG_ENTER("sql_slave_killed"); |
624 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
625 |
DBUG_ASSERT(rli->sql_thd == thd); |
626 |
DBUG_ASSERT(rli->slave_running == 1);// tracking buffer overrun |
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
627 |
if (abort_loop || thd->killed || rli->abort_slave) |
628 |
{
|
|
629 |
/*
|
|
630 |
If we are in an unsafe situation (stopping could corrupt replication),
|
|
631 |
we give one minute to the slave SQL thread of grace before really
|
|
632 |
terminating, in the hope that it will be able to read more events and
|
|
633 |
the unsafe situation will soon be left. Note that this one minute starts
|
|
634 |
from the last time anything happened in the slave SQL thread. So it's
|
|
635 |
really one minute of idleness, we don't timeout if the slave SQL thread
|
|
636 |
is actively working.
|
|
637 |
*/
|
|
|
2303.203.3
by mats at romeo
BUG#23171 (Illegal slave restart position): |
638 |
if (rli->last_event_start_time == 0) |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
639 |
DBUG_RETURN(1); |
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
640 |
DBUG_PRINT("info", ("Slave SQL thread is in an unsafe situation, giving " |
641 |
"it some grace period")); |
|
|
2303.203.3
by mats at romeo
BUG#23171 (Illegal slave restart position): |
642 |
if (difftime(time(0), rli->last_event_start_time) > 60) |
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
643 |
{
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
644 |
rli->report(ERROR_LEVEL, 0, |
645 |
"SQL thread had to stop in an unsafe situation, in "
|
|
646 |
"the middle of applying updates to a "
|
|
647 |
"non-transactional table without any primary key. "
|
|
648 |
"There is a risk of duplicate updates when the slave "
|
|
649 |
"SQL thread is restarted. Please check your tables' "
|
|
650 |
"contents after restart."); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
651 |
DBUG_RETURN(1); |
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
652 |
}
|
653 |
}
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
654 |
DBUG_RETURN(0); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
655 |
}
|
656 |
||
|
1346.305.1
by monty at mysql
Review of changesets since last pull. |
657 |
|
|
1346.293.1
by guilhem at mysql
WL#1036 (print the db in slave error messages). |
658 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
659 |
skip_load_data_infile()
|
660 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
661 |
NOTES
|
662 |
This is used to tell a 3.23 master to break send_file()
|
|
663 |
*/
|
|
|
1249.3.2
by monty at mysql
Fixes and code cleanups after merge with 4.0.3 |
664 |
|
665 |
void skip_load_data_infile(NET *net) |
|
666 |
{
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
667 |
DBUG_ENTER("skip_load_data_infile"); |
668 |
||
|
1249.3.2
by monty at mysql
Fixes and code cleanups after merge with 4.0.3 |
669 |
(void)net_request_file(net, "/dev/null"); |
|
2181.142.1
by grog at lemis
slave.cc: |
670 |
(void)my_net_read(net); // discard response |
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
671 |
(void)net_write_command(net, 0, (uchar*) "", 0, (uchar*) "", 0); // ok |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
672 |
DBUG_VOID_RETURN; |
|
1249.3.2
by monty at mysql
Fixes and code cleanups after merge with 4.0.3 |
673 |
}
|
674 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
675 |
|
|
1249.3.2
by monty at mysql
Fixes and code cleanups after merge with 4.0.3 |
676 |
bool net_request_file(NET* net, const char* fname) |
677 |
{
|
|
678 |
DBUG_ENTER("net_request_file"); |
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
679 |
DBUG_RETURN(net_write_command(net, 251, (uchar*) fname, strlen(fname), |
680 |
(uchar*) "", 0)); |
|
|
148.1.1
by sasha at sashanet
skip updates with the same server id as self |
681 |
}
|
682 |
||
|
1346.293.1
by guilhem at mysql
WL#1036 (print the db in slave error messages). |
683 |
/*
|
684 |
From other comments and tests in code, it looks like
|
|
|
1346.305.1
by monty at mysql
Review of changesets since last pull. |
685 |
sometimes Query_log_event and Load_log_event can have db == 0
|
|
1346.293.1
by guilhem at mysql
WL#1036 (print the db in slave error messages). |
686 |
(see rewrite_db() above for example)
|
687 |
(cases where this happens are unclear; it may be when the master is 3.23).
|
|
688 |
*/
|
|
|
1346.305.1
by monty at mysql
Review of changesets since last pull. |
689 |
|
690 |
const char *print_slave_db_safe(const char* db) |
|
|
1346.293.1
by guilhem at mysql
WL#1036 (print the db in slave error messages). |
691 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
692 |
DBUG_ENTER("*print_slave_db_safe"); |
693 |
||
694 |
DBUG_RETURN((db ? db : "")); |
|
|
1346.293.1
by guilhem at mysql
WL#1036 (print the db in slave error messages). |
695 |
}
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
696 |
|
|
2303.68.4
by lars at mysql
Refactoring: Moved rli code to new file rpl_rli.cc. The idea being that rli |
697 |
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, |
|
2181.142.1
by grog at lemis
slave.cc: |
698 |
const char *default_val) |
|
2
by bk at mysql
Import changeset |
699 |
{
|
|
507
by monty at mysql
keep bk happy |
700 |
uint length; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
701 |
DBUG_ENTER("init_strvar_from_file"); |
702 |
||
|
507
by monty at mysql
keep bk happy |
703 |
if ((length=my_b_gets(f,var, max_size))) |
704 |
{
|
|
705 |
char* last_p = var + length -1; |
|
706 |
if (*last_p == '\n') |
|
707 |
*last_p = 0; // if we stopped on newline, kill it |
|
708 |
else
|
|
|
2
by bk at mysql
Import changeset |
709 |
{
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
710 |
/*
|
|
2181.142.1
by grog at lemis
slave.cc: |
711 |
If we truncated a line or stopped on last char, remove all chars
|
712 |
up to and including newline.
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
713 |
*/
|
|
507
by monty at mysql
keep bk happy |
714 |
int c; |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
715 |
while (((c=my_b_get(f)) != '\n' && c != my_b_EOF)); |
|
507
by monty at mysql
keep bk happy |
716 |
}
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
717 |
DBUG_RETURN(0); |
|
507
by monty at mysql
keep bk happy |
718 |
}
|
719 |
else if (default_val) |
|
720 |
{
|
|
|
676.136.5
by monty at mysql
Fix for make dist |
721 |
strmake(var, default_val, max_size-1); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
722 |
DBUG_RETURN(0); |
|
507
by monty at mysql
keep bk happy |
723 |
}
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
724 |
DBUG_RETURN(1); |
|
2
by bk at mysql
Import changeset |
725 |
}
|
726 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
727 |
|
|
2303.68.4
by lars at mysql
Refactoring: Moved rli code to new file rpl_rli.cc. The idea being that rli |
728 |
int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) |
|
2
by bk at mysql
Import changeset |
729 |
{
|
730 |
char buf[32]; |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
731 |
DBUG_ENTER("init_intvar_from_file"); |
732 |
||
|
2181.142.1
by grog at lemis
slave.cc: |
733 |
|
734 |
if (my_b_gets(f, buf, sizeof(buf))) |
|
|
507
by monty at mysql
keep bk happy |
735 |
{
|
736 |
*var = atoi(buf); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
737 |
DBUG_RETURN(0); |
|
507
by monty at mysql
keep bk happy |
738 |
}
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
739 |
else if (default_val) |
|
507
by monty at mysql
keep bk happy |
740 |
{
|
741 |
*var = default_val; |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
742 |
DBUG_RETURN(0); |
|
507
by monty at mysql
keep bk happy |
743 |
}
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
744 |
DBUG_RETURN(1); |
|
2
by bk at mysql
Import changeset |
745 |
}
|
746 |
||
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
747 |
/*
|
748 |
Note that we rely on the master's version (3.23, 4.0.14 etc) instead of
|
|
749 |
relying on the binlog's version. This is not perfect: imagine an upgrade
|
|
750 |
of the master without waiting that all slaves are in sync with the master;
|
|
751 |
then a slave could be fooled about the binlog's format. This is what happens
|
|
752 |
when people upgrade a 3.23 master to 4.0 without doing RESET MASTER: 4.0
|
|
753 |
slaves are fooled. So we do this only to distinguish between 3.23 and more
|
|
754 |
recent masters (it's too late to change things for 3.23).
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
755 |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
756 |
RETURNS
|
757 |
0 ok
|
|
758 |
1 error
|
|
759 |
*/
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
760 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
761 |
static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) |
|
906.1.1
by sasha at sashanet
work to enable reading 3.23 logs - not yet finished |
762 |
{
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
763 |
char err_buff[MAX_SLAVE_ERRMSG]; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
764 |
const char* errmsg= 0; |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
765 |
int err_code= 0; |
766 |
MYSQL_RES *master_res= 0; |
|
767 |
MYSQL_ROW master_row; |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
768 |
DBUG_ENTER("get_master_version_and_clock"); |
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
769 |
|
770 |
/*
|
|
771 |
Free old description_event_for_queue (that is needed if we are in
|
|
772 |
a reconnection).
|
|
773 |
*/
|
|
774 |
delete mi->rli.relay_log.description_event_for_queue; |
|
775 |
mi->rli.relay_log.description_event_for_queue= 0; |
|
|
2181.142.1
by grog at lemis
slave.cc: |
776 |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
777 |
if (!my_isdigit(&my_charset_bin,*mysql->server_version)) |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
778 |
{
|
|
1578.28.2
by pem at comhem
Post-merge fixes. |
779 |
errmsg = "Master reported unrecognized MySQL version"; |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
780 |
err_code= ER_SLAVE_FATAL_ERROR; |
781 |
sprintf(err_buff, ER(err_code), errmsg); |
|
782 |
}
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
783 |
else
|
784 |
{
|
|
785 |
/*
|
|
786 |
Note the following switch will bug when we have MySQL branch 30 ;)
|
|
787 |
*/
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
788 |
switch (*mysql->server_version) |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
789 |
{
|
790 |
case '0': |
|
791 |
case '1': |
|
792 |
case '2': |
|
793 |
errmsg = "Master reported unrecognized MySQL version"; |
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
794 |
err_code= ER_SLAVE_FATAL_ERROR; |
795 |
sprintf(err_buff, ER(err_code), errmsg); |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
796 |
break; |
797 |
case '3': |
|
798 |
mi->rli.relay_log.description_event_for_queue= new |
|
|
2181.142.1
by grog at lemis
slave.cc: |
799 |
Format_description_log_event(1, mysql->server_version); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
800 |
break; |
801 |
case '4': |
|
802 |
mi->rli.relay_log.description_event_for_queue= new |
|
|
2181.142.1
by grog at lemis
slave.cc: |
803 |
Format_description_log_event(3, mysql->server_version); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
804 |
break; |
|
2181.142.1
by grog at lemis
slave.cc: |
805 |
default:
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
806 |
/*
|
807 |
Master is MySQL >=5.0. Give a default Format_desc event, so that we can
|
|
808 |
take the early steps (like tests for "is this a 3.23 master") which we
|
|
809 |
have to take before we receive the real master's Format_desc which will
|
|
810 |
override this one. Note that the Format_desc we create below is garbage
|
|
811 |
(it has the format of the *slave*); it's only good to help know if the
|
|
812 |
master is 3.23, 4.0, etc.
|
|
813 |
*/
|
|
814 |
mi->rli.relay_log.description_event_for_queue= new |
|
|
2181.142.1
by grog at lemis
slave.cc: |
815 |
Format_description_log_event(4, mysql->server_version); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
816 |
break; |
817 |
}
|
|
818 |
}
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
819 |
|
820 |
/*
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
821 |
This does not mean that a 5.0 slave will be able to read a 6.0 master; but
|
822 |
as we don't know yet, we don't want to forbid this for now. If a 5.0 slave
|
|
823 |
can't read a 6.0 master, this will show up when the slave can't read some
|
|
824 |
events sent by the master, and there will be error messages.
|
|
825 |
*/
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
826 |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
827 |
if (errmsg) |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
828 |
goto err; |
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
829 |
|
830 |
/* as we are here, we tried to allocate the event */
|
|
831 |
if (!mi->rli.relay_log.description_event_for_queue) |
|
832 |
{
|
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
833 |
errmsg= "default Format_description_log_event"; |
834 |
err_code= ER_SLAVE_CREATE_EVENT_FAILURE; |
|
835 |
sprintf(err_buff, ER(err_code), errmsg); |
|
836 |
goto err; |
|
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
837 |
}
|
838 |
||
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
839 |
/*
|
840 |
Compare the master and slave's clock. Do not die if master's clock is
|
|
841 |
unavailable (very old master not supporting UNIX_TIMESTAMP()?).
|
|
842 |
*/
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
843 |
|
|
1810.1075.1
by bell at com
Inefficient usage of String::append() fixed. |
844 |
if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) && |
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
845 |
(master_res= mysql_store_result(mysql)) && |
846 |
(master_row= mysql_fetch_row(master_res))) |
|
847 |
{
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
848 |
mi->clock_diff_with_master= |
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
849 |
(long) (time((time_t*) 0) - strtoul(master_row[0], 0, 10)); |
850 |
}
|
|
|
2476.488.6
by kaa at polly
Fix for bug #29976: Excessive Slave I/O errors in replication tests |
851 |
else if (!check_io_slave_killed(mi->io_thd, mi, NULL)) |
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
852 |
{
|
853 |
mi->clock_diff_with_master= 0; /* The "most sensible" value */ |
|
|
2469.163.1
by monty at mysql
Fixed federated and some replication tests to not stop slave until it's up and running. |
854 |
sql_print_warning("\"SELECT UNIX_TIMESTAMP()\" failed on master, " |
855 |
"do not trust column Seconds_Behind_Master of SHOW "
|
|
856 |
"SLAVE STATUS. Error: %s (%d)", |
|
857 |
mysql_error(mysql), mysql_errno(mysql)); |
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
858 |
}
|
859 |
if (master_res) |
|
|
2181.142.1
by grog at lemis
slave.cc: |
860 |
mysql_free_result(master_res); |
861 |
||
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
862 |
/*
|
863 |
Check that the master's server id and ours are different. Because if they
|
|
864 |
are equal (which can result from a simple copy of master's datadir to slave,
|
|
865 |
thus copying some my.cnf), replication will work but all events will be
|
|
866 |
skipped.
|
|
867 |
Do not die if SHOW VARIABLES LIKE 'SERVER_ID' fails on master (very old
|
|
868 |
master?).
|
|
869 |
Note: we could have put a @@SERVER_ID in the previous SELECT
|
|
870 |
UNIX_TIMESTAMP() instead, but this would not have worked on 3.23 masters.
|
|
871 |
*/
|
|
|
1810.1075.1
by bell at com
Inefficient usage of String::append() fixed. |
872 |
if (!mysql_real_query(mysql, |
873 |
STRING_WITH_LEN("SHOW VARIABLES LIKE 'SERVER_ID'")) && |
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
874 |
(master_res= mysql_store_result(mysql))) |
875 |
{
|
|
876 |
if ((master_row= mysql_fetch_row(master_res)) && |
|
877 |
(::server_id == strtoul(master_row[1], 0, 10)) && |
|
|
2303.203.4
by mats at romeo
BUG#23171: Illegal group log position |
878 |
!mi->rli.replicate_same_server_id) |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
879 |
{
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
880 |
errmsg= "The slave I/O thread stops because master and slave have equal \ |
881 |
MySQL server ids; these ids must be different for replication to work (or \
|
|
882 |
the --replicate-same-server-id option must be used on slave but this does \
|
|
883 |
not always make sense; please check the manual before using it)."; |
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
884 |
err_code= ER_SLAVE_FATAL_ERROR; |
885 |
sprintf(err_buff, ER(err_code), errmsg); |
|
886 |
}
|
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
887 |
mysql_free_result(master_res); |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
888 |
if (errmsg) |
889 |
goto err; |
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
890 |
}
|
891 |
||
892 |
/*
|
|
893 |
Check that the master's global character_set_server and ours are the same.
|
|
894 |
Not fatal if query fails (old master?).
|
|
|
1616.712.1
by guilhem at mysql
Fix for BUG#4678 "mysql-test-run fails on grant_cache": |
895 |
Note that we don't check for equality of global character_set_client and
|
896 |
collation_connection (neither do we prevent their setting in
|
|
897 |
set_var.cc). That's because from what I (Guilhem) have tested, the global
|
|
898 |
values of these 2 are never used (new connections don't use them).
|
|
899 |
We don't test equality of global collation_database either as it's is
|
|
900 |
going to be deprecated (made read-only) in 4.1 very soon.
|
|
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
901 |
The test is only relevant if master < 5.0.3 (we'll test only if it's older
|
|
1773.35.31
by gbichot at mysql
disabling rpl_timezone.test if --ps-protocol, as binlogging of CONVERT_TZ(,,@@time_zone) |
902 |
than the 5 branch; < 5.0.3 was alpha...), as >= 5.0.3 master stores
|
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
903 |
charset info in each binlog event.
|
904 |
We don't do it for 3.23 because masters <3.23.50 hang on
|
|
905 |
SELECT @@unknown_var (BUG#7965 - see changelog of 3.23.50). So finally we
|
|
906 |
test only if master is 4.x.
|
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
907 |
*/
|
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
908 |
|
909 |
/* redundant with rest of code but safer against later additions */
|
|
910 |
if (*mysql->server_version == '3') |
|
|
1616.1501.1
by guilhem at mysql
Fix for BUG#7965 "Slave_IO_State Stuck at 'Checking Master Version'": |
911 |
goto err; |
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
912 |
|
913 |
if ((*mysql->server_version == '4') && |
|
|
1810.1075.1
by bell at com
Inefficient usage of String::append() fixed. |
914 |
!mysql_real_query(mysql, |
915 |
STRING_WITH_LEN("SELECT @@GLOBAL.COLLATION_SERVER")) && |
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
916 |
(master_res= mysql_store_result(mysql))) |
917 |
{
|
|
918 |
if ((master_row= mysql_fetch_row(master_res)) && |
|
919 |
strcmp(master_row[0], global_system_variables.collation_server->name)) |
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
920 |
{
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
921 |
errmsg= "The slave I/O thread stops because master and slave have \ |
922 |
different values for the COLLATION_SERVER global variable. The values must \
|
|
923 |
be equal for replication to work"; |
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
924 |
err_code= ER_SLAVE_FATAL_ERROR; |
925 |
sprintf(err_buff, ER(err_code), errmsg); |
|
926 |
}
|
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
927 |
mysql_free_result(master_res); |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
928 |
if (errmsg) |
929 |
goto err; |
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
930 |
}
|
931 |
||
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
932 |
/*
|
933 |
Perform analogous check for time zone. Theoretically we also should
|
|
934 |
perform check here to verify that SYSTEM time zones are the same on
|
|
935 |
slave and master, but we can't rely on value of @@system_time_zone
|
|
936 |
variable (it is time zone abbreviation) since it determined at start
|
|
937 |
time and so could differ for slave and master even if they are really
|
|
938 |
in the same system time zone. So we are omiting this check and just
|
|
939 |
relying on documentation. Also according to Monty there are many users
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
940 |
who are using replication between servers in various time zones. Hence
|
941 |
such check will broke everything for them. (And now everything will
|
|
942 |
work for them because by default both their master and slave will have
|
|
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
943 |
'SYSTEM' time zone).
|
|
1773.76.1
by gbichot at mysql
Last part of WL#1062: better replication of timezones: no more use |
944 |
This check is only necessary for 4.x masters (and < 5.0.4 masters but
|
945 |
those were alpha).
|
|
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
946 |
*/
|
|
1773.76.1
by gbichot at mysql
Last part of WL#1062: better replication of timezones: no more use |
947 |
if ((*mysql->server_version == '4') && |
|
1810.1075.1
by bell at com
Inefficient usage of String::append() fixed. |
948 |
!mysql_real_query(mysql, STRING_WITH_LEN("SELECT @@GLOBAL.TIME_ZONE")) && |
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
949 |
(master_res= mysql_store_result(mysql))) |
950 |
{
|
|
951 |
if ((master_row= mysql_fetch_row(master_res)) && |
|
|
2181.142.1
by grog at lemis
slave.cc: |
952 |
strcmp(master_row[0], |
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
953 |
global_system_variables.time_zone->get_name()->ptr())) |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
954 |
{
|
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
955 |
errmsg= "The slave I/O thread stops because master and slave have \ |
956 |
different values for the TIME_ZONE global variable. The values must \
|
|
957 |
be equal for replication to work"; |
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
958 |
err_code= ER_SLAVE_FATAL_ERROR; |
959 |
sprintf(err_buff, ER(err_code), errmsg); |
|
960 |
}
|
|
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
961 |
mysql_free_result(master_res); |
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
962 |
|
963 |
if (errmsg) |
|
964 |
goto err; |
|
|
1616.527.1
by dlenev at brandersnatch
WL#1264 "Per-thread time zone support infrastructure". |
965 |
}
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
966 |
|
|
1616.1501.1
by guilhem at mysql
Fix for BUG#7965 "Slave_IO_State Stuck at 'Checking Master Version'": |
967 |
err:
|
|
906.1.1
by sasha at sashanet
work to enable reading 3.23 logs - not yet finished |
968 |
if (errmsg) |
969 |
{
|
|
|
2512.36.1
by andrei at mysql1000
Bug #31316 Report server id clashes in SHOW SLAVE STATUS |
970 |
DBUG_ASSERT(err_code != 0); |
971 |
mi->report(ERROR_LEVEL, err_code, err_buff); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
972 |
DBUG_RETURN(1); |
|
906.1.1
by sasha at sashanet
work to enable reading 3.23 logs - not yet finished |
973 |
}
|
|
1616.460.1
by guilhem at mysql
Implementation of WL#1824 "Add replication of character set variables in 4.1", |
974 |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
975 |
DBUG_RETURN(0); |
|
906.1.1
by sasha at sashanet
work to enable reading 3.23 logs - not yet finished |
976 |
}
|
977 |
||
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
978 |
/*
|
979 |
Used by fetch_master_table (used by LOAD TABLE tblname FROM MASTER and LOAD
|
|
980 |
DATA FROM MASTER). Drops the table (if 'overwrite' is true) and recreates it
|
|
981 |
from the dump. Honours replication inclusion/exclusion rules.
|
|
|
1346.721.1
by guilhem at mysql
when we update thd->db in replication, it's safer to update thd->db_length too. |
982 |
db must be non-zero (guarded by assertion).
|
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
983 |
|
984 |
RETURN VALUES
|
|
985 |
0 success
|
|
986 |
1 error
|
|
987 |
*/
|
|
|
2
by bk at mysql
Import changeset |
988 |
|
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
989 |
static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, |
|
2181.142.1
by grog at lemis
slave.cc: |
990 |
const char* table_name, bool overwrite) |
|
2
by bk at mysql
Import changeset |
991 |
{
|
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
992 |
ulong packet_len; |
|
1346.721.1
by guilhem at mysql
when we update thd->db in replication, it's safer to update thd->db_length too. |
993 |
char *query, *save_db; |
994 |
uint32 save_db_length; |
|
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
995 |
Vio* save_vio; |
996 |
HA_CHECK_OPT check_opt; |
|
|
2
by bk at mysql
Import changeset |
997 |
TABLE_LIST tables; |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
998 |
int error= 1; |
999 |
handler *file; |
|
|
2303.92.8
by monty at mysql
Fixed compiler warnings (Mostly VC++): |
1000 |
ulonglong save_options; |
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
1001 |
NET *net= &mysql->net; |
|
2469.219.2
by marcsql at weblab
manual merge 5.0-runtime -> 5.1->runtime, with 25411 part I |
1002 |
const char *found_semicolon= NULL; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1003 |
DBUG_ENTER("create_table_from_dump"); |
|
1572.1.7
by monty at mysql
Fixes after merge |
1004 |
|
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
1005 |
packet_len= my_net_read(net); // read create table statement |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1006 |
if (packet_len == packet_error) |
1007 |
{
|
|
|
1627.29.4
by bell at com
post-review fixes |
1008 |
my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0)); |
|
1572.1.7
by monty at mysql
Fixes after merge |
1009 |
DBUG_RETURN(1); |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1010 |
}
|
1011 |
if (net->read_pos[0] == 255) // error from master |
|
1012 |
{
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
1013 |
char *err_msg; |
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
1014 |
err_msg= (char*) net->read_pos + ((mysql->server_capabilities & |
|
2181.142.1
by grog at lemis
slave.cc: |
1015 |
CLIENT_PROTOCOL_41) ? |
1016 |
3+SQLSTATE_LENGTH+1 : 3); |
|
|
1634.17.2
by bell at com
now my_printf_error is not better then my_error, but my_error call is shorter |
1017 |
my_error(ER_MASTER, MYF(0), err_msg); |
|
1572.1.7
by monty at mysql
Fixes after merge |
1018 |
DBUG_RETURN(1); |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1019 |
}
|
|
2
by bk at mysql
Import changeset |
1020 |
thd->command = COM_TABLE_DUMP; |
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
1021 |
thd->query_length= packet_len; |
|
676.269.1
by monty at mysql
Only set thd->query to 0 if LOCK_thread_count is hold |
1022 |
/* Note that we should not set thd->query until the area is initalized */
|
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
1023 |
if (!(query = thd->strmake((char*) net->read_pos, packet_len))) |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1024 |
{
|
1025 |
sql_print_error("create_table_from_dump: out of memory"); |
|
|
1627.29.4
by bell at com
post-review fixes |
1026 |
my_message(ER_GET_ERRNO, "Out of memory", MYF(0)); |
|
1572.1.7
by monty at mysql
Fixes after merge |
1027 |
DBUG_RETURN(1); |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1028 |
}
|
|
676.269.1
by monty at mysql
Only set thd->query to 0 if LOCK_thread_count is hold |
1029 |
thd->query= query; |
|
2476.517.1
by kostja at bodhi
Rename: query_error -> is_slave_error. |
1030 |
thd->is_slave_error = 0; |
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
1031 |
|
|
1572.1.7
by monty at mysql
Fixes after merge |
1032 |
bzero((char*) &tables,sizeof(tables)); |
1033 |
tables.db = (char*)db; |
|
|
1659.118.1
by monty at mysql
First stage of table definition cache |
1034 |
tables.alias= tables.table_name= (char*)table_name; |
|
1616.137.114
by bell at com
after review changes |
1035 |
|
|
1572.1.7
by monty at mysql
Fixes after merge |
1036 |
/* Drop the table if 'overwrite' is true */
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
1037 |
if (overwrite) |
|
1572.1.7
by monty at mysql
Fixes after merge |
1038 |
{
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
1039 |
if (mysql_rm_table(thd,&tables,1,0)) /* drop if exists */ |
1040 |
{
|
|
1041 |
sql_print_error("create_table_from_dump: failed to drop the table"); |
|
1042 |
goto err; |
|
1043 |
}
|
|
1044 |
else
|
|
1045 |
{
|
|
1046 |
/* Clear the OK result of mysql_rm_table(). */
|
|
1047 |
thd->main_da.reset_diagnostics_area(); |
|
1048 |
}
|
|
|
1572.1.7
by monty at mysql
Fixes after merge |
1049 |
}
|
1050 |
||
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
1051 |
/* Create the table. We do not want to log the "create table" statement */
|
|
909.1.1
by sasha at sashanet
use env vars for socket/port in connect in mysqltest |
1052 |
save_options = thd->options; |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
1053 |
thd->options &= ~ (OPTION_BIN_LOG); |
1054 |
thd_proc_info(thd, "Creating table from master dump"); |
|
|
507
by monty at mysql
keep bk happy |
1055 |
// save old db in case we are creating in a different database
|
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
1056 |
save_db = thd->db; |
|
1346.721.1
by guilhem at mysql
when we update thd->db in replication, it's safer to update thd->db_length too. |
1057 |
save_db_length= thd->db_length; |
|
689.2.1
by sasha at sashanet
updates for LOAD DATA FROM MASTER + some cleanup of replication code |
1058 |
thd->db = (char*)db; |
|
1700.327.2
by monty at mysql
Remove compiler warnings and remove not used variables |
1059 |
DBUG_ASSERT(thd->db != 0); |
|
1346.721.1
by guilhem at mysql
when we update thd->db in replication, it's safer to update thd->db_length too. |
1060 |
thd->db_length= strlen(thd->db); |
|
2469.219.2
by marcsql at weblab
manual merge 5.0-runtime -> 5.1->runtime, with 25411 part I |
1061 |
mysql_parse(thd, thd->query, packet_len, &found_semicolon); // run create table |
|
2181.142.1
by grog at lemis
slave.cc: |
1062 |
thd->db = save_db; // leave things the way the were before |
|
1346.721.1
by guilhem at mysql
when we update thd->db in replication, it's safer to update thd->db_length too. |
1063 |
thd->db_length= save_db_length; |
|
909.1.1
by sasha at sashanet
use env vars for socket/port in connect in mysqltest |
1064 |
thd->options = save_options; |
|
2181.142.1
by grog at lemis
slave.cc: |
1065 |
|
|
2476.517.1
by kostja at bodhi
Rename: query_error -> is_slave_error. |
1066 |
if (thd->is_slave_error) |
|
2181.142.1
by grog at lemis
slave.cc: |
1067 |
goto err; // mysql_parse took care of the error send |
|
2
by bk at mysql
Import changeset |
1068 |
|
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
1069 |
thd_proc_info(thd, "Opening master dump table"); |
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
1070 |
thd->main_da.reset_diagnostics_area(); /* cleanup from CREATE_TABLE */ |
|
2476.583.5
by istruewing at stella
Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE |
1071 |
/*
|
1072 |
Note: If this function starts to fail for MERGE tables,
|
|
1073 |
change the next two lines to these:
|
|
1074 |
tables.table= NULL; // was set by mysql_rm_table()
|
|
1075 |
if (!open_n_lock_single_table(thd, &tables, TL_WRITE))
|
|
1076 |
*/
|
|
|
2
by bk at mysql
Import changeset |
1077 |
tables.lock_type = TL_WRITE; |
|
2476.238.1
by marcsql at weblab
WL#3984 (Revise locking of mysql.general_log and mysql.slow_log) |
1078 |
if (!open_ltable(thd, &tables, TL_WRITE, 0)) |
|
507
by monty at mysql
keep bk happy |
1079 |
{
|
1080 |
sql_print_error("create_table_from_dump: could not open created table"); |
|
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1081 |
goto err; |
|
507
by monty at mysql
keep bk happy |
1082 |
}
|
|
2181.142.1
by grog at lemis
slave.cc: |
1083 |
|
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1084 |
file = tables.table->file; |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
1085 |
thd_proc_info(thd, "Reading master dump table data"); |
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
1086 |
/* Copy the data file */
|
|
507
by monty at mysql
keep bk happy |
1087 |
if (file->net_read_dump(net)) |
1088 |
{
|
|
|
1627.29.4
by bell at com
post-review fixes |
1089 |
my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0)); |
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
1090 |
sql_print_error("create_table_from_dump: failed in\ |
|
2
by bk at mysql
Import changeset |
1091 |
handler::net_read_dump()"); |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1092 |
goto err; |
|
507
by monty at mysql
keep bk happy |
1093 |
}
|
|
2
by bk at mysql
Import changeset |
1094 |
|
1095 |
check_opt.init(); |
|
|
973.26.66
by serg at mysql
mi_check flags cleanup |
1096 |
check_opt.flags|= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK; |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
1097 |
thd_proc_info(thd, "Rebuilding the index on master dump table"); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
1098 |
/*
|
1099 |
We do not want repair() to spam us with messages
|
|
1100 |
just send them to the error log, and report the failure in case of
|
|
1101 |
problems.
|
|
1102 |
*/
|
|
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1103 |
save_vio = thd->net.vio; |
|
507
by monty at mysql
keep bk happy |
1104 |
thd->net.vio = 0; |
|
1346.352.1
by guilhem at mysql
* Fix for BUG#1248: "LOAD DATA FROM MASTER drops the slave's db unexpectedly". |
1105 |
/* Rebuild the index file from the copied data file (with REPAIR) */
|
|
1810.1349.13
by holyfoot at deer
WL#2645 (CHECK TABLE FOR UPGRADE) |
1106 |
error=file->ha_repair(thd,&check_opt) != 0; |
|
2
by bk at mysql
Import changeset |
1107 |
thd->net.vio = save_vio; |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1108 |
if (error) |
|
1945.22.1
by monty at mysql
Table definition cache, part 2 |
1109 |
my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name.str); |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1110 |
|
1111 |
err:
|
|
|
2
by bk at mysql
Import changeset |
1112 |
close_thread_tables(thd); |
|
2181.142.1
by grog at lemis
slave.cc: |
1113 |
DBUG_RETURN(error); |
|
2
by bk at mysql
Import changeset |
1114 |
}
|
1115 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
1116 |
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1117 |
int fetch_master_table(THD *thd, const char *db_name, const char *table_name, |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
1118 |
Master_info *mi, MYSQL *mysql, bool overwrite) |
|
2
by bk at mysql
Import changeset |
1119 |
{
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1120 |
int error= 1; |
1121 |
const char *errmsg=0; |
|
1122 |
bool called_connected= (mysql != NULL); |
|
1123 |
DBUG_ENTER("fetch_master_table"); |
|
1124 |
DBUG_PRINT("enter", ("db_name: '%s' table_name: '%s'", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1125 |
db_name,table_name)); |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1126 |
|
1127 |
if (!called_connected) |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1128 |
{
|
|
1524.14.1
by hf at r18
SCRUM |
1129 |
if (!(mysql = mysql_init(NULL))) |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1130 |
{
|
1131 |
DBUG_RETURN(1); |
|
1132 |
}
|
|
|
689.8.1
by monty at mysql
merge |
1133 |
if (connect_to_master(thd, mysql, mi)) |
|
689.2.1
by sasha at sashanet
updates for LOAD DATA FROM MASTER + some cleanup of replication code |
1134 |
{
|
|
1634.17.2
by bell at com
now my_printf_error is not better then my_error, but my_error call is shorter |
1135 |
my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql)); |
|
1810.1794.1
by mats at mysql
Bug#19437 (Connection refused by server: "2002 Can't connect... /master.sock"): |
1136 |
/*
|
1137 |
We need to clear the active VIO since, theoretically, somebody
|
|
1138 |
might issue an awake() on this thread. If we are then in the
|
|
1139 |
middle of closing and destroying the VIO inside the
|
|
1140 |
mysql_close(), we will have a problem.
|
|
1141 |
*/
|
|
1142 |
#ifdef SIGNAL_WITH_VIO_CLOSE
|
|
1143 |
thd->clear_active_vio(); |
|
1144 |
#endif
|
|
|
1524.14.1
by hf at r18
SCRUM |
1145 |
mysql_close(mysql); |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1146 |
DBUG_RETURN(1); |
1147 |
}
|
|
1148 |
if (thd->killed) |
|
|
689.2.1
by sasha at sashanet
updates for LOAD DATA FROM MASTER + some cleanup of replication code |
1149 |
goto err; |
1150 |
}
|
|
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1151 |
|
|
689.1.21
by sasha at sashanet
sql/slave.cc |
1152 |
if (request_table_dump(mysql, db_name, table_name)) |
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1153 |
{
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1154 |
error= ER_UNKNOWN_ERROR; |
1155 |
errmsg= "Failed on table dump request"; |
|
|
676.37.39
by monty at mysql
Fixed bug that caused client to hang because mysqld never did send an |
1156 |
goto err; |
1157 |
}
|
|
|
1572.2.5
by monty at mysql
Merge with 4.0.16 |
1158 |
if (create_table_from_dump(thd, mysql, db_name, |
|
2181.142.1
by grog at lemis
slave.cc: |
1159 |
table_name, overwrite)) |
|
1572.2.5
by monty at mysql
Merge with 4.0.16 |
1160 |
goto err; // create_table_from_dump have sent the error already |
|
2
by bk at mysql
Import changeset |
1161 |
error = 0; |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1162 |
|
|
2
by bk at mysql
Import changeset |
1163 |
err:
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1164 |
if (!called_connected) |
|
1524.14.1
by hf at r18
SCRUM |
1165 |
mysql_close(mysql); |
|
1616.442.1
by hf at deer
Proposed fix for bug #3412 (embedded server: prepared statement returns |
1166 |
if (errmsg && thd->vio_ok()) |
|
1627.27.1
by bell at com
errors without code removed |
1167 |
my_message(error, errmsg, MYF(0)); |
|
2181.142.1
by grog at lemis
slave.cc: |
1168 |
DBUG_RETURN(test(error)); // Return 1 on error |
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
1169 |
}
|
1170 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
1171 |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
1172 |
static bool wait_for_relay_log_space(Relay_log_info* rli) |
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
1173 |
{
|
|
973.26.248
by monty at mysql
Fixed bug in wait_for_relay_log_space() |
1174 |
bool slave_killed=0; |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
1175 |
Master_info* mi = rli->mi; |
|
1546.59.7
by monty at mysql
Merge with 4.0.14 |
1176 |
const char *save_proc_info; |
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
1177 |
THD* thd = mi->io_thd; |
1178 |
DBUG_ENTER("wait_for_relay_log_space"); |
|
|
973.234.1
by monty at mysql
Extension of .frm file (not yet ready for push) |
1179 |
|
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
1180 |
pthread_mutex_lock(&rli->log_space_lock); |
|
1546.59.7
by monty at mysql
Merge with 4.0.14 |
1181 |
save_proc_info= thd->enter_cond(&rli->log_space_cond, |
|
2181.142.1
by grog at lemis
slave.cc: |
1182 |
&rli->log_space_lock, |
1183 |
"\
|
|
|
1616.4.11
by paul at kitebird
Change word order of a few PROCESSLIST messages to correspond |
1184 |
Waiting for the slave SQL thread to free enough relay log space"); |
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
1185 |
while (rli->log_space_limit < rli->log_space_total && |
|
2181.142.1
by grog at lemis
slave.cc: |
1186 |
!(slave_killed=io_slave_killed(thd,mi)) && |
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
1187 |
!rli->ignore_log_space_limit) |
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
1188 |
pthread_cond_wait(&rli->log_space_cond, &rli->log_space_lock); |
|
1346.226.23
by guilhem at mysql
Simplified a test. |
1189 |
thd->exit_cond(save_proc_info); |
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
1190 |
DBUG_RETURN(slave_killed); |
1191 |
}
|
|
1192 |
||
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
1193 |
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1194 |
/*
|
1195 |
Builds a Rotate from the ignored events' info and writes it to relay log.
|
|
1196 |
||
1197 |
SYNOPSIS
|
|
1198 |
write_ignored_events_info_to_relay_log()
|
|
1199 |
thd pointer to I/O thread's thd
|
|
1200 |
mi
|
|
1201 |
||
1202 |
DESCRIPTION
|
|
1203 |
Slave I/O thread, going to die, must leave a durable trace of the
|
|
1204 |
ignored events' end position for the use of the slave SQL thread, by
|
|
1205 |
calling this function. Only that thread can call it (see assertion).
|
|
1206 |
*/
|
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
1207 |
static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi) |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1208 |
{
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
1209 |
Relay_log_info *rli= &mi->rli; |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1210 |
pthread_mutex_t *log_lock= rli->relay_log.get_log_lock(); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1211 |
DBUG_ENTER("write_ignored_events_info_to_relay_log"); |
1212 |
||
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1213 |
DBUG_ASSERT(thd == mi->io_thd); |
1214 |
pthread_mutex_lock(log_lock); |
|
1215 |
if (rli->ign_master_log_name_end[0]) |
|
1216 |
{
|
|
1217 |
DBUG_PRINT("info",("writing a Rotate event to track down ignored events")); |
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
1218 |
Rotate_log_event *ev= new Rotate_log_event(rli->ign_master_log_name_end, |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1219 |
0, rli->ign_master_log_pos_end, |
1220 |
Rotate_log_event::DUP_NAME); |
|
1221 |
rli->ign_master_log_name_end[0]= 0; |
|
1222 |
/* can unlock before writing as slave SQL thd will soon see our Rotate */
|
|
1223 |
pthread_mutex_unlock(log_lock); |
|
1224 |
if (likely((bool)ev)) |
|
1225 |
{
|
|
1226 |
ev->server_id= 0; // don't be ignored by slave SQL thread |
|
1227 |
if (unlikely(rli->relay_log.append(ev))) |
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1228 |
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, |
1229 |
ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE), |
|
1230 |
"failed to write a Rotate event"
|
|
1231 |
" to the relay log, SHOW SLAVE STATUS may be"
|
|
1232 |
" inaccurate"); |
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1233 |
rli->relay_log.harvest_bytes_written(&rli->log_space_total); |
|
1810.1182.16
by serg at serg
many warnings (practically safe but annoying) corrected |
1234 |
if (flush_master_info(mi, 1)) |
1235 |
sql_print_error("Failed to flush master info file"); |
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1236 |
delete ev; |
1237 |
}
|
|
1238 |
else
|
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1239 |
mi->report(ERROR_LEVEL, ER_SLAVE_CREATE_EVENT_FAILURE, |
1240 |
ER(ER_SLAVE_CREATE_EVENT_FAILURE), |
|
1241 |
"Rotate_event (out of memory?),"
|
|
1242 |
" SHOW SLAVE STATUS may be inaccurate"); |
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1243 |
}
|
1244 |
else
|
|
1245 |
pthread_mutex_unlock(log_lock); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1246 |
DBUG_VOID_RETURN; |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
1247 |
}
|
1248 |
||
1249 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
1250 |
int register_slave_on_master(MYSQL* mysql, Master_info *mi, |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
1251 |
bool *suppress_warnings) |
|
689.3.1
by sasha at sashanet
A slave now can optionally register with the master providing the |
1252 |
{
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
1253 |
uchar buf[1024], *pos= buf; |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1254 |
uint report_host_len, report_user_len=0, report_password_len=0; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1255 |
DBUG_ENTER("register_slave_on_master"); |
|
689.3.1
by sasha at sashanet
A slave now can optionally register with the master providing the |
1256 |
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
1257 |
*suppress_warnings= FALSE; |
|
973.1.8
by monty at mysql
Removed compiler warnings. |
1258 |
if (!report_host) |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1259 |
DBUG_RETURN(0); |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1260 |
report_host_len= strlen(report_host); |
|
973.1.8
by monty at mysql
Removed compiler warnings. |
1261 |
if (report_user) |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1262 |
report_user_len= strlen(report_user); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
1263 |
if (report_password) |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1264 |
report_password_len= strlen(report_password); |
1265 |
/* 30 is a good safety margin */
|
|
1266 |
if (report_host_len + report_user_len + report_password_len + 30 > |
|
1267 |
sizeof(buf)) |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1268 |
DBUG_RETURN(0); // safety |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1269 |
|
1270 |
int4store(pos, server_id); pos+= 4; |
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
1271 |
pos= net_store_data(pos, (uchar*) report_host, report_host_len); |
1272 |
pos= net_store_data(pos, (uchar*) report_user, report_user_len); |
|
1273 |
pos= net_store_data(pos, (uchar*) report_password, report_password_len); |
|
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1274 |
int2store(pos, (uint16) report_port); pos+= 2; |
|
2181.142.1
by grog at lemis
slave.cc: |
1275 |
int4store(pos, rpl_recovery_rank); pos+= 4; |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1276 |
/* The master will fill in master_id */
|
|
2181.142.1
by grog at lemis
slave.cc: |
1277 |
int4store(pos, 0); pos+= 4; |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1278 |
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
1279 |
if (simple_command(mysql, COM_REGISTER_SLAVE, buf, (size_t) (pos- buf), 0)) |
|
689.3.1
by sasha at sashanet
A slave now can optionally register with the master providing the |
1280 |
{
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
1281 |
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED) |
1282 |
{
|
|
1283 |
*suppress_warnings= TRUE; // Suppress reconnect warning |
|
1284 |
}
|
|
|
2476.488.6
by kaa at polly
Fix for bug #29976: Excessive Slave I/O errors in replication tests |
1285 |
else if (!check_io_slave_killed(mi->io_thd, mi, NULL)) |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
1286 |
{
|
1287 |
char buf[256]; |
|
1288 |
my_snprintf(buf, sizeof(buf), "%s (Errno: %d)", mysql_error(mysql), |
|
1289 |
mysql_errno(mysql)); |
|
1290 |
mi->report(ERROR_LEVEL, ER_SLAVE_MASTER_COM_FAILURE, |
|
1291 |
ER(ER_SLAVE_MASTER_COM_FAILURE), "COM_REGISTER_SLAVE", buf); |
|
1292 |
}
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1293 |
DBUG_RETURN(1); |
|
689.3.1
by sasha at sashanet
A slave now can optionally register with the master providing the |
1294 |
}
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1295 |
DBUG_RETURN(0); |
|
689.3.1
by sasha at sashanet
A slave now can optionally register with the master providing the |
1296 |
}
|
1297 |
||
|
1546.38.1
by guilhem at gbichot2
On Feb 4th, 2003, Monty said he would push my patch to print replicate-do-table |
1298 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
1299 |
bool show_master_info(THD* thd, Master_info* mi) |
|
2
by bk at mysql
Import changeset |
1300 |
{
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1301 |
// TODO: fix this for multi-master
|
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1302 |
List<Item> field_list; |
1303 |
Protocol *protocol= thd->protocol; |
|
|
2
by bk at mysql
Import changeset |
1304 |
DBUG_ENTER("show_master_info"); |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1305 |
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
1306 |
field_list.push_back(new Item_empty_string("Slave_IO_State", |
|
2181.142.1
by grog at lemis
slave.cc: |
1307 |
14)); |
|
2
by bk at mysql
Import changeset |
1308 |
field_list.push_back(new Item_empty_string("Master_Host", |
|
2181.142.1
by grog at lemis
slave.cc: |
1309 |
sizeof(mi->host))); |
|
2
by bk at mysql
Import changeset |
1310 |
field_list.push_back(new Item_empty_string("Master_User", |
|
2181.142.1
by grog at lemis
slave.cc: |
1311 |
sizeof(mi->user))); |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1312 |
field_list.push_back(new Item_return_int("Master_Port", 7, |
|
2181.142.1
by grog at lemis
slave.cc: |
1313 |
MYSQL_TYPE_LONG)); |
|
1616.6.2
by paul at snake
Write slave status field names using consistent style. |
1314 |
field_list.push_back(new Item_return_int("Connect_Retry", 10, |
|
2181.142.1
by grog at lemis
slave.cc: |
1315 |
MYSQL_TYPE_LONG)); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1316 |
field_list.push_back(new Item_empty_string("Master_Log_File", |
|
2181.142.1
by grog at lemis
slave.cc: |
1317 |
FN_REFLEN)); |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1318 |
field_list.push_back(new Item_return_int("Read_Master_Log_Pos", 10, |
|
2181.142.1
by grog at lemis
slave.cc: |
1319 |
MYSQL_TYPE_LONGLONG)); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1320 |
field_list.push_back(new Item_empty_string("Relay_Log_File", |
|
2181.142.1
by grog at lemis
slave.cc: |
1321 |
FN_REFLEN)); |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1322 |
field_list.push_back(new Item_return_int("Relay_Log_Pos", 10, |
|
2181.142.1
by grog at lemis
slave.cc: |
1323 |
MYSQL_TYPE_LONGLONG)); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1324 |
field_list.push_back(new Item_empty_string("Relay_Master_Log_File", |
|
2181.142.1
by grog at lemis
slave.cc: |
1325 |
FN_REFLEN)); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1326 |
field_list.push_back(new Item_empty_string("Slave_IO_Running", 3)); |
1327 |
field_list.push_back(new Item_empty_string("Slave_SQL_Running", 3)); |
|
|
1616.6.2
by paul at snake
Write slave status field names using consistent style. |
1328 |
field_list.push_back(new Item_empty_string("Replicate_Do_DB", 20)); |
1329 |
field_list.push_back(new Item_empty_string("Replicate_Ignore_DB", 20)); |
|
1330 |
field_list.push_back(new Item_empty_string("Replicate_Do_Table", 20)); |
|
1331 |
field_list.push_back(new Item_empty_string("Replicate_Ignore_Table", 23)); |
|
1332 |
field_list.push_back(new Item_empty_string("Replicate_Wild_Do_Table", 24)); |
|
1333 |
field_list.push_back(new Item_empty_string("Replicate_Wild_Ignore_Table", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1334 |
28)); |
|
1616.6.2
by paul at snake
Write slave status field names using consistent style. |
1335 |
field_list.push_back(new Item_return_int("Last_Errno", 4, MYSQL_TYPE_LONG)); |
1336 |
field_list.push_back(new Item_empty_string("Last_Error", 20)); |
|
1337 |
field_list.push_back(new Item_return_int("Skip_Counter", 10, |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1338 |
MYSQL_TYPE_LONG)); |
|
1616.6.2
by paul at snake
Write slave status field names using consistent style. |
1339 |
field_list.push_back(new Item_return_int("Exec_Master_Log_Pos", 10, |
|
2181.142.1
by grog at lemis
slave.cc: |
1340 |
MYSQL_TYPE_LONGLONG)); |
|
1616.6.2
by paul at snake
Write slave status field names using consistent style. |
1341 |
field_list.push_back(new Item_return_int("Relay_Log_Space", 10, |
|
2181.142.1
by grog at lemis
slave.cc: |
1342 |
MYSQL_TYPE_LONGLONG)); |
|
1616.6.2
by paul at snake
Write slave status field names using consistent style. |
1343 |
field_list.push_back(new Item_empty_string("Until_Condition", 6)); |
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
1344 |
field_list.push_back(new Item_empty_string("Until_Log_File", FN_REFLEN)); |
|
2181.142.1
by grog at lemis
slave.cc: |
1345 |
field_list.push_back(new Item_return_int("Until_Log_Pos", 10, |
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
1346 |
MYSQL_TYPE_LONGLONG)); |
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
1347 |
field_list.push_back(new Item_empty_string("Master_SSL_Allowed", 7)); |
1348 |
field_list.push_back(new Item_empty_string("Master_SSL_CA_File", |
|
1349 |
sizeof(mi->ssl_ca))); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1350 |
field_list.push_back(new Item_empty_string("Master_SSL_CA_Path", |
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
1351 |
sizeof(mi->ssl_capath))); |
|
2181.142.1
by grog at lemis
slave.cc: |
1352 |
field_list.push_back(new Item_empty_string("Master_SSL_Cert", |
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
1353 |
sizeof(mi->ssl_cert))); |
|
2181.142.1
by grog at lemis
slave.cc: |
1354 |
field_list.push_back(new Item_empty_string("Master_SSL_Cipher", |
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
1355 |
sizeof(mi->ssl_cipher))); |
|
2181.142.1
by grog at lemis
slave.cc: |
1356 |
field_list.push_back(new Item_empty_string("Master_SSL_Key", |
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
1357 |
sizeof(mi->ssl_key))); |
|
1616.6.2
by paul at snake
Write slave status field names using consistent style. |
1358 |
field_list.push_back(new Item_return_int("Seconds_Behind_Master", 10, |
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
1359 |
MYSQL_TYPE_LONGLONG)); |
|
2409.108.1
by msvensson at pilot
Bug#19991 CHANGE MASTER need option ssl-verify-server-cert |
1360 |
field_list.push_back(new Item_empty_string("Master_SSL_Verify_Server_Cert", |
1361 |
3)); |
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1362 |
field_list.push_back(new Item_return_int("Last_IO_Errno", 4, MYSQL_TYPE_LONG)); |
1363 |
field_list.push_back(new Item_empty_string("Last_IO_Error", 20)); |
|
1364 |
field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG)); |
|
1365 |
field_list.push_back(new Item_empty_string("Last_SQL_Error", 20)); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1366 |
|
|
1624.55.1
by konstantin at mysql
Port of cursors to be pushed into 5.0 tree: |
1367 |
if (protocol->send_fields(&field_list, |
1368 |
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) |
|
|
1627.27.1
by bell at com
errors without code removed |
1369 |
DBUG_RETURN(TRUE); |
|
2
by bk at mysql
Import changeset |
1370 |
|
|
1214.1.1
by monty at mysql
Fixed timing problem with rpl000001 replication test. |
1371 |
if (mi->host[0]) |
1372 |
{
|
|
|
1346.226.31
by guilhem at mysql
Changed change_master() to use ER_MASTER_INFO (better display). |
1373 |
DBUG_PRINT("info",("host is set: '%s'", mi->host)); |
|
1214.1.1
by monty at mysql
Fixed timing problem with rpl000001 replication test. |
1374 |
String *packet= &thd->packet; |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1375 |
protocol->prepare_for_resend(); |
|
2181.142.1
by grog at lemis
slave.cc: |
1376 |
|
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
1377 |
/*
|
|
1810.3619.1
by elkin at inet
Bug #34305 show slave status handling segfaults when slave io is about |
1378 |
slave_running can be accessed without run_lock but not other
|
1379 |
non-volotile members like mi->io_thd, which is guarded by the mutex.
|
|
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
1380 |
*/
|
|
1810.3619.1
by elkin at inet
Bug #34305 show slave status handling segfaults when slave io is about |
1381 |
pthread_mutex_lock(&mi->run_lock); |
1382 |
protocol->store(mi->io_thd ? mi->io_thd->proc_info : "", &my_charset_bin); |
|
1383 |
pthread_mutex_unlock(&mi->run_lock); |
|
1384 |
||
|
1214.1.1
by monty at mysql
Fixed timing problem with rpl000001 replication test. |
1385 |
pthread_mutex_lock(&mi->data_lock); |
1386 |
pthread_mutex_lock(&mi->rli.data_lock); |
|
|
1494.22.10
by bar at r18
Replication were broken because of automatic charset conversion. |
1387 |
protocol->store(mi->host, &my_charset_bin); |
1388 |
protocol->store(mi->user, &my_charset_bin); |
|
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1389 |
protocol->store((uint32) mi->port); |
1390 |
protocol->store((uint32) mi->connect_retry); |
|
|
1494.22.10
by bar at r18
Replication were broken because of automatic charset conversion. |
1391 |
protocol->store(mi->master_log_name, &my_charset_bin); |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1392 |
protocol->store((ulonglong) mi->master_log_pos); |
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
1393 |
protocol->store(mi->rli.group_relay_log_name + |
|
2181.142.1
by grog at lemis
slave.cc: |
1394 |
dirname_length(mi->rli.group_relay_log_name), |
1395 |
&my_charset_bin); |
|
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
1396 |
protocol->store((ulonglong) mi->rli.group_relay_log_pos); |
1397 |
protocol->store(mi->rli.group_master_log_name, &my_charset_bin); |
|
|
1616.2161.2
by monty at mysql
Review of new pushed code |
1398 |
protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT ? |
1399 |
"Yes" : "No", &my_charset_bin); |
|
|
1494.22.10
by bar at r18
Replication were broken because of automatic charset conversion. |
1400 |
protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin); |
|
1700.355.10
by lars at mysql
WL#2472: Refactoring of replication and binlog filtering. |
1401 |
protocol->store(rpl_filter->get_do_db()); |
1402 |
protocol->store(rpl_filter->get_ignore_db()); |
|
1403 |
||
|
1546.38.1
by guilhem at gbichot2
On Feb 4th, 2003, Monty said he would push my patch to print replicate-do-table |
1404 |
char buf[256]; |
1405 |
String tmp(buf, sizeof(buf), &my_charset_bin); |
|
|
1700.355.10
by lars at mysql
WL#2472: Refactoring of replication and binlog filtering. |
1406 |
rpl_filter->get_do_table(&tmp); |
1407 |
protocol->store(&tmp); |
|
1408 |
rpl_filter->get_ignore_table(&tmp); |
|
1409 |
protocol->store(&tmp); |
|
1410 |
rpl_filter->get_wild_do_table(&tmp); |
|
1411 |
protocol->store(&tmp); |
|
1412 |
rpl_filter->get_wild_ignore_table(&tmp); |
|
|
1546.38.1
by guilhem at gbichot2
On Feb 4th, 2003, Monty said he would push my patch to print replicate-do-table |
1413 |
protocol->store(&tmp); |
1414 |
||
|
2476.106.18
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count has |
1415 |
protocol->store(mi->rli.last_error().number); |
1416 |
protocol->store(mi->rli.last_error().message, &my_charset_bin); |
|
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1417 |
protocol->store((uint32) mi->rli.slave_skip_counter); |
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
1418 |
protocol->store((ulonglong) mi->rli.group_master_log_pos); |
|
1388.12.1
by monty at mysql
rename of net_pkg.cc to protocol.cc |
1419 |
protocol->store((ulonglong) mi->rli.log_space_total); |
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
1420 |
|
1421 |
protocol->store( |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
1422 |
mi->rli.until_condition==Relay_log_info::UNTIL_NONE ? "None": |
1423 |
( mi->rli.until_condition==Relay_log_info::UNTIL_MASTER_POS? "Master": |
|
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
1424 |
"Relay"), &my_charset_bin); |
1425 |
protocol->store(mi->rli.until_log_name, &my_charset_bin); |
|
1426 |
protocol->store((ulonglong) mi->rli.until_log_pos); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1427 |
|
1428 |
#ifdef HAVE_OPENSSL
|
|
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
1429 |
protocol->store(mi->ssl? "Yes":"No", &my_charset_bin); |
1430 |
#else
|
|
1431 |
protocol->store(mi->ssl? "Ignored":"No", &my_charset_bin); |
|
1432 |
#endif
|
|
1433 |
protocol->store(mi->ssl_ca, &my_charset_bin); |
|
1434 |
protocol->store(mi->ssl_capath, &my_charset_bin); |
|
1435 |
protocol->store(mi->ssl_cert, &my_charset_bin); |
|
1436 |
protocol->store(mi->ssl_cipher, &my_charset_bin); |
|
1437 |
protocol->store(mi->ssl_key, &my_charset_bin); |
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
1438 |
|
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
1439 |
/*
|
1440 |
Seconds_Behind_Master: if SQL thread is running and I/O thread is
|
|
1441 |
connected, we can compute it otherwise show NULL (i.e. unknown).
|
|
1442 |
*/
|
|
1443 |
if ((mi->slave_running == MYSQL_SLAVE_RUN_CONNECT) && |
|
1444 |
mi->rli.slave_running) |
|
|
1616.176.1
by guilhem at mysql
After hours of unsuccessful research on |
1445 |
{
|
|
2469.140.7
by mats at romeo
Fixing portability problem by using my_time_t instead of time_t. |
1446 |
long time_diff= ((long)(time(0) - mi->rli.last_master_timestamp) |
|
1810.2323.19
by monty at mysql
Fixed compiler warnings detected by option -Wshadow and -Wunused: |
1447 |
- mi->clock_diff_with_master); |
|
1616.176.1
by guilhem at mysql
After hours of unsuccessful research on |
1448 |
/*
|
|
1810.2323.19
by monty at mysql
Fixed compiler warnings detected by option -Wshadow and -Wunused: |
1449 |
Apparently on some systems time_diff can be <0. Here are possible
|
1450 |
reasons related to MySQL:
|
|
|
1616.176.2
by guilhem at mysql
More comments on what could explain -1 in Seconds_Behind_Master in |
1451 |
- the master is itself a slave of another master whose time is ahead.
|
1452 |
- somebody used an explicit SET TIMESTAMP on the master.
|
|
1453 |
Possible reason related to granularity-to-second of time functions
|
|
1454 |
(nothing to do with MySQL), which can explain a value of -1:
|
|
1455 |
assume the master's and slave's time are perfectly synchronized, and
|
|
1456 |
that at slave's connection time, when the master's timestamp is read,
|
|
1457 |
it is at the very end of second 1, and (a very short time later) when
|
|
1458 |
the slave's timestamp is read it is at the very beginning of second
|
|
1459 |
2. Then the recorded value for master is 1 and the recorded value for
|
|
1460 |
slave is 2. At SHOW SLAVE STATUS time, assume that the difference
|
|
1461 |
between timestamp of slave and rli->last_master_timestamp is 0
|
|
1462 |
(i.e. they are in the same second), then we get 0-(2-1)=-1 as a result.
|
|
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
1463 |
This confuses users, so we don't go below 0: hence the max().
|
1464 |
||
1465 |
last_master_timestamp == 0 (an "impossible" timestamp 1970) is a
|
|
1466 |
special marker to say "consider we have caught up".
|
|
|
1616.176.1
by guilhem at mysql
After hours of unsuccessful research on |
1467 |
*/
|
|
1810.2323.19
by monty at mysql
Fixed compiler warnings detected by option -Wshadow and -Wunused: |
1468 |
protocol->store((longlong)(mi->rli.last_master_timestamp ? |
1469 |
max(0, time_diff) : 0)); |
|
|
1616.176.1
by guilhem at mysql
After hours of unsuccessful research on |
1470 |
}
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
1471 |
else
|
|
2409.108.1
by msvensson at pilot
Bug#19991 CHANGE MASTER need option ssl-verify-server-cert |
1472 |
{
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
1473 |
protocol->store_null(); |
|
2409.108.1
by msvensson at pilot
Bug#19991 CHANGE MASTER need option ssl-verify-server-cert |
1474 |
}
|
1475 |
protocol->store(mi->ssl_verify_server_cert? "Yes":"No", &my_charset_bin); |
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
1476 |
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1477 |
// Last_IO_Errno
|
|
2476.106.18
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count has |
1478 |
protocol->store(mi->last_error().number); |
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1479 |
// Last_IO_Error
|
|
2476.106.18
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count has |
1480 |
protocol->store(mi->last_error().message, &my_charset_bin); |
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1481 |
// Last_SQL_Errno
|
|
2476.106.18
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count has |
1482 |
protocol->store(mi->rli.last_error().number); |
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1483 |
// Last_SQL_Error
|
|
2476.106.18
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count has |
1484 |
protocol->store(mi->rli.last_error().message, &my_charset_bin); |
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
1485 |
|
|
1214.1.1
by monty at mysql
Fixed timing problem with rpl000001 replication test. |
1486 |
pthread_mutex_unlock(&mi->rli.data_lock); |
1487 |
pthread_mutex_unlock(&mi->data_lock); |
|
|
1810.1182.16
by serg at serg
many warnings (practically safe but annoying) corrected |
1488 |
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
1489 |
if (my_net_write(&thd->net, (uchar*) thd->packet.ptr(), packet->length())) |
|
1627.27.1
by bell at com
errors without code removed |
1490 |
DBUG_RETURN(TRUE); |
|
1214.1.1
by monty at mysql
Fixed timing problem with rpl000001 replication test. |
1491 |
}
|
|
2512.14.23
by kostja at dipika
Rename send_eof() to my_eof() for consistency with my_ok() and my_error() |
1492 |
my_eof(thd); |
|
1627.27.1
by bell at com
errors without code removed |
1493 |
DBUG_RETURN(FALSE); |
|
2
by bk at mysql
Import changeset |
1494 |
}
|
1495 |
||
|
1346.96.3
by monty at mysql
Fixes for Netware |
1496 |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
1497 |
void set_slave_thread_options(THD* thd) |
1498 |
{
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1499 |
DBUG_ENTER("set_slave_thread_options"); |
|
1810.2278.1
by ram at mysql
Fix for bug #19736 VIEW: column names not quoted properly when view is replicated |
1500 |
/*
|
1501 |
It's nonsense to constrain the slave threads with max_join_size; if a
|
|
1502 |
query succeeded on master, we HAVE to execute it. So set
|
|
1503 |
OPTION_BIG_SELECTS. Setting max_join_size to HA_POS_ERROR is not enough
|
|
1504 |
(and it's not needed if we have OPTION_BIG_SELECTS) because an INSERT
|
|
1505 |
SELECT examining more than 4 billion rows would still fail (yes, because
|
|
1506 |
when max_join_size is 4G, OPTION_BIG_SELECTS is automatically set, but
|
|
1507 |
only for client threads.
|
|
1508 |
*/
|
|
1509 |
ulonglong options= thd->options | OPTION_BIG_SELECTS; |
|
1510 |
if (opt_log_slave_updates) |
|
1511 |
options|= OPTION_BIN_LOG; |
|
1512 |
else
|
|
1513 |
options&= ~OPTION_BIN_LOG; |
|
1514 |
thd->options= options; |
|
|
1700.182.1
by acurtis at cyberkinetica
Ensure that slaves have normal COMMIT behaviour after WL#1967 |
1515 |
thd->variables.completion_type= 0; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1516 |
DBUG_VOID_RETURN; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
1517 |
}
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
1518 |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
1519 |
void set_slave_thread_default_charset(THD* thd, Relay_log_info const *rli) |
|
1773.76.1
by gbichot at mysql
Last part of WL#1062: better replication of timezones: no more use |
1520 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1521 |
DBUG_ENTER("set_slave_thread_default_charset"); |
1522 |
||
|
1773.76.1
by gbichot at mysql
Last part of WL#1062: better replication of timezones: no more use |
1523 |
thd->variables.character_set_client= |
1524 |
global_system_variables.character_set_client; |
|
1525 |
thd->variables.collation_connection= |
|
1526 |
global_system_variables.collation_connection; |
|
1527 |
thd->variables.collation_server= |
|
1528 |
global_system_variables.collation_server; |
|
1529 |
thd->update_charset(); |
|
|
2303.203.2
by mats at romeo
BUG#23171 (Illegal slave restart group position): |
1530 |
|
1531 |
/*
|
|
1532 |
We use a const cast here since the conceptual (and externally
|
|
1533 |
visible) behavior of the function is to set the default charset of
|
|
1534 |
the thread. That the cache has to be invalidated is a secondary
|
|
1535 |
effect.
|
|
1536 |
*/
|
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
1537 |
const_cast<Relay_log_info*>(rli)->cached_charset_invalidate(); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1538 |
DBUG_VOID_RETURN; |
|
1773.76.1
by gbichot at mysql
Last part of WL#1062: better replication of timezones: no more use |
1539 |
}
|
1540 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
1541 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
1542 |
init_slave_thread()
|
|
1439
by monty at mysql
Merge with 4.0.11 |
1543 |
*/
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
1544 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1545 |
static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) |
|
2
by bk at mysql
Import changeset |
1546 |
{
|
1547 |
DBUG_ENTER("init_slave_thread"); |
|
|
1810.3624.1
by andrei at inet
Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails |
1548 |
#if !defined(DBUG_OFF)
|
1549 |
int simulate_error= 0; |
|
1550 |
#endif
|
|
|
1346.437.1
by guilhem at mysql
- Fix for BUG#1858 "SQL-Thread stops working when using optimize table": |
1551 |
thd->system_thread = (thd_type == SLAVE_THD_SQL) ? |
|
2181.142.1
by grog at lemis
slave.cc: |
1552 |
SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO; |
|
1810.746.1
by bell at com
WL#2787 (part 2, ver 3 (merged)) changed securety context switching |
1553 |
thd->security_ctx->skip_grants(); |
|
2
by bk at mysql
Import changeset |
1554 |
my_net_init(&thd->net, 0); |
|
1616.2845.6
by elkin at inet
bug#19402 SQL close to the size of the max_allowed_packet fails on the slave |
1555 |
/*
|
1556 |
Adding MAX_LOG_EVENT_HEADER_LEN to the max_allowed_packet on all
|
|
1557 |
slave threads, since a replication event can become this much larger
|
|
1558 |
than the corresponding packet (query) sent from client to master.
|
|
1559 |
*/
|
|
|
1616.2846.1
by elkin at inet
BUG#19402 SQL close to the size of the max_allowed_packet fails on the slave |
1560 |
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet |
|
1616.2845.6
by elkin at inet
bug#19402 SQL close to the size of the max_allowed_packet fails on the slave |
1561 |
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */ |
|
247
by sasha at sashanet
repl-tests/test-repl-ts/repl-timestamp.master.reject |
1562 |
thd->slave_thread = 1; |
|
2476.284.4
by monty at mysql
Slow query log to file now displays queries with microsecond precission |
1563 |
thd->enable_slow_log= opt_log_slow_slave_statements; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
1564 |
set_slave_thread_options(thd); |
|
2
by bk at mysql
Import changeset |
1565 |
thd->client_capabilities = CLIENT_LOCAL_FILES; |
1566 |
pthread_mutex_lock(&LOCK_thread_count); |
|
|
2409.1.43
by monty at mysql
Fixed compiler warnings |
1567 |
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; |
|
2
by bk at mysql
Import changeset |
1568 |
pthread_mutex_unlock(&LOCK_thread_count); |
1569 |
||
|
1810.3624.1
by andrei at inet
Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails |
1570 |
DBUG_EXECUTE_IF("simulate_io_slave_error_on_init", |
1571 |
simulate_error|= (1 << SLAVE_THD_IO);); |
|
1572 |
DBUG_EXECUTE_IF("simulate_sql_slave_error_on_init", |
|
1573 |
simulate_error|= (1 << SLAVE_THD_SQL);); |
|
1574 |
#if !defined(DBUG_OFF)
|
|
1575 |
if (init_thr_lock() || thd->store_globals() || simulate_error & (1<< thd_type)) |
|
1576 |
#else
|
|
|
973.117.2
by sasha at sashanet
replication updates. This changeset seems to be working fine on test systems. |
1577 |
if (init_thr_lock() || thd->store_globals()) |
|
1810.3624.1
by andrei at inet
Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails |
1578 |
#endif
|
|
2
by bk at mysql
Import changeset |
1579 |
{
|
|
1346.137.2
by monty at mysql
Fix that round(0.1,1) == round(0.1,1) |
1580 |
thd->cleanup(); |
|
2
by bk at mysql
Import changeset |
1581 |
DBUG_RETURN(-1); |
1582 |
}
|
|
|
2476.463.7
by istruewing at stella
Bug#31210 - INSERT DELAYED crashes server when used on |
1583 |
lex_start(thd); |
|
2
by bk at mysql
Import changeset |
1584 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1585 |
if (thd_type == SLAVE_THD_SQL) |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
1586 |
thd_proc_info(thd, "Waiting for the next event in relay log"); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1587 |
else
|
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
1588 |
thd_proc_info(thd, "Waiting for master update"); |
|
2
by bk at mysql
Import changeset |
1589 |
thd->version=refresh_version; |
1590 |
thd->set_time(); |
|
1591 |
DBUG_RETURN(0); |
|
1592 |
}
|
|
1593 |
||
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1594 |
|
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
1595 |
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, |
|
2181.142.1
by grog at lemis
slave.cc: |
1596 |
void* thread_killed_arg) |
|
2
by bk at mysql
Import changeset |
1597 |
{
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1598 |
int nap_time; |
|
2
by bk at mysql
Import changeset |
1599 |
thr_alarm_t alarmed; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1600 |
DBUG_ENTER("safe_sleep"); |
1601 |
||
|
2
by bk at mysql
Import changeset |
1602 |
thr_alarm_init(&alarmed); |
|
2476.284.4
by monty at mysql
Slow query log to file now displays queries with microsecond precission |
1603 |
time_t start_time= my_time(0); |
|
2
by bk at mysql
Import changeset |
1604 |
time_t end_time= start_time+sec; |
1605 |
||
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1606 |
while ((nap_time= (int) (end_time - start_time)) > 0) |
|
2
by bk at mysql
Import changeset |
1607 |
{
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1608 |
ALARM alarm_buff; |
|
507
by monty at mysql
keep bk happy |
1609 |
/*
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
1610 |
The only reason we are asking for alarm is so that
|
|
507
by monty at mysql
keep bk happy |
1611 |
we will be woken up in case of murder, so if we do not get killed,
|
1612 |
set the alarm so it goes off after we wake up naturally
|
|
1613 |
*/
|
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1614 |
thr_alarm(&alarmed, 2 * nap_time, &alarm_buff); |
|
2
by bk at mysql
Import changeset |
1615 |
sleep(nap_time); |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1616 |
thr_end_alarm(&alarmed); |
|
2181.142.1
by grog at lemis
slave.cc: |
1617 |
|
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
1618 |
if ((*thread_killed)(thd,thread_killed_arg)) |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1619 |
DBUG_RETURN(1); |
|
2476.284.4
by monty at mysql
Slow query log to file now displays queries with microsecond precission |
1620 |
start_time= my_time(0); |
|
2
by bk at mysql
Import changeset |
1621 |
}
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1622 |
DBUG_RETURN(0); |
|
2
by bk at mysql
Import changeset |
1623 |
}
|
1624 |
||
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1625 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
1626 |
static int request_dump(MYSQL* mysql, Master_info* mi, |
|
2181.142.1
by grog at lemis
slave.cc: |
1627 |
bool *suppress_warnings) |
|
2
by bk at mysql
Import changeset |
1628 |
{
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
1629 |
uchar buf[FN_REFLEN + 10]; |
|
2
by bk at mysql
Import changeset |
1630 |
int len; |
1631 |
int binlog_flags = 0; // for now |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
1632 |
char* logname = mi->master_log_name; |
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1633 |
DBUG_ENTER("request_dump"); |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
1634 |
|
1635 |
*suppress_warnings= FALSE; |
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1636 |
|
|
973.26.26
by monty at mysql
New error messages |
1637 |
// TODO if big log files: Change next to int8store()
|
|
1616.1202.3
by monty at mysql
More debugging |
1638 |
int4store(buf, (ulong) mi->master_log_pos); |
|
2
by bk at mysql
Import changeset |
1639 |
int2store(buf + 4, binlog_flags); |
|
140.1.2
by sasha at sashanet
bug fixes in server-id, moved replication functionality to |
1640 |
int4store(buf + 6, server_id); |
|
38.1.1
by monty at mysql
FLUSH TABLE table_list |
1641 |
len = (uint) strlen(logname); |
|
140.1.2
by sasha at sashanet
bug fixes in server-id, moved replication functionality to |
1642 |
memcpy(buf + 10, logname,len); |
|
1524.14.1
by hf at r18
SCRUM |
1643 |
if (simple_command(mysql, COM_BINLOG_DUMP, buf, len + 10, 1)) |
|
507
by monty at mysql
keep bk happy |
1644 |
{
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
1645 |
/*
|
1646 |
Something went wrong, so we will just reconnect and retry later
|
|
1647 |
in the future, we should do a better error analysis, but for
|
|
1648 |
now we just fill up the error log :-)
|
|
1649 |
*/
|
|
|
1524.14.1
by hf at r18
SCRUM |
1650 |
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED) |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
1651 |
*suppress_warnings= TRUE; // Suppress reconnect warning |
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1652 |
else
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1653 |
sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs", |
|
2181.142.1
by grog at lemis
slave.cc: |
1654 |
mysql_errno(mysql), mysql_error(mysql), |
1655 |
master_connect_retry); |
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1656 |
DBUG_RETURN(1); |
|
507
by monty at mysql
keep bk happy |
1657 |
}
|
|
2
by bk at mysql
Import changeset |
1658 |
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
1659 |
DBUG_RETURN(0); |
|
2
by bk at mysql
Import changeset |
1660 |
}
|
1661 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
1662 |
|
|
689.2.1
by sasha at sashanet
updates for LOAD DATA FROM MASTER + some cleanup of replication code |
1663 |
static int request_table_dump(MYSQL* mysql, const char* db, const char* table) |
|
2
by bk at mysql
Import changeset |
1664 |
{
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
1665 |
uchar buf[1024], *p = buf; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1666 |
DBUG_ENTER("request_table_dump"); |
1667 |
||
|
38.1.1
by monty at mysql
FLUSH TABLE table_list |
1668 |
uint table_len = (uint) strlen(table); |
1669 |
uint db_len = (uint) strlen(db); |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
1670 |
if (table_len + db_len > sizeof(buf) - 2) |
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1671 |
{
|
1672 |
sql_print_error("request_table_dump: Buffer overrun"); |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1673 |
DBUG_RETURN(1); |
|
2181.142.1
by grog at lemis
slave.cc: |
1674 |
}
|
1675 |
||
|
2
by bk at mysql
Import changeset |
1676 |
*p++ = db_len; |
1677 |
memcpy(p, db, db_len); |
|
1678 |
p += db_len; |
|
1679 |
*p++ = table_len; |
|
1680 |
memcpy(p, table, table_len); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1681 |
|
|
1524.14.1
by hf at r18
SCRUM |
1682 |
if (simple_command(mysql, COM_TABLE_DUMP, buf, p - buf + table_len, 1)) |
|
507
by monty at mysql
keep bk happy |
1683 |
{
|
1684 |
sql_print_error("request_table_dump: Error sending the table dump \ |
|
|
2
by bk at mysql
Import changeset |
1685 |
command"); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1686 |
DBUG_RETURN(1); |
|
507
by monty at mysql
keep bk happy |
1687 |
}
|
|
2
by bk at mysql
Import changeset |
1688 |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1689 |
DBUG_RETURN(0); |
|
2
by bk at mysql
Import changeset |
1690 |
}
|
1691 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
1692 |
|
|
676.177.116
by monty at mysql
Fix wrong usage of constant which could cause mysqld to use index when doing an update/delete on small tables. |
1693 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
1694 |
Read one event from the master
|
|
2181.142.1
by grog at lemis
slave.cc: |
1695 |
|
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1696 |
SYNOPSIS
|
1697 |
read_event()
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
1698 |
mysql MySQL connection
|
1699 |
mi Master connection information
|
|
1700 |
suppress_warnings TRUE when a normal net read timeout has caused us to
|
|
1701 |
try a reconnect. We do not want to print anything to
|
|
1702 |
the error log in this case because this a anormal
|
|
1703 |
event in an idle server.
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
1704 |
|
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1705 |
RETURN VALUES
|
|
2181.142.1
by grog at lemis
slave.cc: |
1706 |
'packet_error' Error
|
1707 |
number Length of packet
|
|
|
676.177.116
by monty at mysql
Fix wrong usage of constant which could cause mysqld to use index when doing an update/delete on small tables. |
1708 |
*/
|
1709 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
1710 |
static ulong read_event(MYSQL* mysql, Master_info *mi, bool* suppress_warnings) |
|
2
by bk at mysql
Import changeset |
1711 |
{
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
1712 |
ulong len; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1713 |
DBUG_ENTER("read_event"); |
|
507
by monty at mysql
keep bk happy |
1714 |
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
1715 |
*suppress_warnings= FALSE; |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
1716 |
/*
|
1717 |
my_real_read() will time us out
|
|
1718 |
We check if we were told to die, and if not, try reading again
|
|
1719 |
*/
|
|
|
275.1.1
by sasha at sashanet
mysql-test/mysql-test-run |
1720 |
#ifndef DBUG_OFF
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
1721 |
if (disconnect_slave_event_count && !(mi->events_till_disconnect--)) |
|
2181.142.1
by grog at lemis
slave.cc: |
1722 |
DBUG_RETURN(packet_error); |
|
275.1.1
by sasha at sashanet
mysql-test/mysql-test-run |
1723 |
#endif
|
|
2181.142.1
by grog at lemis
slave.cc: |
1724 |
|
|
1810.1967.8
by kostja at bodhi
A fix and a test case for Bug#15752 "Lost connection to MySQL server |
1725 |
len = cli_safe_read(mysql); |
|
676.177.28
by nick at leippe
Backport of Sasha's fix to 3.23 from 4.0 |
1726 |
if (len == packet_error || (long) len < 1) |
1727 |
{
|
|
|
1524.14.1
by hf at r18
SCRUM |
1728 |
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED) |
|
676.177.116
by monty at mysql
Fix wrong usage of constant which could cause mysqld to use index when doing an update/delete on small tables. |
1729 |
{
|
1730 |
/*
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
1731 |
We are trying a normal reconnect after a read timeout;
|
1732 |
we suppress prints to .err file as long as the reconnect
|
|
1733 |
happens without problems
|
|
|
676.177.116
by monty at mysql
Fix wrong usage of constant which could cause mysqld to use index when doing an update/delete on small tables. |
1734 |
*/
|
1735 |
*suppress_warnings= TRUE; |
|
|
676.177.110
by heikki at mysql
slave.cc: |
1736 |
}
|
|
676.177.116
by monty at mysql
Fix wrong usage of constant which could cause mysqld to use index when doing an update/delete on small tables. |
1737 |
else
|
|
1659.83.7
by serg at serg
auto-ROLLBACK if binlog was not closed properly |
1738 |
sql_print_error("Error reading packet from server: %s ( server_errno=%d)", |
|
2181.142.1
by grog at lemis
slave.cc: |
1739 |
mysql_error(mysql), mysql_errno(mysql)); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1740 |
DBUG_RETURN(packet_error); |
|
2
by bk at mysql
Import changeset |
1741 |
}
|
1742 |
||
|
1563.1.20
by monty at mysql
hanged UDF interface to use clear() instead of reset() |
1743 |
/* Check if eof packet */
|
1744 |
if (len < 8 && mysql->net.read_pos[0] == 254) |
|
|
507
by monty at mysql
keep bk happy |
1745 |
{
|
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
1746 |
sql_print_information("Slave: received end packet from server, apparent " |
1747 |
"master shutdown: %s", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1748 |
mysql_error(mysql)); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1749 |
DBUG_RETURN(packet_error); |
|
507
by monty at mysql
keep bk happy |
1750 |
}
|
|
2181.142.1
by grog at lemis
slave.cc: |
1751 |
|
|
2303.85.3
by monty at mysql
Fixed a LOT of compiler warnings |
1752 |
DBUG_PRINT("exit", ("len: %lu net->read_pos[4]: %d", |
|
2181.142.1
by grog at lemis
slave.cc: |
1753 |
len, mysql->net.read_pos[4])); |
1754 |
DBUG_RETURN(len - 1); |
|
|
2
by bk at mysql
Import changeset |
1755 |
}
|
1756 |
||
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1757 |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
1758 |
int check_expected_error(THD* thd, Relay_log_info const *rli, |
|
2303.203.2
by mats at romeo
BUG#23171 (Illegal slave restart group position): |
1759 |
int expected_error) |
|
668.1.1
by sasha at sashanet
do not log the drop internal temporary tables into the binary log |
1760 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1761 |
DBUG_ENTER("check_expected_error"); |
1762 |
||
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1763 |
switch (expected_error) { |
1764 |
case ER_NET_READ_ERROR: |
|
|
2181.142.1
by grog at lemis
slave.cc: |
1765 |
case ER_NET_ERROR_ON_WRITE: |
|
1810.2830.1
by mats at romeo
BUG#26551 (Aborted query for non-transactional table breaks replication): |
1766 |
case ER_QUERY_INTERRUPTED: |
|
2181.142.1
by grog at lemis
slave.cc: |
1767 |
case ER_SERVER_SHUTDOWN: |
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1768 |
case ER_NEW_ABORTING_CONNECTION: |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1769 |
DBUG_RETURN(1); |
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1770 |
default:
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1771 |
DBUG_RETURN(0); |
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
1772 |
}
|
|
668.1.1
by sasha at sashanet
do not log the drop internal temporary tables into the binary log |
1773 |
}
|
|
135.2.1
by monty at mysql
Fixed indention, removed compiler varnings and fixed a bug |
1774 |
|
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
1775 |
|
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
1776 |
/*
|
1777 |
Check if the current error is of temporary nature of not.
|
|
1778 |
Some errors are temporary in nature, such as
|
|
1779 |
ER_LOCK_DEADLOCK and ER_LOCK_WAIT_TIMEOUT. Ndb also signals
|
|
1780 |
that the error is temporary by pushing a warning with the error code
|
|
1781 |
ER_GET_TEMPORARY_ERRMSG, if the originating error is temporary.
|
|
1782 |
*/
|
|
1783 |
static int has_temporary_error(THD *thd) |
|
1784 |
{
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1785 |
DBUG_ENTER("has_temporary_error"); |
1786 |
||
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
1787 |
if (thd->is_fatal_error) |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1788 |
DBUG_RETURN(0); |
|
2476.597.15
by mats at dnsalias
BUG#24860 (Incorrect SLAVE_TRANSACTION_RETRIES code can result in slave stuck): |
1789 |
|
1790 |
DBUG_EXECUTE_IF("all_errors_are_temporary_errors", |
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
1791 |
if (thd->main_da.is_error()) |
1792 |
{
|
|
1793 |
thd->clear_error(); |
|
1794 |
my_error(ER_LOCK_DEADLOCK, MYF(0)); |
|
1795 |
});
|
|
1796 |
||
1797 |
/*
|
|
1798 |
If there is no message in THD, we can't say if it's a temporary
|
|
1799 |
error or not. This is currently the case for Incident_log_event,
|
|
1800 |
which sets no message. Return FALSE.
|
|
1801 |
*/
|
|
1802 |
if (!thd->is_error()) |
|
1803 |
DBUG_RETURN(0); |
|
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
1804 |
|
1805 |
/*
|
|
1806 |
Temporary error codes:
|
|
1807 |
currently, InnoDB deadlock detected by InnoDB or lock
|
|
1808 |
wait timeout (innodb_lock_wait_timeout exceeded
|
|
1809 |
*/
|
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
1810 |
if (thd->main_da.sql_errno() == ER_LOCK_DEADLOCK || |
1811 |
thd->main_da.sql_errno() == ER_LOCK_WAIT_TIMEOUT) |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1812 |
DBUG_RETURN(1); |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
1813 |
|
1814 |
#ifdef HAVE_NDB_BINLOG
|
|
1815 |
/*
|
|
1816 |
currently temporary error set in ndbcluster
|
|
1817 |
*/
|
|
1818 |
List_iterator_fast<MYSQL_ERROR> it(thd->warn_list); |
|
1819 |
MYSQL_ERROR *err; |
|
1820 |
while ((err= it++)) |
|
1821 |
{
|
|
|
2076.44.1
by serg at serg
dbug changes: |
1822 |
DBUG_PRINT("info", ("has warning %d %s", err->code, err->msg)); |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
1823 |
switch (err->code) |
1824 |
{
|
|
1825 |
case ER_GET_TEMPORARY_ERRMSG: |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1826 |
DBUG_RETURN(1); |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
1827 |
default:
|
1828 |
break; |
|
1829 |
}
|
|
1830 |
}
|
|
1831 |
#endif
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
1832 |
DBUG_RETURN(0); |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
1833 |
}
|
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
1834 |
|
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
1835 |
|
1836 |
/**
|
|
1837 |
Applies the given event and advances the relay log position.
|
|
1838 |
||
1839 |
In essence, this function does:
|
|
1840 |
||
1841 |
@code
|
|
1842 |
ev->apply_event(rli);
|
|
1843 |
ev->update_pos(rli);
|
|
1844 |
@endcode
|
|
1845 |
||
1846 |
But it also does some maintainance, such as skipping events if
|
|
1847 |
needed and reporting errors.
|
|
1848 |
||
1849 |
If the @c skip flag is set, then it is tested whether the event
|
|
1850 |
should be skipped, by looking at the slave_skip_counter and the
|
|
1851 |
server id. The skip flag should be set when calling this from a
|
|
1852 |
replication thread but not set when executing an explicit BINLOG
|
|
1853 |
statement.
|
|
1854 |
||
1855 |
@retval 0 OK.
|
|
1856 |
||
1857 |
@retval 1 Error calling ev->apply_event().
|
|
1858 |
||
1859 |
@retval 2 No error calling ev->apply_event(), but error calling
|
|
1860 |
ev->update_pos().
|
|
1861 |
*/
|
|
1862 |
int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli, |
|
1863 |
bool skip) |
|
1864 |
{
|
|
1865 |
int exec_res= 0; |
|
1866 |
||
1867 |
DBUG_ENTER("apply_event_and_update_pos"); |
|
1868 |
||
1869 |
DBUG_PRINT("exec_event",("%s(type_code: %d; server_id: %d)", |
|
1870 |
ev->get_type_str(), ev->get_type_code(), |
|
1871 |
ev->server_id)); |
|
1872 |
DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu", |
|
1873 |
FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), |
|
1874 |
FLAGSTR(thd->options, OPTION_BEGIN), |
|
1875 |
rli->last_event_start_time)); |
|
1876 |
||
1877 |
/*
|
|
1878 |
Execute the event to change the database and update the binary
|
|
1879 |
log coordinates, but first we set some data that is needed for
|
|
1880 |
the thread.
|
|
1881 |
||
1882 |
The event will be executed unless it is supposed to be skipped.
|
|
1883 |
||
1884 |
Queries originating from this server must be skipped. Low-level
|
|
1885 |
events (Format_description_log_event, Rotate_log_event,
|
|
1886 |
Stop_log_event) from this server must also be skipped. But for
|
|
1887 |
those we don't want to modify 'group_master_log_pos', because
|
|
1888 |
these events did not exist on the master.
|
|
1889 |
Format_description_log_event is not completely skipped.
|
|
1890 |
||
1891 |
Skip queries specified by the user in 'slave_skip_counter'. We
|
|
1892 |
can't however skip events that has something to do with the log
|
|
1893 |
files themselves.
|
|
1894 |
||
1895 |
Filtering on own server id is extremely important, to ignore
|
|
1896 |
execution of events created by the creation/rotation of the relay
|
|
1897 |
log (remember that now the relay log starts with its Format_desc,
|
|
1898 |
has a Rotate etc).
|
|
1899 |
*/
|
|
1900 |
||
1901 |
thd->server_id = ev->server_id; // use the original server id for logging |
|
1902 |
thd->set_time(); // time the query |
|
1903 |
thd->lex->current_select= 0; |
|
1904 |
if (!ev->when) |
|
1905 |
ev->when= my_time(0); |
|
1906 |
ev->thd = thd; // because up to this point, ev->thd == 0 |
|
1907 |
||
1908 |
if (skip) |
|
1909 |
{
|
|
1910 |
int reason= ev->shall_skip(rli); |
|
1911 |
if (reason == Log_event::EVENT_SKIP_COUNT) |
|
1912 |
--rli->slave_skip_counter; |
|
1913 |
pthread_mutex_unlock(&rli->data_lock); |
|
1914 |
if (reason == Log_event::EVENT_SKIP_NOT) |
|
1915 |
exec_res= ev->apply_event(rli); |
|
1916 |
#ifndef DBUG_OFF
|
|
1917 |
/*
|
|
1918 |
This only prints information to the debug trace.
|
|
1919 |
||
1920 |
TODO: Print an informational message to the error log?
|
|
1921 |
*/
|
|
1922 |
static const char *const explain[] = { |
|
1923 |
// EVENT_SKIP_NOT,
|
|
1924 |
"not skipped", |
|
1925 |
// EVENT_SKIP_IGNORE,
|
|
1926 |
"skipped because event should be ignored", |
|
1927 |
// EVENT_SKIP_COUNT
|
|
1928 |
"skipped because event skip counter was non-zero"
|
|
1929 |
};
|
|
1930 |
DBUG_PRINT("info", ("OPTION_BEGIN: %d; IN_STMT: %d", |
|
1931 |
thd->options & OPTION_BEGIN ? 1 : 0, |
|
1932 |
rli->get_flag(Relay_log_info::IN_STMT))); |
|
1933 |
DBUG_PRINT("skip_event", ("%s event was %s", |
|
1934 |
ev->get_type_str(), explain[reason])); |
|
1935 |
#endif
|
|
1936 |
}
|
|
1937 |
else
|
|
1938 |
exec_res= ev->apply_event(rli); |
|
1939 |
||
1940 |
DBUG_PRINT("info", ("apply_event error = %d", exec_res)); |
|
1941 |
if (exec_res == 0) |
|
1942 |
{
|
|
1943 |
int error= ev->update_pos(rli); |
|
|
2512.1.31
by alik at quad
Patch to eliminate some valgrind warnings in debug printout code. |
1944 |
#ifdef HAVE_purify
|
1945 |
if (!rli->is_fake) |
|
1946 |
#endif
|
|
1947 |
{
|
|
|
2512.1.32
by alik at quad
Disabling declaration of debug variable for non-debug builds. |
1948 |
#ifndef DBUG_OFF
|
|
2512.1.31
by alik at quad
Patch to eliminate some valgrind warnings in debug printout code. |
1949 |
char buf[22]; |
|
2512.1.32
by alik at quad
Disabling declaration of debug variable for non-debug builds. |
1950 |
#endif
|
|
2512.1.31
by alik at quad
Patch to eliminate some valgrind warnings in debug printout code. |
1951 |
DBUG_PRINT("info", ("update_pos error = %d", error)); |
1952 |
DBUG_PRINT("info", ("group %s %s", |
|
1953 |
llstr(rli->group_relay_log_pos, buf), |
|
1954 |
rli->group_relay_log_name)); |
|
1955 |
DBUG_PRINT("info", ("event %s %s", |
|
1956 |
llstr(rli->event_relay_log_pos, buf), |
|
1957 |
rli->event_relay_log_name)); |
|
1958 |
}
|
|
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
1959 |
/*
|
1960 |
The update should not fail, so print an error message and
|
|
1961 |
return an error code.
|
|
1962 |
||
1963 |
TODO: Replace this with a decent error message when merged
|
|
1964 |
with BUG#24954 (which adds several new error message).
|
|
1965 |
*/
|
|
1966 |
if (error) |
|
1967 |
{
|
|
|
2512.1.31
by alik at quad
Patch to eliminate some valgrind warnings in debug printout code. |
1968 |
char buf[22]; |
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
1969 |
rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR, |
1970 |
"It was not possible to update the positions"
|
|
1971 |
" of the relay log information: the slave may"
|
|
1972 |
" be in an inconsistent state."
|
|
1973 |
" Stopped in %s position %s", |
|
1974 |
rli->group_relay_log_name, |
|
1975 |
llstr(rli->group_relay_log_pos, buf)); |
|
1976 |
DBUG_RETURN(2); |
|
1977 |
}
|
|
1978 |
}
|
|
1979 |
||
1980 |
DBUG_RETURN(exec_res ? 1 : 0); |
|
1981 |
}
|
|
1982 |
||
1983 |
||
1984 |
/**
|
|
1985 |
Top-level function for executing the next event from the relay log.
|
|
1986 |
||
1987 |
This function reads the event from the relay log, executes it, and
|
|
1988 |
advances the relay log position. It also handles errors, etc.
|
|
1989 |
||
1990 |
This function may fail to apply the event for the following reasons:
|
|
1991 |
||
1992 |
- The position specfied by the UNTIL condition of the START SLAVE
|
|
1993 |
command is reached.
|
|
1994 |
||
1995 |
- It was not possible to read the event from the log.
|
|
1996 |
||
1997 |
- The slave is killed.
|
|
1998 |
||
1999 |
- An error occurred when applying the event, and the event has been
|
|
2000 |
tried slave_trans_retries times. If the event has been retried
|
|
2001 |
fewer times, 0 is returned.
|
|
2002 |
||
2003 |
- init_master_info or init_relay_log_pos failed. (These are called
|
|
2004 |
if a failure occurs when applying the event.)</li>
|
|
2005 |
||
2006 |
- An error occurred when updating the binlog position.
|
|
2007 |
||
2008 |
@retval 0 The event was applied.
|
|
2009 |
||
2010 |
@retval 1 The event was not applied.
|
|
2011 |
*/
|
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
2012 |
static int exec_relay_log_event(THD* thd, Relay_log_info* rli) |
|
2
by bk at mysql
Import changeset |
2013 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
2014 |
DBUG_ENTER("exec_relay_log_event"); |
2015 |
||
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
2016 |
/*
|
2017 |
We acquire this mutex since we need it for all operations except
|
|
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2018 |
event execution. But we will release it in places where we will
|
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
2019 |
wait for something for example inside of next_event().
|
2020 |
*/
|
|
2021 |
pthread_mutex_lock(&rli->data_lock); |
|
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2022 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2023 |
Log_event * ev = next_event(rli); |
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2024 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2025 |
DBUG_ASSERT(rli->sql_thd==thd); |
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2026 |
|
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
2027 |
if (sql_slave_killed(thd,rli)) |
|
1346.220.2
by guilhem at mysql
- Fix for memory leak if the SQL slave thread is killed just after reading an event. |
2028 |
{
|
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
2029 |
pthread_mutex_unlock(&rli->data_lock); |
|
1346.254.6
by monty at mysql
Code/testcase cleanups |
2030 |
delete ev; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
2031 |
DBUG_RETURN(1); |
|
1346.220.2
by guilhem at mysql
- Fix for memory leak if the SQL slave thread is killed just after reading an event. |
2032 |
}
|
|
135.2.1
by monty at mysql
Fixed indention, removed compiler varnings and fixed a bug |
2033 |
if (ev) |
2034 |
{
|
|
|
721
by sasha at sashanet
LOAD DATA INFILE is now replicated properly, except for cleanup on |
2035 |
int exec_res; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2036 |
|
2037 |
/*
|
|
|
1810.3662.1
by svoj at mysql
BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if |
2038 |
This tests if the position of the beginning of the current event
|
2039 |
hits the UNTIL barrier.
|
|
2040 |
*/
|
|
|
2512.49.19
by svoj at mysql
BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if |
2041 |
if (rli->until_condition != Relay_log_info::UNTIL_NONE && |
|
2512.49.18
by svoj at mysql
Merge mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.0-engines |
2042 |
rli->is_until_satisfied((rli->is_in_group() || !ev->log_pos) ? |
|
1810.3662.1
by svoj at mysql
BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if |
2043 |
rli->group_master_log_pos : |
2044 |
ev->log_pos - ev->data_written)) |
|
2045 |
{
|
|
2046 |
char buf[22]; |
|
2047 |
sql_print_information("Slave SQL thread stopped because it reached its" |
|
2048 |
" UNTIL position %s", llstr(rli->until_pos(), buf)); |
|
2049 |
/*
|
|
2050 |
Setting abort_slave flag because we do not want additional message about
|
|
2051 |
error in query execution to be printed.
|
|
2052 |
*/
|
|
2053 |
rli->abort_slave= 1; |
|
2054 |
pthread_mutex_unlock(&rli->data_lock); |
|
2055 |
delete ev; |
|
|
2512.49.18
by svoj at mysql
Merge mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.0-engines |
2056 |
DBUG_RETURN(1); |
2057 |
}
|
|
2058 |
exec_res= apply_event_and_update_pos(ev, thd, rli, TRUE); |
|
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
2059 |
|
2060 |
/*
|
|
2061 |
Format_description_log_event should not be deleted because it will be
|
|
2062 |
used to read info about the relay log's format; it will be deleted when
|
|
2063 |
the SQL thread does not need it, i.e. when this thread terminates.
|
|
2064 |
*/
|
|
2065 |
if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT) |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2066 |
{
|
2067 |
DBUG_PRINT("info", ("Deleting the event after it has been executed")); |
|
2068 |
delete ev; |
|
2069 |
}
|
|
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
2070 |
|
2071 |
/*
|
|
2072 |
update_log_pos failed: this should not happen, so we don't
|
|
2073 |
retry.
|
|
2074 |
*/
|
|
2075 |
if (exec_res == 2) |
|
2076 |
DBUG_RETURN(1); |
|
2077 |
||
|
1616.1707.1
by guilhem at mysql
Fix for BUG#8325 "Deadlock in replication thread stops replication": |
2078 |
if (slave_trans_retries) |
2079 |
{
|
|
|
2476.597.15
by mats at dnsalias
BUG#24860 (Incorrect SLAVE_TRANSACTION_RETRIES code can result in slave stuck): |
2080 |
int temp_err; |
2081 |
if (exec_res && (temp_err= has_temporary_error(thd))) |
|
|
1616.1707.1
by guilhem at mysql
Fix for BUG#8325 "Deadlock in replication thread stops replication": |
2082 |
{
|
2083 |
const char *errmsg; |
|
2084 |
/*
|
|
2085 |
We were in a transaction which has been rolled back because of a
|
|
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2086 |
temporary error;
|
2087 |
let's seek back to BEGIN log event and retry it all again.
|
|
|
2303.68.2
by elkin at inet
Merge dsl-hkigw8-feaef900-46.dhcp.inet.fi:/home/elkin/MySQL/TEAM/BARE/5.0-merge |
2088 |
Note, if lock wait timeout (innodb_lock_wait_timeout exceeded)
|
|
1810.2294.1
by elkin at inet
BUG#20697 slave fails to rollback replicated transaction hang over innodb_lock_wait_timeou |
2089 |
there is no rollback since 5.0.13 (ref: manual).
|
|
1616.1707.1
by guilhem at mysql
Fix for BUG#8325 "Deadlock in replication thread stops replication": |
2090 |
We have to not only seek but also
|
2091 |
a) init_master_info(), to seek back to hot relay log's start for later
|
|
2092 |
(for when we will come back to this hot log after re-processing the
|
|
2093 |
possibly existing old logs where BEGIN is: check_binlog_magic() will
|
|
2094 |
then need the cache to be at position 0 (see comments at beginning of
|
|
2095 |
init_master_info()).
|
|
2096 |
b) init_relay_log_pos(), because the BEGIN may be an older relay log.
|
|
2097 |
*/
|
|
|
1616.1759.1
by gbichot at mysql
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication": |
2098 |
if (rli->trans_retries < slave_trans_retries) |
|
1616.1707.1
by guilhem at mysql
Fix for BUG#8325 "Deadlock in replication thread stops replication": |
2099 |
{
|
2100 |
if (init_master_info(rli->mi, 0, 0, 0, SLAVE_SQL)) |
|
2101 |
sql_print_error("Failed to initialize the master info structure"); |
|
2102 |
else if (init_relay_log_pos(rli, |
|
2103 |
rli->group_relay_log_name, |
|
2104 |
rli->group_relay_log_pos, |
|
|
1764.10.8
by guilhem at mysql
First part of fix for BUG#7998 "Replication should be more clever about when to replicate RELEASE_LOCK()" |
2105 |
1, &errmsg, 1)) |
|
1616.1707.1
by guilhem at mysql
Fix for BUG#8325 "Deadlock in replication thread stops replication": |
2106 |
sql_print_error("Error initializing relay log position: %s", |
2107 |
errmsg); |
|
2108 |
else
|
|
2109 |
{
|
|
2110 |
exec_res= 0; |
|
|
2119.130.1
by mats at mysql
Bug#16228 (RBR: Slave SQL thread retries infinitely): |
2111 |
end_trans(thd, ROLLBACK); |
|
2181.142.1
by grog at lemis
slave.cc: |
2112 |
/* chance for concurrent connection to get more locks */
|
|
1616.1759.1
by gbichot at mysql
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication": |
2113 |
safe_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE), |
|
2181.142.1
by grog at lemis
slave.cc: |
2114 |
(CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli); |
|
1616.1759.1
by gbichot at mysql
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication": |
2115 |
pthread_mutex_lock(&rli->data_lock); // because of SHOW STATUS |
|
2181.142.1
by grog at lemis
slave.cc: |
2116 |
rli->trans_retries++; |
|
1616.1759.1
by gbichot at mysql
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication": |
2117 |
rli->retried_trans++; |
2118 |
pthread_mutex_unlock(&rli->data_lock); |
|
2119 |
DBUG_PRINT("info", ("Slave retries transaction " |
|
2120 |
"rli->trans_retries: %lu", rli->trans_retries)); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2121 |
}
|
|
1616.1707.1
by guilhem at mysql
Fix for BUG#8325 "Deadlock in replication thread stops replication": |
2122 |
}
|
2123 |
else
|
|
2124 |
sql_print_error("Slave SQL thread retried transaction %lu time(s) " |
|
2125 |
"in vain, giving up. Consider raising the value of "
|
|
2126 |
"the slave_transaction_retries variable.", |
|
2127 |
slave_trans_retries); |
|
2128 |
}
|
|
|
2476.597.15
by mats at dnsalias
BUG#24860 (Incorrect SLAVE_TRANSACTION_RETRIES code can result in slave stuck): |
2129 |
else if (exec_res && !temp_err || |
2130 |
(opt_using_transactions && |
|
2131 |
rli->group_relay_log_pos == rli->event_relay_log_pos)) |
|
|
1810.2294.1
by elkin at inet
BUG#20697 slave fails to rollback replicated transaction hang over innodb_lock_wait_timeou |
2132 |
{
|
2133 |
/*
|
|
|
2476.597.15
by mats at dnsalias
BUG#24860 (Incorrect SLAVE_TRANSACTION_RETRIES code can result in slave stuck): |
2134 |
Only reset the retry counter if the entire group succeeded
|
2135 |
or failed with a non-transient error. On a successful
|
|
2136 |
event, the execution will proceed as usual; in the case of a
|
|
|
1810.2294.1
by elkin at inet
BUG#20697 slave fails to rollback replicated transaction hang over innodb_lock_wait_timeou |
2137 |
non-transient error, the slave will stop with an error.
|
|
2119.130.1
by mats at mysql
Bug#16228 (RBR: Slave SQL thread retries infinitely): |
2138 |
*/
|
|
1810.2294.1
by elkin at inet
BUG#20697 slave fails to rollback replicated transaction hang over innodb_lock_wait_timeou |
2139 |
rli->trans_retries= 0; // restart from fresh |
|
2476.604.3
by elkin at inet
Manual merge 5.0-rpl -> 5.1-rpl. |
2140 |
DBUG_PRINT("info", ("Resetting retry counter, rli->trans_retries: %lu", |
|
2476.597.15
by mats at dnsalias
BUG#24860 (Incorrect SLAVE_TRANSACTION_RETRIES code can result in slave stuck): |
2141 |
rli->trans_retries)); |
|
1810.2294.1
by elkin at inet
BUG#20697 slave fails to rollback replicated transaction hang over innodb_lock_wait_timeou |
2142 |
}
|
2143 |
}
|
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
2144 |
DBUG_RETURN(exec_res); |
|
135.2.1
by monty at mysql
Fixed indention, removed compiler varnings and fixed a bug |
2145 |
}
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
2146 |
pthread_mutex_unlock(&rli->data_lock); |
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2147 |
rli->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_READ_FAILURE, |
2148 |
ER(ER_SLAVE_RELAY_LOG_READ_FAILURE), "\ |
|
|
1346.228.1
by guilhem at mysql
Clearer error message (in the customer's case, the relay log was corrupted, |
2149 |
Could not parse relay log event entry. The possible reasons are: the master's \
|
2150 |
binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
|
|
2151 |
binary log), the slave's relay log is corrupted (you can check this by running \
|
|
2152 |
'mysqlbinlog' on the relay log), a network problem, or a bug in the master's \
|
|
2153 |
or slave's MySQL code. If you want to check the master's binary log or slave's \
|
|
2154 |
relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' \
|
|
2155 |
on this slave.\
|
|
|
558
by jcole at spaceapes
Cleanups... |
2156 |
"); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
2157 |
DBUG_RETURN(1); |
|
2
by bk at mysql
Import changeset |
2158 |
}
|
|
973.2.1
by monty at mysql
Update copyright |
2159 |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2160 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
2161 |
static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info) |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2162 |
{
|
2163 |
if (io_slave_killed(thd, mi)) |
|
2164 |
{
|
|
|
2476.488.6
by kaa at polly
Fix for bug #29976: Excessive Slave I/O errors in replication tests |
2165 |
if (info && global_system_variables.log_warnings) |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2166 |
sql_print_information(info); |
2167 |
return TRUE; |
|
2168 |
}
|
|
2169 |
return FALSE; |
|
2170 |
}
|
|
2171 |
||
2172 |
||
2173 |
/**
|
|
2174 |
@brief Try to reconnect slave IO thread.
|
|
2175 |
||
2176 |
@details Terminates current connection to master, sleeps for
|
|
2177 |
@c mi->connect_retry msecs and initiates new connection with
|
|
2178 |
@c safe_reconnect(). Variable pointed by @c retry_count is increased -
|
|
2179 |
if it exceeds @c master_retry_count then connection is not re-established
|
|
2180 |
and function signals error.
|
|
2181 |
Unless @c suppres_warnings is TRUE, a warning is put in the server error log
|
|
2182 |
when reconnecting. The warning message and messages used to report errors
|
|
2183 |
are taken from @c messages array. In case @c master_retry_count is exceeded,
|
|
2184 |
no messages are added to the log.
|
|
2185 |
||
2186 |
@param[in] thd Thread context.
|
|
2187 |
@param[in] mysql MySQL connection.
|
|
2188 |
@param[in] mi Master connection information.
|
|
2189 |
@param[in,out] retry_count Number of attempts to reconnect.
|
|
2190 |
@param[in] suppress_warnings TRUE when a normal net read timeout
|
|
2191 |
has caused to reconnecting.
|
|
2192 |
@param[in] messages Messages to print/log, see
|
|
2193 |
reconnect_messages[] array.
|
|
2194 |
||
2195 |
@retval 0 OK.
|
|
2196 |
@retval 1 There was an error.
|
|
2197 |
*/
|
|
2198 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
2199 |
static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2200 |
uint *retry_count, bool suppress_warnings, |
2201 |
const char *messages[SLAVE_RECON_MSG_MAX]) |
|
2202 |
{
|
|
2203 |
mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT; |
|
2204 |
thd->proc_info= messages[SLAVE_RECON_MSG_WAIT]; |
|
2205 |
#ifdef SIGNAL_WITH_VIO_CLOSE
|
|
2206 |
thd->clear_active_vio(); |
|
2207 |
#endif
|
|
2208 |
end_server(mysql); |
|
2209 |
if ((*retry_count)++) |
|
2210 |
{
|
|
2211 |
if (*retry_count > master_retry_count) |
|
2212 |
return 1; // Don't retry forever |
|
2213 |
safe_sleep(thd, mi->connect_retry, (CHECK_KILLED_FUNC) io_slave_killed, |
|
2214 |
(void *) mi); |
|
2215 |
}
|
|
2216 |
if (check_io_slave_killed(thd, mi, messages[SLAVE_RECON_MSG_KILLED_WAITING])) |
|
2217 |
return 1; |
|
2218 |
thd->proc_info = messages[SLAVE_RECON_MSG_AFTER]; |
|
2219 |
if (!suppress_warnings) |
|
2220 |
{
|
|
2221 |
char buf[256], llbuff[22]; |
|
2222 |
my_snprintf(buf, sizeof(buf), messages[SLAVE_RECON_MSG_FAILED], |
|
2223 |
IO_RPL_LOG_NAME, llstr(mi->master_log_pos, llbuff)); |
|
2224 |
/*
|
|
2225 |
Raise a warining during registering on master/requesting dump.
|
|
2226 |
Log a message reading event.
|
|
2227 |
*/
|
|
2228 |
if (messages[SLAVE_RECON_MSG_COMMAND][0]) |
|
2229 |
{
|
|
2230 |
mi->report(WARNING_LEVEL, ER_SLAVE_MASTER_COM_FAILURE, |
|
2231 |
ER(ER_SLAVE_MASTER_COM_FAILURE), |
|
2232 |
messages[SLAVE_RECON_MSG_COMMAND], buf); |
|
2233 |
}
|
|
2234 |
else
|
|
2235 |
{
|
|
2236 |
sql_print_information(buf); |
|
2237 |
}
|
|
2238 |
}
|
|
2239 |
if (safe_reconnect(thd, mysql, mi, 1) || io_slave_killed(thd, mi)) |
|
2240 |
{
|
|
2241 |
if (global_system_variables.log_warnings) |
|
2242 |
sql_print_information(messages[SLAVE_RECON_MSG_KILLED_AFTER]); |
|
2243 |
return 1; |
|
2244 |
}
|
|
2245 |
return 0; |
|
2246 |
}
|
|
2247 |
||
2248 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
2249 |
/* Slave I/O Thread entry point */
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
2250 |
|
|
1810.845.1
by serg at serg
pthread_handler_decl() changed to be ctags-friendly |
2251 |
pthread_handler_t handle_slave_io(void *arg) |
|
2
by bk at mysql
Import changeset |
2252 |
{
|
|
301.1.1
by sasha at sashanet
added loops and other cool stuff to mysqltest |
2253 |
THD *thd; // needs to be first for thread_stack |
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2254 |
MYSQL *mysql; |
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
2255 |
Master_info *mi = (Master_info*)arg; |
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
2256 |
Relay_log_info *rli= &mi->rli; |
|
587.4.2
by monty at mysql
Fixed test cases for innobase |
2257 |
char llbuff[22]; |
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2258 |
uint retry_count; |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2259 |
bool suppress_warnings; |
2260 |
#ifndef DBUG_OFF
|
|
2261 |
uint retry_count_reg= 0, retry_count_dump= 0, retry_count_event= 0; |
|
2262 |
#endif
|
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2263 |
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
|
2264 |
my_thread_init(); |
|
|
1346.137.2
by monty at mysql
Fix that round(0.1,1) == round(0.1,1) |
2265 |
DBUG_ENTER("handle_slave_io"); |
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2266 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2267 |
DBUG_ASSERT(mi->inited); |
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2268 |
mysql= NULL ; |
2269 |
retry_count= 0; |
|
2270 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2271 |
pthread_mutex_lock(&mi->run_lock); |
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2272 |
/* Inform waiting threads that slave has started */
|
2273 |
mi->slave_run_id++; |
|
2274 |
||
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2275 |
#ifndef DBUG_OFF
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
2276 |
mi->events_till_disconnect = disconnect_slave_event_count; |
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2277 |
#endif
|
2278 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2279 |
thd= new THD; // note that contructor of THD uses DBUG_ ! |
|
973.117.2
by sasha at sashanet
replication updates. This changeset seems to be working fine on test systems. |
2280 |
THD_CHECK_SENTRY(thd); |
|
1810.3624.1
by andrei at inet
Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails |
2281 |
mi->io_thd = thd; |
|
2
by bk at mysql
Import changeset |
2282 |
|
2283 |
pthread_detach_this_thread(); |
|
|
1810.1086.1
by konstantin at mysql
Always initialize THD::thread_stack: it's used in |
2284 |
thd->thread_stack= (char*) &thd; // remember where our stack is |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2285 |
if (init_slave_thread(thd, SLAVE_THD_IO)) |
|
973.26.26
by monty at mysql
New error messages |
2286 |
{
|
2287 |
pthread_cond_broadcast(&mi->start_cond); |
|
2288 |
pthread_mutex_unlock(&mi->run_lock); |
|
2289 |
sql_print_error("Failed during slave I/O thread initialization"); |
|
2290 |
goto err; |
|
2291 |
}
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2292 |
pthread_mutex_lock(&LOCK_thread_count); |
|
2
by bk at mysql
Import changeset |
2293 |
threads.append(thd); |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2294 |
pthread_mutex_unlock(&LOCK_thread_count); |
|
1616.2139.3
by sasha at asksasha
updates for BUG#10780 - fixed slave I/O thread running status to No while attempting |
2295 |
mi->slave_running = 1; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2296 |
mi->abort_slave = 0; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2297 |
pthread_mutex_unlock(&mi->run_lock); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2298 |
pthread_cond_broadcast(&mi->start_cond); |
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2299 |
|
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
2300 |
DBUG_PRINT("master_info",("log_file_name: '%s' position: %s", |
|
2181.142.1
by grog at lemis
slave.cc: |
2301 |
mi->master_log_name, |
2302 |
llstr(mi->master_log_pos,llbuff))); |
|
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2303 |
|
|
1524.14.1
by hf at r18
SCRUM |
2304 |
if (!(mi->mysql = mysql = mysql_init(NULL))) |
|
507
by monty at mysql
keep bk happy |
2305 |
{
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2306 |
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, |
2307 |
ER(ER_SLAVE_FATAL_ERROR), "error in mysql_init()"); |
|
|
507
by monty at mysql
keep bk happy |
2308 |
goto err; |
2309 |
}
|
|
|
1616.2846.1
by elkin at inet
BUG#19402 SQL close to the size of the max_allowed_packet fails on the slave |
2310 |
|
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2311 |
thd_proc_info(thd, "Connecting to master"); |
|
301.1.1
by sasha at sashanet
added loops and other cool stuff to mysqltest |
2312 |
// we can get killed during safe_connect
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2313 |
if (!safe_connect(thd, mysql, mi)) |
|
1616.2846.1
by elkin at inet
BUG#19402 SQL close to the size of the max_allowed_packet fails on the slave |
2314 |
{
|
|
2303.85.3
by monty at mysql
Fixed a LOT of compiler warnings |
2315 |
sql_print_information("Slave I/O thread: connected to master '%s@%s:%d'," |
2316 |
"replication started in log '%s' at position %s", |
|
2317 |
mi->user, mi->host, mi->port, |
|
|
1616.2846.1
by elkin at inet
BUG#19402 SQL close to the size of the max_allowed_packet fails on the slave |
2318 |
IO_RPL_LOG_NAME, |
2319 |
llstr(mi->master_log_pos,llbuff)); |
|
|
1616.2845.6
by elkin at inet
bug#19402 SQL close to the size of the max_allowed_packet fails on the slave |
2320 |
/*
|
2321 |
Adding MAX_LOG_EVENT_HEADER_LEN to the max_packet_size on the I/O
|
|
2322 |
thread, since a replication event can become this much larger than
|
|
2323 |
the corresponding packet (query) sent from client to master.
|
|
2324 |
*/
|
|
|
1616.2846.1
by elkin at inet
BUG#19402 SQL close to the size of the max_allowed_packet fails on the slave |
2325 |
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER; |
2326 |
}
|
|
|
301.1.1
by sasha at sashanet
added loops and other cool stuff to mysqltest |
2327 |
else
|
|
587.4.2
by monty at mysql
Fixed test cases for innobase |
2328 |
{
|
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
2329 |
sql_print_information("Slave I/O thread killed while connecting to master"); |
|
587.4.2
by monty at mysql
Fixed test cases for innobase |
2330 |
goto err; |
2331 |
}
|
|
|
689.3.1
by sasha at sashanet
A slave now can optionally register with the master providing the |
2332 |
|
|
676.69.1
by sasha at sashanet
fixed message in post-commit trigger |
2333 |
connected:
|
|
676.177.112
by Sinisa at nasamreza
Another try to fix slave timeouts |
2334 |
|
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
2335 |
// TODO: the assignment below should be under mutex (5.0)
|
2336 |
mi->slave_running= MYSQL_SLAVE_RUN_CONNECT; |
|
|
721
by sasha at sashanet
LOAD DATA INFILE is now replicated properly, except for cleanup on |
2337 |
thd->slave_net = &mysql->net; |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2338 |
thd_proc_info(thd, "Checking master version"); |
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
2339 |
if (get_master_version_and_clock(mysql, mi)) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2340 |
goto err; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2341 |
|
2342 |
if (mi->rli.relay_log.description_event_for_queue->binlog_version > 1) |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2343 |
{
|
|
973.26.26
by monty at mysql
New error messages |
2344 |
/*
|
2345 |
Register ourselves with the master.
|
|
2346 |
*/
|
|
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2347 |
thd_proc_info(thd, "Registering slave on master"); |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2348 |
if (register_slave_on_master(mysql, mi, &suppress_warnings)) |
|
2476.109.2
by rafal at quant
BUG#21123 (Slave fails to reconnect on update_slave_list): |
2349 |
{
|
|
2476.488.6
by kaa at polly
Fix for bug #29976: Excessive Slave I/O errors in replication tests |
2350 |
if (!check_io_slave_killed(thd, mi, "Slave I/O thread killed " |
2351 |
"while registering slave on master")) |
|
2352 |
{
|
|
2353 |
sql_print_error("Slave I/O thread couldn't register on master"); |
|
2354 |
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings, |
|
2355 |
reconnect_messages[SLAVE_RECON_ACT_REG])) |
|
2356 |
goto err; |
|
2357 |
}
|
|
2358 |
else
|
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2359 |
goto err; |
2360 |
goto connected; |
|
|
2476.109.2
by rafal at quant
BUG#21123 (Slave fails to reconnect on update_slave_list): |
2361 |
}
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2362 |
DBUG_EXECUTE_IF("FORCE_SLAVE_TO_RECONNECT_REG", |
2363 |
if (!retry_count_reg) |
|
2364 |
{
|
|
2365 |
retry_count_reg++; |
|
2366 |
sql_print_information("Forcing to reconnect slave I/O thread"); |
|
2367 |
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings, |
|
2368 |
reconnect_messages[SLAVE_RECON_ACT_REG])) |
|
2369 |
goto err; |
|
2370 |
goto connected; |
|
2371 |
});
|
|
|
906.1.1
by sasha at sashanet
work to enable reading 3.23 logs - not yet finished |
2372 |
}
|
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2373 |
|
|
1214.2.1
by monty at mysql
Use our version of RWLOCKS on UNIXWARE 7 |
2374 |
DBUG_PRINT("info",("Starting reading binary log from master")); |
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
2375 |
while (!io_slave_killed(thd,mi)) |
|
507
by monty at mysql
keep bk happy |
2376 |
{
|
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2377 |
thd_proc_info(thd, "Requesting binlog dump"); |
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
2378 |
if (request_dump(mysql, mi, &suppress_warnings)) |
|
973.26.26
by monty at mysql
New error messages |
2379 |
{
|
2380 |
sql_print_error("Failed on request_dump()"); |
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2381 |
if (check_io_slave_killed(thd, mi, "Slave I/O thread killed while \ |
2382 |
requesting master dump") || |
|
2383 |
try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings, |
|
2384 |
reconnect_messages[SLAVE_RECON_ACT_DUMP])) |
|
2385 |
goto err; |
|
|
973.26.26
by monty at mysql
New error messages |
2386 |
goto connected; |
2387 |
}
|
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2388 |
DBUG_EXECUTE_IF("FORCE_SLAVE_TO_RECONNECT_DUMP", |
2389 |
if (!retry_count_dump) |
|
2390 |
{
|
|
2391 |
retry_count_dump++; |
|
2392 |
sql_print_information("Forcing to reconnect slave I/O thread"); |
|
2393 |
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings, |
|
2394 |
reconnect_messages[SLAVE_RECON_ACT_DUMP])) |
|
2395 |
goto err; |
|
2396 |
goto connected; |
|
2397 |
});
|
|
|
973.26.26
by monty at mysql
New error messages |
2398 |
|
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
2399 |
while (!io_slave_killed(thd,mi)) |
|
973.26.26
by monty at mysql
New error messages |
2400 |
{
|
|
1810.2323.19
by monty at mysql
Fixed compiler warnings detected by option -Wshadow and -Wunused: |
2401 |
ulong event_len; |
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2402 |
/*
|
|
1346.331.1
by guilhem at mysql
Clearer states in SHOW PROCESSLIST for replication threads. |
2403 |
We say "waiting" because read_event() will wait if there's nothing to
|
|
1659.83.7
by serg at serg
auto-ROLLBACK if binlog was not closed properly |
2404 |
read. But if there's something to read, it will not wait. The
|
2405 |
important thing is to not confuse users by saying "reading" whereas
|
|
2406 |
we're in fact receiving nothing.
|
|
|
1346.331.1
by guilhem at mysql
Clearer states in SHOW PROCESSLIST for replication threads. |
2407 |
*/
|
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2408 |
thd_proc_info(thd, "Waiting for master to send event"); |
|
1810.2323.19
by monty at mysql
Fixed compiler warnings detected by option -Wshadow and -Wunused: |
2409 |
event_len= read_event(mysql, mi, &suppress_warnings); |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2410 |
if (check_io_slave_killed(thd, mi, "Slave I/O thread killed while \ |
2411 |
reading event")) |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2412 |
goto err; |
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2413 |
DBUG_EXECUTE_IF("FORCE_SLAVE_TO_RECONNECT_EVENT", |
2414 |
if (!retry_count_event) |
|
2415 |
{
|
|
2416 |
retry_count_event++; |
|
2417 |
sql_print_information("Forcing to reconnect slave I/O thread"); |
|
2418 |
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings, |
|
2419 |
reconnect_messages[SLAVE_RECON_ACT_EVENT])) |
|
2420 |
goto err; |
|
2421 |
goto connected; |
|
2422 |
});
|
|
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2423 |
|
|
973.26.26
by monty at mysql
New error messages |
2424 |
if (event_len == packet_error) |
2425 |
{
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
2426 |
uint mysql_error_number= mysql_errno(mysql); |
|
1810.3174.1
by kaa at polly
Fix for bug #24192 "MySQL replication does not exit server when running out of memory" |
2427 |
switch (mysql_error_number) { |
2428 |
case CR_NET_PACKET_TOO_LARGE: |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2429 |
sql_print_error("\ |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2430 |
Log entry on master is longer than max_allowed_packet (%ld) on \
|
2431 |
slave. If the entry is correct, restart the server with a higher value of \
|
|
2432 |
max_allowed_packet", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2433 |
thd->variables.max_allowed_packet); |
2434 |
goto err; |
|
|
1810.3174.1
by kaa at polly
Fix for bug #24192 "MySQL replication does not exit server when running out of memory" |
2435 |
case ER_MASTER_FATAL_ERROR_READING_BINLOG: |
|
2181.142.1
by grog at lemis
slave.cc: |
2436 |
sql_print_error(ER(mysql_error_number), mysql_error_number, |
2437 |
mysql_error(mysql)); |
|
2438 |
goto err; |
|
|
1810.3174.1
by kaa at polly
Fix for bug #24192 "MySQL replication does not exit server when running out of memory" |
2439 |
case EE_OUTOFMEMORY: |
2440 |
case ER_OUTOFMEMORY: |
|
2441 |
sql_print_error("\ |
|
2442 |
Stopping slave I/O thread due to out-of-memory error from master"); |
|
2443 |
goto err; |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2444 |
}
|
|
2476.164.1
by ram at mysql
Fix for bug #19328: Slave timeout with COM_REGISTER_SLAVE error causing stop |
2445 |
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings, |
2446 |
reconnect_messages[SLAVE_RECON_ACT_EVENT])) |
|
2447 |
goto err; |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2448 |
goto connected; |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
2449 |
} // if (event_len == packet_error) |
|
1700.210.14
by serg at serg
post-review fixes. Now ROLLBACK is done in Format_description_log_event |
2450 |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2451 |
retry_count=0; // ok event, reset retry counter |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2452 |
thd_proc_info(thd, "Queueing master event to the relay log"); |
|
973.26.26
by monty at mysql
New error messages |
2453 |
if (queue_event(mi,(const char*)mysql->net.read_pos + 1, |
|
2181.142.1
by grog at lemis
slave.cc: |
2454 |
event_len)) |
|
973.26.26
by monty at mysql
New error messages |
2455 |
{
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2456 |
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, |
2457 |
ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE), |
|
2458 |
"could not queue event from master"); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2459 |
goto err; |
|
973.26.26
by monty at mysql
New error messages |
2460 |
}
|
|
1810.1182.16
by serg at serg
many warnings (practically safe but annoying) corrected |
2461 |
if (flush_master_info(mi, 1)) |
2462 |
{
|
|
2463 |
sql_print_error("Failed to flush master info file"); |
|
2464 |
goto err; |
|
2465 |
}
|
|
|
1346.220.2
by guilhem at mysql
- Fix for memory leak if the SQL slave thread is killed just after reading an event. |
2466 |
/*
|
2467 |
See if the relay logs take too much space.
|
|
2468 |
We don't lock mi->rli.log_space_lock here; this dirty read saves time
|
|
2469 |
and does not introduce any problem:
|
|
2470 |
- if mi->rli.ignore_log_space_limit is 1 but becomes 0 just after (so
|
|
2471 |
the clean value is 0), then we are reading only one more event as we
|
|
2472 |
should, and we'll block only at the next event. No big deal.
|
|
2473 |
- if mi->rli.ignore_log_space_limit is 0 but becomes 1 just after (so
|
|
2474 |
the clean value is 1), then we are going into wait_for_relay_log_space()
|
|
2475 |
for no reason, but this function will do a clean read, notice the clean
|
|
2476 |
value and exit immediately.
|
|
2477 |
*/
|
|
|
1346.239.1
by guilhem at mysql
Fix for nightly build test failure (test update). |
2478 |
#ifndef DBUG_OFF
|
2479 |
{
|
|
2480 |
char llbuf1[22], llbuf2[22]; |
|
2481 |
DBUG_PRINT("info", ("log_space_limit=%s log_space_total=%s \ |
|
2482 |
ignore_log_space_limit=%d", |
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
2483 |
llstr(rli->log_space_limit,llbuf1), |
2484 |
llstr(rli->log_space_total,llbuf2), |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2485 |
(int) rli->ignore_log_space_limit)); |
|
1346.239.1
by guilhem at mysql
Fix for nightly build test failure (test update). |
2486 |
}
|
2487 |
#endif
|
|
2488 |
||
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
2489 |
if (rli->log_space_limit && rli->log_space_limit < |
|
2181.142.1
by grog at lemis
slave.cc: |
2490 |
rli->log_space_total && |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
2491 |
!rli->ignore_log_space_limit) |
|
2181.142.1
by grog at lemis
slave.cc: |
2492 |
if (wait_for_relay_log_space(rli)) |
2493 |
{
|
|
2494 |
sql_print_error("Slave I/O thread aborted while waiting for relay \ |
|
|
973.120.1
by sasha at sashanet
relay_log_space_limit |
2495 |
log space"); |
|
2181.142.1
by grog at lemis
slave.cc: |
2496 |
goto err; |
2497 |
}
|
|
2498 |
}
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2499 |
}
|
|
2
by bk at mysql
Import changeset |
2500 |
|
|
676.15.1
by monty at mysql
Portability fixes |
2501 |
// error = 0;
|
|
973.26.26
by monty at mysql
New error messages |
2502 |
err:
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2503 |
// print the current replication position
|
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
2504 |
sql_print_information("Slave I/O thread exiting, read up to log '%s', position %s", |
|
2181.142.1
by grog at lemis
slave.cc: |
2505 |
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff)); |
|
1346.7.178
by monty at mysql
Merge with 3.23 to get bug fix for SHOW PROCESSLIST + running thread |
2506 |
VOID(pthread_mutex_lock(&LOCK_thread_count)); |
|
2
by bk at mysql
Import changeset |
2507 |
thd->query = thd->db = 0; // extra safety |
|
1346.721.1
by guilhem at mysql
when we update thd->db in replication, it's safer to update thd->db_length too. |
2508 |
thd->query_length= thd->db_length= 0; |
|
1346.7.178
by monty at mysql
Merge with 3.23 to get bug fix for SHOW PROCESSLIST + running thread |
2509 |
VOID(pthread_mutex_unlock(&LOCK_thread_count)); |
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
2510 |
if (mysql) |
2511 |
{
|
|
|
1810.1794.1
by mats at mysql
Bug#19437 (Connection refused by server: "2002 Can't connect... /master.sock"): |
2512 |
/*
|
2513 |
Here we need to clear the active VIO before closing the
|
|
2514 |
connection with the master. The reason is that THD::awake()
|
|
2515 |
might be called from terminate_slave_thread() because somebody
|
|
2516 |
issued a STOP SLAVE. If that happends, the close_active_vio()
|
|
2517 |
can be called in the middle of closing the VIO associated with
|
|
2518 |
the 'mysql' object, causing a crash.
|
|
2519 |
*/
|
|
2520 |
#ifdef SIGNAL_WITH_VIO_CLOSE
|
|
2521 |
thd->clear_active_vio(); |
|
2522 |
#endif
|
|
|
1524.14.1
by hf at r18
SCRUM |
2523 |
mysql_close(mysql); |
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
2524 |
mi->mysql=0; |
2525 |
}
|
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
2526 |
write_ignored_events_info_to_relay_log(thd, mi); |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2527 |
thd_proc_info(thd, "Waiting for slave mutex on exit"); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2528 |
pthread_mutex_lock(&mi->run_lock); |
|
1810.890.1
by SergeyV at selena
Fixes bug #13377. Added code to close active log files in case |
2529 |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2530 |
/* Forget the relay log's format */
|
2531 |
delete mi->rli.relay_log.description_event_for_queue; |
|
2532 |
mi->rli.relay_log.description_event_for_queue= 0; |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
2533 |
// TODO: make rpl_status part of Master_info
|
|
818.22.1
by sasha at sashanet
fixes for mysql-test to run without manager |
2534 |
change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2535 |
DBUG_ASSERT(thd->net.buff != 0); |
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
2536 |
net_end(&thd->net); // destructor will not free it, because net.vio is 0 |
|
2476.528.1
by davi at endora
Bug#30882 Dropping a temporary table inside a stored function may cause a server crash |
2537 |
close_thread_tables(thd); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2538 |
pthread_mutex_lock(&LOCK_thread_count); |
|
973.117.2
by sasha at sashanet
replication updates. This changeset seems to be working fine on test systems. |
2539 |
THD_CHECK_SENTRY(thd); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2540 |
delete thd; |
2541 |
pthread_mutex_unlock(&LOCK_thread_count); |
|
|
1810.1887.10
by grog at lemis
slave.cc: |
2542 |
mi->abort_slave= 0; |
2543 |
mi->slave_running= 0; |
|
2544 |
mi->io_thd= 0; |
|
|
1810.2611.1
by rafal at quant
BUG#25306 (Race conditions during replication slave shutdown (valgrind stacks)): |
2545 |
/*
|
2546 |
Note: the order of the two following calls (first broadcast, then unlock)
|
|
2547 |
is important. Otherwise a killer_thread can execute between the calls and
|
|
2548 |
delete the mi structure leading to a crash! (see BUG#25306 for details)
|
|
2549 |
*/
|
|
|
1810.1887.10
by grog at lemis
slave.cc: |
2550 |
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done |
|
1810.2611.1
by rafal at quant
BUG#25306 (Race conditions during replication slave shutdown (valgrind stacks)): |
2551 |
pthread_mutex_unlock(&mi->run_lock); |
|
2181.141.7
by mats at romeo
Bug#20850 (Assert during slave shutdown in many rpl_* tests): |
2552 |
my_thread_end(); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2553 |
pthread_exit(0); |
|
2181.142.1
by grog at lemis
slave.cc: |
2554 |
DBUG_RETURN(0); // Can't return anything here |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2555 |
}
|
2556 |
||
|
973.26.26
by monty at mysql
New error messages |
2557 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
2558 |
/* Slave SQL Thread entry point */
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
2559 |
|
|
1810.845.1
by serg at serg
pthread_handler_decl() changed to be ctags-friendly |
2560 |
pthread_handler_t handle_slave_sql(void *arg) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2561 |
{
|
|
2181.142.1
by grog at lemis
slave.cc: |
2562 |
THD *thd; /* needs to be first for thread_stack */ |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2563 |
char llbuff[22],llbuff1[22]; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
2564 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
2565 |
Relay_log_info* rli = &((Master_info*)arg)->rli; |
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2566 |
const char *errmsg; |
2567 |
||
2568 |
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
|
|
2569 |
my_thread_init(); |
|
|
1346.137.2
by monty at mysql
Fix that round(0.1,1) == round(0.1,1) |
2570 |
DBUG_ENTER("handle_slave_sql"); |
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2571 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2572 |
DBUG_ASSERT(rli->inited); |
2573 |
pthread_mutex_lock(&rli->run_lock); |
|
2574 |
DBUG_ASSERT(!rli->slave_running); |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2575 |
errmsg= 0; |
|
2181.142.1
by grog at lemis
slave.cc: |
2576 |
#ifndef DBUG_OFF
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2577 |
rli->events_till_abort = abort_slave_event_count; |
|
2181.142.1
by grog at lemis
slave.cc: |
2578 |
#endif
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2579 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2580 |
thd = new THD; // note that contructor of THD uses DBUG_ ! |
|
1494.8.20
by monty at mysql
Added support for ULONG division with DIV |
2581 |
thd->thread_stack = (char*)&thd; // remember where our stack is |
|
1810.3624.1
by andrei at inet
Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails |
2582 |
rli->sql_thd= thd; |
|
1494.8.20
by monty at mysql
Added support for ULONG division with DIV |
2583 |
|
|
1239.1.3
by monty at mysql
Give better error from reconnect() |
2584 |
/* Inform waiting threads that slave has started */
|
2585 |
rli->slave_run_id++; |
|
|
1810.3624.1
by andrei at inet
Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails |
2586 |
rli->slave_running = 1; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2587 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2588 |
pthread_detach_this_thread(); |
2589 |
if (init_slave_thread(thd, SLAVE_THD_SQL)) |
|
|
973.26.26
by monty at mysql
New error messages |
2590 |
{
|
2591 |
/*
|
|
2592 |
TODO: this is currently broken - slave start and change master
|
|
2593 |
will be stuck if we fail here
|
|
2594 |
*/
|
|
2595 |
pthread_cond_broadcast(&rli->start_cond); |
|
2596 |
pthread_mutex_unlock(&rli->run_lock); |
|
2597 |
sql_print_error("Failed during slave thread initialization"); |
|
2598 |
goto err; |
|
2599 |
}
|
|
|
1616.63.1
by konstantin at oak
THD::init_for_queries() pushed back: |
2600 |
thd->init_for_queries(); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2601 |
thd->temporary_tables = rli->save_temporary_tables; // restore temp tables |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2602 |
pthread_mutex_lock(&LOCK_thread_count); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2603 |
threads.append(thd); |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2604 |
pthread_mutex_unlock(&LOCK_thread_count); |
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
2605 |
/*
|
2606 |
We are going to set slave_running to 1. Assuming slave I/O thread is
|
|
2607 |
alive and connected, this is going to make Seconds_Behind_Master be 0
|
|
2608 |
i.e. "caught up". Even if we're just at start of thread. Well it's ok, at
|
|
2609 |
the moment we start we can think we are caught up, and the next second we
|
|
2610 |
start receiving data so we realize we are not caught up and
|
|
2611 |
Seconds_Behind_Master grows. No big deal.
|
|
2612 |
*/
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2613 |
rli->abort_slave = 0; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2614 |
pthread_mutex_unlock(&rli->run_lock); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2615 |
pthread_cond_broadcast(&rli->start_cond); |
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
2616 |
|
|
1346.233.105
by guilhem at mysql
2 bugfixes: |
2617 |
/*
|
2618 |
Reset errors for a clean start (otherwise, if the master is idle, the SQL
|
|
2619 |
thread may execute no Query_log_event, so the error will remain even
|
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
2620 |
though there's no problem anymore). Do not reset the master timestamp
|
|
1616.10.1
by monty at mysql
Don't flush cur_log (relay log) on flush_relay_log_info becasue this crashes the server if cur_log is 'hot' and the io_thread has changed log file. |
2621 |
(imagine the slave has caught everything, the STOP SLAVE and START SLAVE:
|
2622 |
as we are not sure that we are going to receive a query, we want to
|
|
2623 |
remember the last master timestamp (to say how many seconds behind we are
|
|
2624 |
now.
|
|
|
1578.1.6
by guilhem at gbichot2
Final push for WL#1098: |
2625 |
But the master timestamp is reset by RESET SLAVE & CHANGE MASTER.
|
|
1346.233.105
by guilhem at mysql
2 bugfixes: |
2626 |
*/
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2627 |
rli->clear_error(); |
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
2628 |
|
2629 |
//tell the I/O thread to take relay_log_space_limit into account from now on
|
|
|
1346.220.2
by guilhem at mysql
- Fix for memory leak if the SQL slave thread is killed just after reading an event. |
2630 |
pthread_mutex_lock(&rli->log_space_lock); |
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
2631 |
rli->ignore_log_space_limit= 0; |
|
1346.220.2
by guilhem at mysql
- Fix for memory leak if the SQL slave thread is killed just after reading an event. |
2632 |
pthread_mutex_unlock(&rli->log_space_lock); |
|
1616.1759.1
by gbichot at mysql
"After Monty's review" changes to the fix for BUG#8325 "Deadlock in replication thread stops replication": |
2633 |
rli->trans_retries= 0; // start from "no error" |
|
2476.604.3
by elkin at inet
Manual merge 5.0-rpl -> 5.1-rpl. |
2634 |
DBUG_PRINT("info", ("rli->trans_retries: %lu", rli->trans_retries)); |
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
2635 |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2636 |
if (init_relay_log_pos(rli, |
|
2181.142.1
by grog at lemis
slave.cc: |
2637 |
rli->group_relay_log_name, |
2638 |
rli->group_relay_log_pos, |
|
2639 |
1 /*need data lock*/, &errmsg, |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2640 |
1 /*look for a description_event*/)) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2641 |
{
|
2642 |
sql_print_error("Error initializing relay log position: %s", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2643 |
errmsg); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2644 |
goto err; |
2645 |
}
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2646 |
THD_CHECK_SENTRY(thd); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2647 |
#ifndef DBUG_OFF
|
2648 |
{
|
|
2649 |
char llbuf1[22], llbuf2[22]; |
|
2650 |
DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2651 |
llstr(my_b_tell(rli->cur_log),llbuf1), |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2652 |
llstr(rli->event_relay_log_pos,llbuf2))); |
2653 |
DBUG_ASSERT(rli->event_relay_log_pos >= BIN_LOG_HEADER_SIZE); |
|
2654 |
/*
|
|
2655 |
Wonder if this is correct. I (Guilhem) wonder if my_b_tell() returns the
|
|
2656 |
correct position when it's called just after my_b_seek() (the questionable
|
|
2657 |
stuff is those "seek is done on next read" comments in the my_b_seek()
|
|
2658 |
source code).
|
|
2659 |
The crude reality is that this assertion randomly fails whereas
|
|
2660 |
replication seems to work fine. And there is no easy explanation why it
|
|
2661 |
fails (as we my_b_seek(rli->event_relay_log_pos) at the very end of
|
|
2662 |
init_relay_log_pos() called above). Maybe the assertion would be
|
|
2663 |
meaningful if we held rli->data_lock between the my_b_seek() and the
|
|
2664 |
DBUG_ASSERT().
|
|
2665 |
*/
|
|
2666 |
#ifdef SHOULD_BE_CHECKED
|
|
2667 |
DBUG_ASSERT(my_b_tell(rli->cur_log) == rli->event_relay_log_pos); |
|
2668 |
#endif
|
|
2669 |
}
|
|
2670 |
#endif
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2671 |
DBUG_ASSERT(rli->sql_thd == thd); |
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
2672 |
|
2673 |
DBUG_PRINT("master_info",("log_file_name: %s position: %s", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2674 |
rli->group_master_log_name, |
2675 |
llstr(rli->group_master_log_pos,llbuff))); |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2676 |
if (global_system_variables.log_warnings) |
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
2677 |
sql_print_information("Slave SQL thread initialized, starting replication in \ |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
2678 |
log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME, |
|
2181.142.1
by grog at lemis
slave.cc: |
2679 |
llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name, |
2680 |
llstr(rli->group_relay_log_pos,llbuff1)); |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2681 |
|
|
1546.82.1
by gluh at r18
SCRUM: |
2682 |
/* execute init_slave variable */
|
|
1616.240.7
by serg at serg
sys_var_str.value is never NULL |
2683 |
if (sys_init_slave.value_length) |
|
1546.82.1
by gluh at r18
SCRUM: |
2684 |
{
|
|
1546.82.2
by gluh at r18
Task ID 499:Add a new settable string variable(init_connect, init_slave) |
2685 |
execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave); |
|
2476.517.1
by kostja at bodhi
Rename: query_error -> is_slave_error. |
2686 |
if (thd->is_slave_error) |
|
1546.82.1
by gluh at r18
SCRUM: |
2687 |
{
|
2688 |
sql_print_error("\ |
|
2689 |
Slave SQL thread aborted. Can't execute init_slave query"); |
|
2690 |
goto err; |
|
2691 |
}
|
|
2692 |
}
|
|
2693 |
||
|
1810.3662.1
by svoj at mysql
BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if |
2694 |
/*
|
2695 |
First check until condition - probably there is nothing to execute. We
|
|
2696 |
do not want to wait for next event in this case.
|
|
2697 |
*/
|
|
2698 |
pthread_mutex_lock(&rli->data_lock); |
|
|
2512.49.19
by svoj at mysql
BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if |
2699 |
if (rli->until_condition != Relay_log_info::UNTIL_NONE && |
|
1810.3662.1
by svoj at mysql
BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if |
2700 |
rli->is_until_satisfied(rli->group_master_log_pos)) |
2701 |
{
|
|
2702 |
char buf[22]; |
|
2703 |
sql_print_information("Slave SQL thread stopped because it reached its" |
|
2704 |
" UNTIL position %s", llstr(rli->until_pos(), buf)); |
|
2705 |
pthread_mutex_unlock(&rli->data_lock); |
|
2706 |
goto err; |
|
2707 |
}
|
|
2708 |
pthread_mutex_unlock(&rli->data_lock); |
|
2709 |
||
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2710 |
/* Read queries from the IO/THREAD until this thread is killed */
|
2711 |
||
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
2712 |
while (!sql_slave_killed(thd,rli)) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2713 |
{
|
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2714 |
thd_proc_info(thd, "Reading event from the relay log"); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2715 |
DBUG_ASSERT(rli->sql_thd == thd); |
|
973.117.2
by sasha at sashanet
replication updates. This changeset seems to be working fine on test systems. |
2716 |
THD_CHECK_SENTRY(thd); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2717 |
if (exec_relay_log_event(thd,rli)) |
2718 |
{
|
|
|
2303.203.3
by mats at romeo
BUG#23171 (Illegal slave restart position): |
2719 |
DBUG_PRINT("info", ("exec_relay_log_event() failed")); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2720 |
// do not scare the user if SQL thread was simply killed or stopped
|
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
2721 |
if (!sql_slave_killed(thd,rli)) |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2722 |
{
|
2723 |
/*
|
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2724 |
retrieve as much info as possible from the thd and, error
|
2725 |
codes and warnings and print this to the error log as to
|
|
2726 |
allow the user to locate the error
|
|
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2727 |
*/
|
|
2476.106.18
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count has |
2728 |
uint32 const last_errno= rli->last_error().number; |
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2729 |
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
2730 |
if (thd->is_error()) |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2731 |
{
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
2732 |
char const *const errmsg= thd->main_da.message(); |
2733 |
||
2734 |
DBUG_PRINT("info", |
|
2735 |
("thd->main_da.sql_errno()=%d; rli->last_error.number=%d", |
|
2736 |
thd->main_da.sql_errno(), last_errno)); |
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2737 |
if (last_errno == 0) |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2738 |
{
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
2739 |
rli->report(ERROR_LEVEL, thd->main_da.sql_errno(), errmsg); |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2740 |
}
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
2741 |
else if (last_errno != thd->main_da.sql_errno()) |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2742 |
{
|
2743 |
sql_print_error("Slave (additional info): %s Error_code: %d", |
|
|
2476.721.1
by kostja at bodhi
Bug#12713 "Error in a stored function called from a SELECT doesn't |
2744 |
errmsg, thd->main_da.sql_errno()); |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2745 |
}
|
2746 |
}
|
|
2747 |
||
2748 |
/* Print any warnings issued */
|
|
2749 |
List_iterator_fast<MYSQL_ERROR> it(thd->warn_list); |
|
2750 |
MYSQL_ERROR *err; |
|
|
2409.100.1
by Chuck at mysql_cab_desk
WL#3629 - Replication of Invocation and Invoked Features |
2751 |
/*
|
2752 |
Added controlled slave thread cancel for replication
|
|
2753 |
of user-defined variables.
|
|
2754 |
*/
|
|
2755 |
bool udf_error = false; |
|
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2756 |
while ((err= it++)) |
|
2409.100.1
by Chuck at mysql_cab_desk
WL#3629 - Replication of Invocation and Invoked Features |
2757 |
{
|
2758 |
if (err->code == ER_CANT_OPEN_LIBRARY) |
|
2759 |
udf_error = true; |
|
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2760 |
sql_print_warning("Slave: %s Error_code: %d",err->msg, err->code); |
|
2409.100.1
by Chuck at mysql_cab_desk
WL#3629 - Replication of Invocation and Invoked Features |
2761 |
}
|
2762 |
if (udf_error) |
|
2763 |
sql_print_error("Error loading user-defined library, slave SQL " |
|
2764 |
"thread aborted. Install the missing library, and restart the "
|
|
2765 |
"slave SQL thread with \"SLAVE START\". We stopped at log '%s' " |
|
2766 |
"position %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, |
|
2767 |
llbuff)); |
|
2768 |
else
|
|
2769 |
sql_print_error("\ |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2770 |
Error running query, slave SQL thread aborted. Fix the problem, and restart \
|
|
973.26.26
by monty at mysql
New error messages |
2771 |
the slave SQL thread with \"SLAVE START\". We stopped at log \ |
|
1616.888.1
by serg at serg
few s/sql_print_error/sql_print_information/ |
2772 |
'%s' position %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, llbuff)); |
|
2040.13.1
by tomas at mysql
wl2325 wl2324 |
2773 |
}
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2774 |
goto err; |
2775 |
}
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2776 |
}
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2777 |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2778 |
/* Thread stopped. Print the current replication position to the log */
|
|
1627.16.1
by monty at mysql
merge with 4.1 |
2779 |
sql_print_information("Slave SQL thread exiting, replication stopped in log " |
|
2181.142.1
by grog at lemis
slave.cc: |
2780 |
"'%s' at position %s", |
2781 |
RPL_LOG_NAME, llstr(rli->group_master_log_pos,llbuff)); |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2782 |
|
2783 |
err:
|
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
2784 |
|
2785 |
/*
|
|
2786 |
Some events set some playgrounds, which won't be cleared because thread
|
|
2787 |
stops. Stopping of this thread may not be known to these events ("stop"
|
|
2788 |
request is detected only by the present function, not by events), so we
|
|
2789 |
must "proactively" clear playgrounds:
|
|
2790 |
*/
|
|
2791 |
rli->cleanup_context(thd, 1); |
|
|
676.269.1
by monty at mysql
Only set thd->query to 0 if LOCK_thread_count is hold |
2792 |
VOID(pthread_mutex_lock(&LOCK_thread_count)); |
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
2793 |
/*
|
2794 |
Some extra safety, which should not been needed (normally, event deletion
|
|
2795 |
should already have done these assignments (each event which sets these
|
|
2796 |
variables is supposed to set them to 0 before terminating)).
|
|
2797 |
*/
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
2798 |
thd->query= thd->db= thd->catalog= 0; |
|
1346.721.1
by guilhem at mysql
when we update thd->db in replication, it's safer to update thd->db_length too. |
2799 |
thd->query_length= thd->db_length= 0; |
|
676.269.1
by monty at mysql
Only set thd->query to 0 if LOCK_thread_count is hold |
2800 |
VOID(pthread_mutex_unlock(&LOCK_thread_count)); |
|
1810.2870.3
by cmiller at cornsilk
Prevent bugs by making DBUG_* expressions syntactically equivalent |
2801 |
thd_proc_info(thd, "Waiting for slave mutex on exit"); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2802 |
pthread_mutex_lock(&rli->run_lock); |
|
1346.226.21
by guilhem at mysql
- Fix for bug 651: now a dying SQL slave threads wakes up any waiting MASTER_POS_WAIT(). |
2803 |
/* We need data_lock, at least to wake up any waiting master_pos_wait() */
|
2804 |
pthread_mutex_lock(&rli->data_lock); |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2805 |
DBUG_ASSERT(rli->slave_running == 1); // tracking buffer overrun |
|
1346.226.21
by guilhem at mysql
- Fix for bug 651: now a dying SQL slave threads wakes up any waiting MASTER_POS_WAIT(). |
2806 |
/* When master_pos_wait() wakes up it will check this and terminate */
|
|
2181.142.1
by grog at lemis
slave.cc: |
2807 |
rli->slave_running= 0; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2808 |
/* Forget the relay log's format */
|
2809 |
delete rli->relay_log.description_event_for_exec; |
|
2810 |
rli->relay_log.description_event_for_exec= 0; |
|
|
1346.226.21
by guilhem at mysql
- Fix for bug 651: now a dying SQL slave threads wakes up any waiting MASTER_POS_WAIT(). |
2811 |
/* Wake up master_pos_wait() */
|
2812 |
pthread_mutex_unlock(&rli->data_lock); |
|
2813 |
DBUG_PRINT("info",("Signaling possibly waiting master_pos_wait() functions")); |
|
2814 |
pthread_cond_broadcast(&rli->data_cond); |
|
|
1346.226.23
by guilhem at mysql
Simplified a test. |
2815 |
rli->ignore_log_space_limit= 0; /* don't need any lock */ |
|
1700.158.1
by guilhem at mysql
WL#1062 "log charset info into all Query_log_event": |
2816 |
/* we die so won't remember charset - re-update them on next thread start */
|
2817 |
rli->cached_charset_invalidate(); |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2818 |
rli->save_temporary_tables = thd->temporary_tables; |
|
973.26.26
by monty at mysql
New error messages |
2819 |
|
2820 |
/*
|
|
2821 |
TODO: see if we can do this conditionally in next_event() instead
|
|
2822 |
to avoid unneeded position re-init
|
|
2823 |
*/
|
|
|
301.1.1
by sasha at sashanet
added loops and other cool stuff to mysqltest |
2824 |
thd->temporary_tables = 0; // remove tempation from destructor to close them |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2825 |
DBUG_ASSERT(thd->net.buff != 0); |
|
358
by sasha at sashanet
fixed up leaks found by --exit-info=256 |
2826 |
net_end(&thd->net); // destructor will not free it, because we are weird |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2827 |
DBUG_ASSERT(rli->sql_thd == thd); |
|
973.117.2
by sasha at sashanet
replication updates. This changeset seems to be working fine on test systems. |
2828 |
THD_CHECK_SENTRY(thd); |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
2829 |
rli->sql_thd= 0; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2830 |
pthread_mutex_lock(&LOCK_thread_count); |
|
973.117.2
by sasha at sashanet
replication updates. This changeset seems to be working fine on test systems. |
2831 |
THD_CHECK_SENTRY(thd); |
|
2
by bk at mysql
Import changeset |
2832 |
delete thd; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2833 |
pthread_mutex_unlock(&LOCK_thread_count); |
|
1810.2611.1
by rafal at quant
BUG#25306 (Race conditions during replication slave shutdown (valgrind stacks)): |
2834 |
/*
|
2835 |
Note: the order of the broadcast and unlock calls below (first broadcast, then unlock)
|
|
2836 |
is important. Otherwise a killer_thread can execute between the calls and
|
|
2837 |
delete the mi structure leading to a crash! (see BUG#25306 for details)
|
|
2838 |
*/
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
2839 |
pthread_cond_broadcast(&rli->stop_cond); |
|
1810.2611.1
by rafal at quant
BUG#25306 (Race conditions during replication slave shutdown (valgrind stacks)): |
2840 |
pthread_mutex_unlock(&rli->run_lock); // tell the world we are done |
2841 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
2842 |
my_thread_end(); |
|
2
by bk at mysql
Import changeset |
2843 |
pthread_exit(0); |
|
2181.142.1
by grog at lemis
slave.cc: |
2844 |
DBUG_RETURN(0); // Can't return anything here |
|
2
by bk at mysql
Import changeset |
2845 |
}
|
2846 |
||
|
1346.96.3
by monty at mysql
Fixes for Netware |
2847 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
2848 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
2849 |
process_io_create_file()
|
|
1439
by monty at mysql
Merge with 4.0.11 |
2850 |
*/
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
2851 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
2852 |
static int process_io_create_file(Master_info* mi, Create_file_log_event* cev) |
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2853 |
{
|
2854 |
int error = 1; |
|
2855 |
ulong num_bytes; |
|
2856 |
bool cev_not_written; |
|
|
1249.3.2
by monty at mysql
Fixes and code cleanups after merge with 4.0.3 |
2857 |
THD *thd = mi->io_thd; |
2858 |
NET *net = &mi->mysql->net; |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2859 |
DBUG_ENTER("process_io_create_file"); |
2860 |
||
2861 |
if (unlikely(!cev->is_valid())) |
|
2862 |
DBUG_RETURN(1); |
|
|
1700.355.10
by lars at mysql
WL#2472: Refactoring of replication and binlog filtering. |
2863 |
|
2864 |
if (!rpl_filter->db_ok(cev->db)) |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2865 |
{
|
2866 |
skip_load_data_infile(net); |
|
2867 |
DBUG_RETURN(0); |
|
2868 |
}
|
|
2869 |
DBUG_ASSERT(cev->inited_from_old); |
|
2870 |
thd->file_id = cev->file_id = mi->file_id++; |
|
2871 |
thd->server_id = cev->server_id; |
|
2872 |
cev_not_written = 1; |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2873 |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2874 |
if (unlikely(net_request_file(net,cev->fname))) |
2875 |
{
|
|
2876 |
sql_print_error("Slave I/O: failed requesting download of '%s'", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2877 |
cev->fname); |
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2878 |
goto err; |
2879 |
}
|
|
2880 |
||
2881 |
/*
|
|
2882 |
This dummy block is so we could instantiate Append_block_log_event
|
|
2883 |
once and then modify it slightly instead of doing it multiple times
|
|
2884 |
in the loop
|
|
2885 |
*/
|
|
2886 |
{
|
|
2887 |
Append_block_log_event aev(thd,0,0,0,0); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2888 |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2889 |
for (;;) |
2890 |
{
|
|
2891 |
if (unlikely((num_bytes=my_net_read(net)) == packet_error)) |
|
2892 |
{
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
2893 |
sql_print_error("Network read error downloading '%s' from master", |
2894 |
cev->fname); |
|
2895 |
goto err; |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2896 |
}
|
2897 |
if (unlikely(!num_bytes)) /* eof */ |
|
2898 |
{
|
|
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
2899 |
/* 3.23 master wants it */
|
2900 |
net_write_command(net, 0, (uchar*) "", 0, (uchar*) "", 0); |
|
|
1616.150.1
by monty at mysql
Merge with 4.0.18 |
2901 |
/*
|
2902 |
If we wrote Create_file_log_event, then we need to write
|
|
2903 |
Execute_load_log_event. If we did not write Create_file_log_event,
|
|
2904 |
then this is an empty file and we can just do as if the LOAD DATA
|
|
2905 |
INFILE had not existed, i.e. write nothing.
|
|
2906 |
*/
|
|
2907 |
if (unlikely(cev_not_written)) |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2908 |
break; |
2909 |
Execute_load_log_event xev(thd,0,0); |
|
2910 |
xev.log_pos = cev->log_pos; |
|
2911 |
if (unlikely(mi->rli.relay_log.append(&xev))) |
|
2912 |
{
|
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2913 |
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, |
2914 |
ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE), |
|
2915 |
"error writing Exec_load event to relay log"); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2916 |
goto err; |
2917 |
}
|
|
2918 |
mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); |
|
2919 |
break; |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2920 |
}
|
2921 |
if (unlikely(cev_not_written)) |
|
2922 |
{
|
|
|
2476.763.31
by mkindahl at mysql
Post-merge changes. |
2923 |
cev->block = net->read_pos; |
|
2181.142.1
by grog at lemis
slave.cc: |
2924 |
cev->block_len = num_bytes; |
2925 |
if (unlikely(mi->rli.relay_log.append(cev))) |
|
2926 |
{
|
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2927 |
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, |
2928 |
ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE), |
|
2929 |
"error writing Create_file event to relay log"); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2930 |
goto err; |
2931 |
}
|
|
2932 |
cev_not_written=0; |
|
2933 |
mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total); |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2934 |
}
|
2935 |
else
|
|
2936 |
{
|
|
|
2476.763.31
by mkindahl at mysql
Post-merge changes. |
2937 |
aev.block = net->read_pos; |
|
2181.142.1
by grog at lemis
slave.cc: |
2938 |
aev.block_len = num_bytes; |
2939 |
aev.log_pos = cev->log_pos; |
|
2940 |
if (unlikely(mi->rli.relay_log.append(&aev))) |
|
2941 |
{
|
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
2942 |
mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, |
2943 |
ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE), |
|
2944 |
"error writing Append_block event to relay log"); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
2945 |
goto err; |
2946 |
}
|
|
2947 |
mi->rli.relay_log.harvest_bytes_written(&mi->rli.log_space_total) ; |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
2948 |
}
|
2949 |
}
|
|
2950 |
}
|
|
2951 |
error=0; |
|
2952 |
err:
|
|
2953 |
DBUG_RETURN(error); |
|
2954 |
}
|
|
2955 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
2956 |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
2957 |
/*
|
|
1273.1.1
by monty at mysql
Portability fixes. |
2958 |
Start using a new binary log on the master
|
2959 |
||
2960 |
SYNOPSIS
|
|
2961 |
process_io_rotate()
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
2962 |
mi master_info for the slave
|
2963 |
rev The rotate log event read from the binary log
|
|
|
1273.1.1
by monty at mysql
Portability fixes. |
2964 |
|
2965 |
DESCRIPTION
|
|
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
2966 |
Updates the master info with the place in the next binary
|
|
1273.1.1
by monty at mysql
Portability fixes. |
2967 |
log where we should start reading.
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
2968 |
Rotate the relay log to avoid mixed-format relay logs.
|
|
1273.1.1
by monty at mysql
Portability fixes. |
2969 |
|
2970 |
NOTES
|
|
2971 |
We assume we already locked mi->data_lock
|
|
2972 |
||
2973 |
RETURN VALUES
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
2974 |
0 ok
|
2975 |
1 Log event is illegal
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
2976 |
|
2977 |
*/
|
|
2978 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
2979 |
static int process_io_rotate(Master_info *mi, Rotate_log_event *rev) |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
2980 |
{
|
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
2981 |
DBUG_ENTER("process_io_rotate"); |
|
1273.1.1
by monty at mysql
Portability fixes. |
2982 |
safe_mutex_assert_owner(&mi->data_lock); |
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
2983 |
|
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
2984 |
if (unlikely(!rev->is_valid())) |
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
2985 |
DBUG_RETURN(1); |
|
1273.1.1
by monty at mysql
Portability fixes. |
2986 |
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
2987 |
/* Safe copy as 'rev' has been "sanitized" in Rotate_log_event's ctor */
|
|
1273.1.1
by monty at mysql
Portability fixes. |
2988 |
memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1); |
2989 |
mi->master_log_pos= rev->pos; |
|
|
1616.3019.1
by jani at omakaista
Fixed compiler warnings. |
2990 |
DBUG_PRINT("info", ("master_log_pos: '%s' %lu", |
|
2181.142.1
by grog at lemis
slave.cc: |
2991 |
mi->master_log_name, (ulong) mi->master_log_pos)); |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
2992 |
#ifndef DBUG_OFF
|
|
973.26.26
by monty at mysql
New error messages |
2993 |
/*
|
2994 |
If we do not do this, we will be getting the first
|
|
2995 |
rotate event forever, so we need to not disconnect after one.
|
|
2996 |
*/
|
|
2997 |
if (disconnect_slave_event_count) |
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
2998 |
mi->events_till_disconnect++; |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
2999 |
#endif
|
|
1659.83.7
by serg at serg
auto-ROLLBACK if binlog was not closed properly |
3000 |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3001 |
/*
|
3002 |
If description_event_for_queue is format <4, there is conversion in the
|
|
3003 |
relay log to the slave's format (4). And Rotate can mean upgrade or
|
|
3004 |
nothing. If upgrade, it's to 5.0 or newer, so we will get a Format_desc, so
|
|
3005 |
no need to reset description_event_for_queue now. And if it's nothing (same
|
|
3006 |
master version as before), no need (still using the slave's format).
|
|
3007 |
*/
|
|
3008 |
if (mi->rli.relay_log.description_event_for_queue->binlog_version >= 4) |
|
3009 |
{
|
|
3010 |
delete mi->rli.relay_log.description_event_for_queue; |
|
3011 |
/* start from format 3 (MySQL 4.0) again */
|
|
3012 |
mi->rli.relay_log.description_event_for_queue= new |
|
3013 |
Format_description_log_event(3); |
|
3014 |
}
|
|
|
1624.54.1
by guilhem at mysql
Replication: various small fixes specific to the new binlog format of 5.0 |
3015 |
/*
|
3016 |
Rotate the relay log makes binlog format detection easier (at next slave
|
|
3017 |
start or mysqlbinlog)
|
|
3018 |
*/
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3019 |
rotate_relay_log(mi); /* will take the right mutexes */ |
|
1002
by monty at mysql
Added a lot of DBUG_xxx statements to be able to find replication bug. |
3020 |
DBUG_RETURN(0); |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3021 |
}
|
3022 |
||
|
973.26.26
by monty at mysql
New error messages |
3023 |
/*
|
|
1659.83.7
by serg at serg
auto-ROLLBACK if binlog was not closed properly |
3024 |
Reads a 3.23 event and converts it to the slave's format. This code was
|
3025 |
copied from MySQL 4.0.
|
|
|
973.26.26
by monty at mysql
New error messages |
3026 |
*/
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
3027 |
static int queue_binlog_ver_1_event(Master_info *mi, const char *buf, |
|
2181.142.1
by grog at lemis
slave.cc: |
3028 |
ulong event_len) |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3029 |
{
|
|
973.26.26
by monty at mysql
New error messages |
3030 |
const char *errmsg = 0; |
|
1273.1.1
by monty at mysql
Portability fixes. |
3031 |
ulong inc_pos; |
3032 |
bool ignore_event= 0; |
|
3033 |
char *tmp_buf = 0; |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3034 |
Relay_log_info *rli= &mi->rli; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3035 |
DBUG_ENTER("queue_binlog_ver_1_event"); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3036 |
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3037 |
/*
|
3038 |
If we get Load event, we need to pass a non-reusable buffer
|
|
3039 |
to read_log_event, so we do a trick
|
|
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
3040 |
*/
|
3041 |
if (buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) |
|
3042 |
{
|
|
3043 |
if (unlikely(!(tmp_buf=(char*)my_malloc(event_len+1,MYF(MY_WME))))) |
|
3044 |
{
|
|
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
3045 |
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, |
3046 |
ER(ER_SLAVE_FATAL_ERROR), "Memory allocation failed"); |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3047 |
DBUG_RETURN(1); |
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
3048 |
}
|
3049 |
memcpy(tmp_buf,buf,event_len); |
|
|
1346.564.46
by guilhem at mysql
Fix for BUG#3422 "In 3.23 -> 4.0 replication, slave segfault when replicating LOAD DATA INFILE": |
3050 |
/*
|
3051 |
Create_file constructor wants a 0 as last char of buffer, this 0 will
|
|
3052 |
serve as the string-termination char for the file's name (which is at the
|
|
3053 |
end of the buffer)
|
|
3054 |
We must increment event_len, otherwise the event constructor will not see
|
|
3055 |
this end 0, which leads to segfault.
|
|
3056 |
*/
|
|
3057 |
tmp_buf[event_len++]=0; |
|
|
1346.564.52
by greg at mysql
Fixed compiler error in slave.cc on some platforms. |
3058 |
int4store(tmp_buf+EVENT_LEN_OFFSET, event_len); |
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
3059 |
buf = (const char*)tmp_buf; |
3060 |
}
|
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
3061 |
/*
|
3062 |
This will transform LOAD_EVENT into CREATE_FILE_EVENT, ask the master to
|
|
3063 |
send the loaded file, and write it to the relay log in the form of
|
|
3064 |
Append_block/Exec_load (the SQL thread needs the data, as that thread is not
|
|
3065 |
connected to the master).
|
|
3066 |
*/
|
|
|
973.26.26
by monty at mysql
New error messages |
3067 |
Log_event *ev = Log_event::read_log_event(buf,event_len, &errmsg, |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3068 |
mi->rli.relay_log.description_event_for_queue); |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3069 |
if (unlikely(!ev)) |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3070 |
{
|
3071 |
sql_print_error("Read invalid event from master: '%s',\ |
|
|
973.26.26
by monty at mysql
New error messages |
3072 |
master could be corrupt but a more likely cause of this is a bug", |
|
2181.142.1
by grog at lemis
slave.cc: |
3073 |
errmsg); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3074 |
my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR)); |
3075 |
DBUG_RETURN(1); |
|
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3076 |
}
|
|
2303.203.3
by mats at romeo
BUG#23171 (Illegal slave restart position): |
3077 |
|
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3078 |
pthread_mutex_lock(&mi->data_lock); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3079 |
ev->log_pos= mi->master_log_pos; /* 3.23 events don't contain log_pos */ |
|
973.26.26
by monty at mysql
New error messages |
3080 |
switch (ev->get_type_code()) { |
|
1273.1.1
by monty at mysql
Portability fixes. |
3081 |
case STOP_EVENT: |
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3082 |
ignore_event= 1; |
|
1273.1.1
by monty at mysql
Portability fixes. |
3083 |
inc_pos= event_len; |
3084 |
break; |
|
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3085 |
case ROTATE_EVENT: |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3086 |
if (unlikely(process_io_rotate(mi,(Rotate_log_event*)ev))) |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3087 |
{
|
3088 |
delete ev; |
|
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3089 |
pthread_mutex_unlock(&mi->data_lock); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3090 |
DBUG_RETURN(1); |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3091 |
}
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3092 |
inc_pos= 0; |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3093 |
break; |
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
3094 |
case CREATE_FILE_EVENT: |
3095 |
/*
|
|
3096 |
Yes it's possible to have CREATE_FILE_EVENT here, even if we're in
|
|
3097 |
queue_old_event() which is for 3.23 events which don't comprise
|
|
3098 |
CREATE_FILE_EVENT. This is because read_log_event() above has just
|
|
3099 |
transformed LOAD_EVENT into CREATE_FILE_EVENT.
|
|
3100 |
*/
|
|
3101 |
{
|
|
3102 |
/* We come here when and only when tmp_buf != 0 */
|
|
|
1700.327.2
by monty at mysql
Remove compiler warnings and remove not used variables |
3103 |
DBUG_ASSERT(tmp_buf != 0); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3104 |
inc_pos=event_len; |
3105 |
ev->log_pos+= inc_pos; |
|
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
3106 |
int error = process_io_create_file(mi,(Create_file_log_event*)ev); |
3107 |
delete ev; |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3108 |
mi->master_log_pos += inc_pos; |
|
1616.3019.1
by jani at omakaista
Fixed compiler warnings. |
3109 |
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); |
|
1346.323.6
by guilhem at mysql
Yesterday I removed process_io_create_file; I shouldn't have. |
3110 |
pthread_mutex_unlock(&mi->data_lock); |
3111 |
my_free((char*)tmp_buf, MYF(0)); |
|
3112 |
DBUG_RETURN(error); |
|
3113 |
}
|
|
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3114 |
default:
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3115 |
inc_pos= event_len; |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3116 |
break; |
3117 |
}
|
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3118 |
if (likely(!ignore_event)) |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3119 |
{
|
|
2181.142.1
by grog at lemis
slave.cc: |
3120 |
if (ev->log_pos) |
3121 |
/*
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3122 |
Don't do it for fake Rotate events (see comment in
|
3123 |
Log_event::Log_event(const char* buf...) in log_event.cc).
|
|
3124 |
*/
|
|
3125 |
ev->log_pos+= event_len; /* make log_pos be the pos of the end of the event */ |
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3126 |
if (unlikely(rli->relay_log.append(ev))) |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3127 |
{
|
3128 |
delete ev; |
|
3129 |
pthread_mutex_unlock(&mi->data_lock); |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3130 |
DBUG_RETURN(1); |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3131 |
}
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3132 |
rli->relay_log.harvest_bytes_written(&rli->log_space_total); |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3133 |
}
|
3134 |
delete ev; |
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3135 |
mi->master_log_pos+= inc_pos; |
|
1616.3019.1
by jani at omakaista
Fixed compiler warnings. |
3136 |
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); |
|
973.41.1
by sasha at sashanet
temporary commit - need to pull Monty's changes |
3137 |
pthread_mutex_unlock(&mi->data_lock); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3138 |
DBUG_RETURN(0); |
|
973.37.1
by sasha at sashanet
more predicatable slave behaviour with wait_for_slave_stop in mysqltest |
3139 |
}
|
3140 |
||
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3141 |
/*
|
3142 |
Reads a 4.0 event and converts it to the slave's format. This code was copied
|
|
3143 |
from queue_binlog_ver_1_event(), with some affordable simplifications.
|
|
3144 |
*/
|
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
3145 |
static int queue_binlog_ver_3_event(Master_info *mi, const char *buf, |
|
2181.142.1
by grog at lemis
slave.cc: |
3146 |
ulong event_len) |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3147 |
{
|
3148 |
const char *errmsg = 0; |
|
3149 |
ulong inc_pos; |
|
3150 |
char *tmp_buf = 0; |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3151 |
Relay_log_info *rli= &mi->rli; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3152 |
DBUG_ENTER("queue_binlog_ver_3_event"); |
3153 |
||
3154 |
/* read_log_event() will adjust log_pos to be end_log_pos */
|
|
3155 |
Log_event *ev = Log_event::read_log_event(buf,event_len, &errmsg, |
|
3156 |
mi->rli.relay_log.description_event_for_queue); |
|
3157 |
if (unlikely(!ev)) |
|
3158 |
{
|
|
3159 |
sql_print_error("Read invalid event from master: '%s',\ |
|
3160 |
master could be corrupt but a more likely cause of this is a bug", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3161 |
errmsg); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3162 |
my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR)); |
3163 |
DBUG_RETURN(1); |
|
3164 |
}
|
|
3165 |
pthread_mutex_lock(&mi->data_lock); |
|
3166 |
switch (ev->get_type_code()) { |
|
3167 |
case STOP_EVENT: |
|
3168 |
goto err; |
|
3169 |
case ROTATE_EVENT: |
|
3170 |
if (unlikely(process_io_rotate(mi,(Rotate_log_event*)ev))) |
|
3171 |
{
|
|
3172 |
delete ev; |
|
3173 |
pthread_mutex_unlock(&mi->data_lock); |
|
3174 |
DBUG_RETURN(1); |
|
3175 |
}
|
|
3176 |
inc_pos= 0; |
|
3177 |
break; |
|
3178 |
default:
|
|
3179 |
inc_pos= event_len; |
|
3180 |
break; |
|
3181 |
}
|
|
3182 |
if (unlikely(rli->relay_log.append(ev))) |
|
3183 |
{
|
|
3184 |
delete ev; |
|
3185 |
pthread_mutex_unlock(&mi->data_lock); |
|
3186 |
DBUG_RETURN(1); |
|
3187 |
}
|
|
3188 |
rli->relay_log.harvest_bytes_written(&rli->log_space_total); |
|
3189 |
delete ev; |
|
3190 |
mi->master_log_pos+= inc_pos; |
|
3191 |
err:
|
|
|
1810.2303.1
by monty at mysql
Remove compiler warnings |
3192 |
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3193 |
pthread_mutex_unlock(&mi->data_lock); |
3194 |
DBUG_RETURN(0); |
|
3195 |
}
|
|
3196 |
||
3197 |
/*
|
|
3198 |
queue_old_event()
|
|
3199 |
||
3200 |
Writes a 3.23 or 4.0 event to the relay log, after converting it to the 5.0
|
|
3201 |
(exactly, slave's) format. To do the conversion, we create a 5.0 event from
|
|
3202 |
the 3.23/4.0 bytes, then write this event to the relay log.
|
|
3203 |
||
|
2181.142.1
by grog at lemis
slave.cc: |
3204 |
TODO:
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3205 |
Test this code before release - it has to be tested on a separate
|
3206 |
setup with 3.23 master or 4.0 master
|
|
3207 |
*/
|
|
3208 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
3209 |
static int queue_old_event(Master_info *mi, const char *buf, |
|
2181.142.1
by grog at lemis
slave.cc: |
3210 |
ulong event_len) |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3211 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3212 |
DBUG_ENTER("queue_old_event"); |
3213 |
||
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3214 |
switch (mi->rli.relay_log.description_event_for_queue->binlog_version) |
3215 |
{
|
|
3216 |
case 1: |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3217 |
DBUG_RETURN(queue_binlog_ver_1_event(mi,buf,event_len)); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3218 |
case 3: |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3219 |
DBUG_RETURN(queue_binlog_ver_3_event(mi,buf,event_len)); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3220 |
default: /* unsupported format; eg version 2 */ |
3221 |
DBUG_PRINT("info",("unsupported binlog format %d in queue_old_event()", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3222 |
mi->rli.relay_log.description_event_for_queue->binlog_version)); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3223 |
DBUG_RETURN(1); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3224 |
}
|
3225 |
}
|
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
3226 |
|
|
973.26.26
by monty at mysql
New error messages |
3227 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
3228 |
queue_event()
|
3229 |
||
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3230 |
If the event is 3.23/4.0, passes it to queue_old_event() which will convert
|
3231 |
it. Otherwise, writes a 5.0 (or newer) event to the relay log. Then there is
|
|
3232 |
no format conversion, it's pure read/write of bytes.
|
|
3233 |
So a 5.0.0 slave's relay log can contain events in the slave's format or in
|
|
3234 |
any >=5.0.0 format.
|
|
|
973.26.26
by monty at mysql
New error messages |
3235 |
*/
|
3236 |
||
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
3237 |
static int queue_event(Master_info* mi,const char* buf, ulong event_len) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3238 |
{
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3239 |
int error= 0; |
3240 |
ulong inc_pos; |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3241 |
Relay_log_info *rli= &mi->rli; |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3242 |
pthread_mutex_t *log_lock= rli->relay_log.get_log_lock(); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3243 |
DBUG_ENTER("queue_event"); |
3244 |
||
|
1810.2554.2
by monty at mysql
After merge fixes: |
3245 |
LINT_INIT(inc_pos); |
3246 |
||
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3247 |
if (mi->rli.relay_log.description_event_for_queue->binlog_version<4 && |
3248 |
buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */) |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3249 |
DBUG_RETURN(queue_old_event(mi,buf,event_len)); |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3250 |
|
|
2119.296.1
by monty at mysql
Fixed compiler and valgrind warnings |
3251 |
LINT_INIT(inc_pos); |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3252 |
pthread_mutex_lock(&mi->data_lock); |
|
1273.1.1
by monty at mysql
Portability fixes. |
3253 |
|
|
973.26.26
by monty at mysql
New error messages |
3254 |
switch (buf[EVENT_TYPE_OFFSET]) { |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3255 |
case STOP_EVENT: |
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3256 |
/*
|
3257 |
We needn't write this event to the relay log. Indeed, it just indicates a
|
|
|
1572.1.7
by monty at mysql
Fixes after merge |
3258 |
master server shutdown. The only thing this does is cleaning. But
|
3259 |
cleaning is already done on a per-master-thread basis (as the master
|
|
3260 |
server is shutting down cleanly, it has written all DROP TEMPORARY TABLE
|
|
|
1764.10.8
by guilhem at mysql
First part of fix for BUG#7998 "Replication should be more clever about when to replicate RELEASE_LOCK()" |
3261 |
prepared statements' deletion are TODO only when we binlog prep stmts).
|
|
2181.142.1
by grog at lemis
slave.cc: |
3262 |
|
|
1572.1.7
by monty at mysql
Fixes after merge |
3263 |
We don't even increment mi->master_log_pos, because we may be just after
|
3264 |
a Rotate event. Btw, in a few milliseconds we are going to have a Start
|
|
3265 |
event from the next binlog (unless the master is presently running
|
|
3266 |
without --log-bin).
|
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3267 |
*/
|
3268 |
goto err; |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3269 |
case ROTATE_EVENT: |
3270 |
{
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3271 |
Rotate_log_event rev(buf,event_len,mi->rli.relay_log.description_event_for_queue); |
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3272 |
if (unlikely(process_io_rotate(mi,&rev))) |
|
1273.1.1
by monty at mysql
Portability fixes. |
3273 |
{
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3274 |
error= 1; |
3275 |
goto err; |
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3276 |
}
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3277 |
/*
|
3278 |
Now the I/O thread has just changed its mi->master_log_name, so
|
|
3279 |
incrementing mi->master_log_pos is nonsense.
|
|
3280 |
*/
|
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3281 |
inc_pos= 0; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3282 |
break; |
3283 |
}
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3284 |
case FORMAT_DESCRIPTION_EVENT: |
3285 |
{
|
|
3286 |
/*
|
|
3287 |
Create an event, and save it (when we rotate the relay log, we will have
|
|
3288 |
to write this event again).
|
|
3289 |
*/
|
|
3290 |
/*
|
|
|
1659.83.7
by serg at serg
auto-ROLLBACK if binlog was not closed properly |
3291 |
We are the only thread which reads/writes description_event_for_queue.
|
3292 |
The relay_log struct does not move (though some members of it can
|
|
3293 |
change), so we needn't any lock (no rli->data_lock, no log lock).
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3294 |
*/
|
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
3295 |
Format_description_log_event* tmp; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3296 |
const char* errmsg; |
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
3297 |
if (!(tmp= (Format_description_log_event*) |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3298 |
Log_event::read_log_event(buf, event_len, &errmsg, |
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
3299 |
mi->rli.relay_log.description_event_for_queue))) |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3300 |
{
|
3301 |
error= 2; |
|
3302 |
goto err; |
|
3303 |
}
|
|
|
1624.10.2
by guilhem at gbichot2
This is the final commit for Worklog tasks: |
3304 |
delete mi->rli.relay_log.description_event_for_queue; |
3305 |
mi->rli.relay_log.description_event_for_queue= tmp; |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3306 |
/*
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3307 |
Though this does some conversion to the slave's format, this will
|
|
2181.142.1
by grog at lemis
slave.cc: |
3308 |
preserve the master's binlog format version, and number of event types.
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3309 |
*/
|
|
2181.142.1
by grog at lemis
slave.cc: |
3310 |
/*
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3311 |
If the event was not requested by the slave (the slave did not ask for
|
|
2181.142.1
by grog at lemis
slave.cc: |
3312 |
it), i.e. has end_log_pos=0, we do not increment mi->master_log_pos
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3313 |
*/
|
3314 |
inc_pos= uint4korr(buf+LOG_POS_OFFSET) ? event_len : 0; |
|
3315 |
DBUG_PRINT("info",("binlog format is now %d", |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3316 |
mi->rli.relay_log.description_event_for_queue->binlog_version)); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3317 |
|
3318 |
}
|
|
3319 |
break; |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3320 |
default:
|
|
1273.1.1
by monty at mysql
Portability fixes. |
3321 |
inc_pos= event_len; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3322 |
break; |
3323 |
}
|
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3324 |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3325 |
/*
|
3326 |
If this event is originating from this server, don't queue it.
|
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3327 |
We don't check this for 3.23 events because it's simpler like this; 3.23
|
|
1572.1.7
by monty at mysql
Fixes after merge |
3328 |
will be filtered anyway by the SQL slave thread which also tests the
|
3329 |
server id (we must also keep this test in the SQL thread, in case somebody
|
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3330 |
upgrades a 4.0 slave which has a not-filtered relay log).
|
3331 |
||
3332 |
ANY event coming from ourselves can be ignored: it is obvious for queries;
|
|
3333 |
for STOP_EVENT/ROTATE_EVENT/START_EVENT: these cannot come from ourselves
|
|
3334 |
(--log-slave-updates would not log that) unless this slave is also its
|
|
3335 |
direct master (an unsupported, useless setup!).
|
|
3336 |
*/
|
|
3337 |
||
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3338 |
pthread_mutex_lock(log_lock); |
3339 |
||
|
1616.339.3
by guilhem at mysql
Replication: |
3340 |
if ((uint4korr(buf + SERVER_ID_OFFSET) == ::server_id) && |
|
2303.203.4
by mats at romeo
BUG#23171: Illegal group log position |
3341 |
!mi->rli.replicate_same_server_id) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3342 |
{
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3343 |
/*
|
3344 |
Do not write it to the relay log.
|
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3345 |
a) We still want to increment mi->master_log_pos, so that we won't
|
3346 |
re-read this event from the master if the slave IO thread is now
|
|
3347 |
stopped/restarted (more efficient if the events we are ignoring are big
|
|
3348 |
LOAD DATA INFILE).
|
|
3349 |
b) We want to record that we are skipping events, for the information of
|
|
3350 |
the slave SQL thread, otherwise that thread may let
|
|
3351 |
rli->group_relay_log_pos stay too small if the last binlog's event is
|
|
3352 |
ignored.
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3353 |
But events which were generated by this slave and which do not exist in
|
3354 |
the master's binlog (i.e. Format_desc, Rotate & Stop) should not increment
|
|
3355 |
mi->master_log_pos.
|
|
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3356 |
*/
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3357 |
if (buf[EVENT_TYPE_OFFSET]!=FORMAT_DESCRIPTION_EVENT && |
3358 |
buf[EVENT_TYPE_OFFSET]!=ROTATE_EVENT && |
|
3359 |
buf[EVENT_TYPE_OFFSET]!=STOP_EVENT) |
|
|
1810.867.6
by guilhem at mysql
fixes after merge of 4.1. |
3360 |
{
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3361 |
mi->master_log_pos+= inc_pos; |
|
1810.867.6
by guilhem at mysql
fixes after merge of 4.1. |
3362 |
memcpy(rli->ign_master_log_name_end, mi->master_log_name, FN_REFLEN); |
3363 |
DBUG_ASSERT(rli->ign_master_log_name_end[0]); |
|
3364 |
rli->ign_master_log_pos_end= mi->master_log_pos; |
|
3365 |
}
|
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3366 |
rli->relay_log.signal_update(); // the slave SQL thread needs to re-check |
|
2303.85.2
by monty at monty
Merge mysql.com:/home/my/mysql-5.0 |
3367 |
DBUG_PRINT("info", ("master_log_pos: %lu, event originating from the same server, ignored", |
|
1810.2303.1
by monty at mysql
Remove compiler warnings |
3368 |
(ulong) mi->master_log_pos)); |
|
2181.142.1
by grog at lemis
slave.cc: |
3369 |
}
|
|
1616.289.1
by monty at mysql
Fixed many compiler warnings |
3370 |
else
|
3371 |
{
|
|
3372 |
/* write the event to the relay log */
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3373 |
if (likely(!(rli->relay_log.appendv(buf,event_len,0)))) |
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3374 |
{
|
3375 |
mi->master_log_pos+= inc_pos; |
|
|
1616.3019.1
by jani at omakaista
Fixed compiler warnings. |
3376 |
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); |
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3377 |
rli->relay_log.harvest_bytes_written(&rli->log_space_total); |
3378 |
}
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3379 |
else
|
|
1810.867.2
by guilhem at mysql
Merge mysql.com:/home/mysql_src/mysql-4.1 |
3380 |
error= 3; |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3381 |
rli->ign_master_log_name_end[0]= 0; // last event is not ignored |
|
1616.289.1
by monty at mysql
Fixed many compiler warnings |
3382 |
}
|
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3383 |
pthread_mutex_unlock(log_lock); |
|
1538.27.1
by guilhem at mysql
See each file's changeset for details. |
3384 |
|
3385 |
||
3386 |
err:
|
|
|
973.36.4
by sasha at sashanet
misc replication bugfixes including some needed modifications in IO_CACHE |
3387 |
pthread_mutex_unlock(&mi->data_lock); |
|
1810.2554.2
by monty at mysql
After merge fixes: |
3388 |
DBUG_PRINT("info", ("error: %d", error)); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3389 |
DBUG_RETURN(error); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3390 |
}
|
3391 |
||
|
973.26.26
by monty at mysql
New error messages |
3392 |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3393 |
void end_relay_log_info(Relay_log_info* rli) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3394 |
{
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3395 |
DBUG_ENTER("end_relay_log_info"); |
3396 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3397 |
if (!rli->inited) |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3398 |
DBUG_VOID_RETURN; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3399 |
if (rli->info_fd >= 0) |
|
973.26.26
by monty at mysql
New error messages |
3400 |
{
|
3401 |
end_io_cache(&rli->info_file); |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3402 |
(void) my_close(rli->info_fd, MYF(MY_WME)); |
|
973.26.26
by monty at mysql
New error messages |
3403 |
rli->info_fd = -1; |
3404 |
}
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3405 |
if (rli->cur_log_fd >= 0) |
|
973.26.26
by monty at mysql
New error messages |
3406 |
{
|
3407 |
end_io_cache(&rli->cache_buf); |
|
3408 |
(void)my_close(rli->cur_log_fd, MYF(MY_WME)); |
|
3409 |
rli->cur_log_fd = -1; |
|
3410 |
}
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3411 |
rli->inited = 0; |
|
1346.233.64
by monty at mysql
Better fix for bug #791: At binlog rotation, INSERTs may not find their way into the binlog |
3412 |
rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3413 |
rli->relay_log.harvest_bytes_written(&rli->log_space_total); |
|
1346.392.34
by guilhem at mysql
4 small items in this: |
3414 |
/*
|
3415 |
Delete the slave's temporary tables from memory.
|
|
3416 |
In the future there will be other actions than this, to ensure persistance
|
|
3417 |
of slave's temp tables after shutdown.
|
|
3418 |
*/
|
|
3419 |
rli->close_temporary_tables(); |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3420 |
DBUG_VOID_RETURN; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3421 |
}
|
|
507
by monty at mysql
keep bk happy |
3422 |
|
|
1439
by monty at mysql
Merge with 4.0.11 |
3423 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
3424 |
Try to connect until successful or slave killed
|
3425 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
3426 |
SYNPOSIS
|
3427 |
safe_connect()
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3428 |
thd Thread handler for slave
|
3429 |
mysql MySQL connection handle
|
|
3430 |
mi Replication handle
|
|
|
1439
by monty at mysql
Merge with 4.0.11 |
3431 |
|
3432 |
RETURN
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3433 |
0 ok
|
3434 |
# Error
|
|
|
1439
by monty at mysql
Merge with 4.0.11 |
3435 |
*/
|
3436 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
3437 |
static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi) |
|
2
by bk at mysql
Import changeset |
3438 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3439 |
DBUG_ENTER("safe_connect"); |
3440 |
||
3441 |
DBUG_RETURN(connect_to_master(thd, mysql, mi, 0, 0)); |
|
|
2
by bk at mysql
Import changeset |
3442 |
}
|
3443 |
||
|
973.26.26
by monty at mysql
New error messages |
3444 |
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3445 |
/*
|
|
1439
by monty at mysql
Merge with 4.0.11 |
3446 |
SYNPOSIS
|
3447 |
connect_to_master()
|
|
3448 |
||
3449 |
IMPLEMENTATION
|
|
3450 |
Try to connect until successful or slave killed or we have retried
|
|
3451 |
master_retry_count times
|
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3452 |
*/
|
|
973.26.26
by monty at mysql
New error messages |
3453 |
|
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
3454 |
static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, |
|
2181.142.1
by grog at lemis
slave.cc: |
3455 |
bool reconnect, bool suppress_warnings) |
|
2
by bk at mysql
Import changeset |
3456 |
{
|
|
301.1.1
by sasha at sashanet
added loops and other cool stuff to mysqltest |
3457 |
int slave_was_killed; |
|
2181.142.1
by grog at lemis
slave.cc: |
3458 |
int last_errno= -2; // impossible error |
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3459 |
ulong err_count=0; |
|
587.4.2
by monty at mysql
Fixed test cases for innobase |
3460 |
char llbuff[22]; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3461 |
DBUG_ENTER("connect_to_master"); |
|
587.4.2
by monty at mysql
Fixed test cases for innobase |
3462 |
|
|
275.1.1
by sasha at sashanet
mysql-test/mysql-test-run |
3463 |
#ifndef DBUG_OFF
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
3464 |
mi->events_till_disconnect = disconnect_slave_event_count; |
|
275.1.1
by sasha at sashanet
mysql-test/mysql-test-run |
3465 |
#endif
|
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
3466 |
ulong client_flag= CLIENT_REMEMBER_OPTIONS; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3467 |
if (opt_slave_compressed_protocol) |
|
2181.142.1
by grog at lemis
slave.cc: |
3468 |
client_flag=CLIENT_COMPRESS; /* We will use compression */ |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3469 |
|
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
3470 |
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout); |
3471 |
mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3472 |
|
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
3473 |
#ifdef HAVE_OPENSSL
|
3474 |
if (mi->ssl) |
|
|
2409.108.1
by msvensson at pilot
Bug#19991 CHANGE MASTER need option ssl-verify-server-cert |
3475 |
{
|
|
2181.142.1
by grog at lemis
slave.cc: |
3476 |
mysql_ssl_set(mysql, |
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
3477 |
mi->ssl_key[0]?mi->ssl_key:0, |
|
2181.142.1
by grog at lemis
slave.cc: |
3478 |
mi->ssl_cert[0]?mi->ssl_cert:0, |
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
3479 |
mi->ssl_ca[0]?mi->ssl_ca:0, |
3480 |
mi->ssl_capath[0]?mi->ssl_capath:0, |
|
3481 |
mi->ssl_cipher[0]?mi->ssl_cipher:0); |
|
|
2409.108.1
by msvensson at pilot
Bug#19991 CHANGE MASTER need option ssl-verify-server-cert |
3482 |
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, |
3483 |
&mi->ssl_verify_server_cert); |
|
3484 |
}
|
|
|
1546.66.1
by dlenev at dlenev
Implemented replication over SSL |
3485 |
#endif
|
3486 |
||
|
1538.31.1
by monty at mysql
Cleanup after split of libmysql.c to client.c and libmysql.c. A 4.1 master/slave will now use the 4.1 protocol |
3487 |
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname); |
3488 |
/* This one is not strictly needed but we have it here for completeness */
|
|
3489 |
mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); |
|
3490 |
||
|
973.26.61
by sasha at sashanet
fixed replication assert failure ( found by Jeremy Zawodny) |
3491 |
while (!(slave_was_killed = io_slave_killed(thd,mi)) && |
|
2181.142.1
by grog at lemis
slave.cc: |
3492 |
(reconnect ? mysql_reconnect(mysql) != 0 : |
3493 |
mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, |
|
3494 |
mi->port, 0, client_flag) == 0)) |
|
|
2
by bk at mysql
Import changeset |
3495 |
{
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3496 |
/* Don't repeat last error */
|
|
1524.14.1
by hf at r18
SCRUM |
3497 |
if ((int)mysql_errno(mysql) != last_errno) |
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3498 |
{
|
|
1524.14.1
by hf at r18
SCRUM |
3499 |
last_errno=mysql_errno(mysql); |
|
676.177.116
by monty at mysql
Fix wrong usage of constant which could cause mysqld to use index when doing an update/delete on small tables. |
3500 |
suppress_warnings= 0; |
|
2343.60.1
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count was reached): |
3501 |
mi->report(ERROR_LEVEL, last_errno, |
3502 |
"error %s to master '%s@%s:%d'"
|
|
3503 |
" - retry-time: %d retries: %lu", |
|
3504 |
(reconnect ? "reconnecting" : "connecting"), |
|
3505 |
mi->user, mi->host, mi->port, |
|
3506 |
mi->connect_retry, master_retry_count); |
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3507 |
}
|
|
973.26.26
by monty at mysql
New error messages |
3508 |
/*
|
3509 |
By default we try forever. The reason is that failure will trigger
|
|
3510 |
master election, so if the user did not set master_retry_count we
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3511 |
do not want to have election triggered on the first failure to
|
|
973.26.26
by monty at mysql
New error messages |
3512 |
connect
|
|
818.22.1
by sasha at sashanet
fixes for mysql-test to run without manager |
3513 |
*/
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3514 |
if (++err_count == master_retry_count) |
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3515 |
{
|
3516 |
slave_was_killed=1; |
|
|
855.3.1
by sasha at sashanet
cleanup |
3517 |
if (reconnect) |
3518 |
change_rpl_status(RPL_ACTIVE_SLAVE,RPL_LOST_SOLDIER); |
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3519 |
break; |
3520 |
}
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3521 |
safe_sleep(thd,mi->connect_retry,(CHECK_KILLED_FUNC)io_slave_killed, |
|
2181.142.1
by grog at lemis
slave.cc: |
3522 |
(void*)mi); |
|
2
by bk at mysql
Import changeset |
3523 |
}
|
|
301.1.1
by sasha at sashanet
added loops and other cool stuff to mysqltest |
3524 |
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3525 |
if (!slave_was_killed) |
3526 |
{
|
|
|
855.3.1
by sasha at sashanet
cleanup |
3527 |
if (reconnect) |
|
2181.142.1
by grog at lemis
slave.cc: |
3528 |
{
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3529 |
if (!suppress_warnings && global_system_variables.log_warnings) |
|
2181.142.1
by grog at lemis
slave.cc: |
3530 |
sql_print_information("Slave: connected to master '%s@%s:%d',\ |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3531 |
replication resumed in log '%s' at position %s", mi->user, |
|
2181.142.1
by grog at lemis
slave.cc: |
3532 |
mi->host, mi->port, |
3533 |
IO_RPL_LOG_NAME, |
|
3534 |
llstr(mi->master_log_pos,llbuff)); |
|
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
3535 |
}
|
|
855.3.1
by sasha at sashanet
cleanup |
3536 |
else
|
3537 |
{
|
|
3538 |
change_rpl_status(RPL_IDLE_SLAVE,RPL_ACTIVE_SLAVE); |
|
|
2056.9.1
by cps at outpost
WL1019: complete patch. Reapplied patch to the clean |
3539 |
general_log_print(thd, COM_CONNECT_OUT, "%s@%s:%d", |
3540 |
mi->user, mi->host, mi->port); |
|
|
855.3.1
by sasha at sashanet
cleanup |
3541 |
}
|
|
594
by sasha at sashanet
changed signal by fd close to signal by vio_close |
3542 |
#ifdef SIGNAL_WITH_VIO_CLOSE
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3543 |
thd->set_active_vio(mysql->net.vio); |
|
2181.142.1
by grog at lemis
slave.cc: |
3544 |
#endif
|
|
676.136.7
by monty at mysql
Added usage of --master-retry-count to make mysql-test-run safer. |
3545 |
}
|
|
1659.31.1
by guilhem at mysql
Changing the default of libmysqlclient : it's now NO reconnection. |
3546 |
mysql->reconnect= 1; |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3547 |
DBUG_PRINT("exit",("slave_was_killed: %d", slave_was_killed)); |
3548 |
DBUG_RETURN(slave_was_killed); |
|
|
2
by bk at mysql
Import changeset |
3549 |
}
|
3550 |
||
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
3551 |
|
|
855.3.1
by sasha at sashanet
cleanup |
3552 |
/*
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
3553 |
safe_reconnect()
|
3554 |
||
|
1439
by monty at mysql
Merge with 4.0.11 |
3555 |
IMPLEMENTATION
|
3556 |
Try to connect until successful or slave killed or we have retried
|
|
3557 |
master_retry_count times
|
|
|
855.3.1
by sasha at sashanet
cleanup |
3558 |
*/
|
3559 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
3560 |
static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, |
|
2181.142.1
by grog at lemis
slave.cc: |
3561 |
bool suppress_warnings) |
|
855.3.1
by sasha at sashanet
cleanup |
3562 |
{
|
|
1538.40.3
by monty at mysql
Fixed some new memory leaks |
3563 |
DBUG_ENTER("safe_reconnect"); |
3564 |
DBUG_RETURN(connect_to_master(thd, mysql, mi, 1, suppress_warnings)); |
|
|
855.3.1
by sasha at sashanet
cleanup |
3565 |
}
|
3566 |
||
|
1098.3.1
by monty at mysql
New SET syntax & system variables. |
3567 |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3568 |
/*
|
3569 |
Store the file and position where the execute-slave thread are in the
|
|
3570 |
relay log.
|
|
3571 |
||
3572 |
SYNOPSIS
|
|
3573 |
flush_relay_log_info()
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3574 |
rli Relay log information
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3575 |
|
3576 |
NOTES
|
|
3577 |
- As this is only called by the slave thread, we don't need to
|
|
3578 |
have a lock on this.
|
|
3579 |
- If there is an active transaction, then we don't update the position
|
|
3580 |
in the relay log. This is to ensure that we re-execute statements
|
|
3581 |
if we die in the middle of an transaction that was rolled back.
|
|
3582 |
- As a transaction never spans binary logs, we don't have to handle the
|
|
3583 |
case where we do a relay-log-rotation in the middle of the transaction.
|
|
3584 |
If this would not be the case, we would have to ensure that we
|
|
3585 |
don't delete the relay log file where the transaction started when
|
|
3586 |
we switch to a new relay log file.
|
|
3587 |
||
3588 |
TODO
|
|
3589 |
- Change the log file information to a binary format to avoid calling
|
|
3590 |
longlong2str.
|
|
3591 |
||
3592 |
RETURN VALUES
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3593 |
0 ok
|
3594 |
1 write error
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3595 |
*/
|
3596 |
||
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3597 |
bool flush_relay_log_info(Relay_log_info* rli) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3598 |
{
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3599 |
bool error=0; |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3600 |
DBUG_ENTER("flush_relay_log_info"); |
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
3601 |
|
3602 |
if (unlikely(rli->no_storage)) |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3603 |
DBUG_RETURN(0); |
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
3604 |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3605 |
IO_CACHE *file = &rli->info_file; |
3606 |
char buff[FN_REFLEN*2+22*2+4], *pos; |
|
3607 |
||
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3608 |
my_b_seek(file, 0L); |
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3609 |
pos=strmov(buff, rli->group_relay_log_name); |
3610 |
*pos++='\n'; |
|
3611 |
pos=longlong2str(rli->group_relay_log_pos, pos, 10); |
|
3612 |
*pos++='\n'; |
|
3613 |
pos=strmov(pos, rli->group_master_log_name); |
|
3614 |
*pos++='\n'; |
|
3615 |
pos=longlong2str(rli->group_master_log_pos, pos, 10); |
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3616 |
*pos='\n'; |
|
2475.68.2
by monty at mysql
WL#3817: Simplify string / memory area types and make things more consistent (first part) |
3617 |
if (my_b_write(file, (uchar*) buff, (size_t) (pos-buff)+1)) |
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3618 |
error=1; |
3619 |
if (flush_io_cache(file)) |
|
3620 |
error=1; |
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
3621 |
|
|
1346.524.34
by guilhem at mysql
Undoing 2 parts of changeset 1.1730.1.1 : |
3622 |
/* Flushing the relay log is done by the slave I/O thread */
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3623 |
DBUG_RETURN(error); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3624 |
}
|
3625 |
||
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3626 |
|
3627 |
/*
|
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
3628 |
Called when we notice that the current "hot" log got rotated under our feet.
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3629 |
*/
|
|
1354.8.3
by nick at mysql
Added comment blocks for all functions |
3630 |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3631 |
static IO_CACHE *reopen_relay_log(Relay_log_info *rli, const char **errmsg) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3632 |
{
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3633 |
DBUG_ENTER("reopen_relay_log"); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3634 |
DBUG_ASSERT(rli->cur_log != &rli->cache_buf); |
3635 |
DBUG_ASSERT(rli->cur_log_fd == -1); |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3636 |
|
3637 |
IO_CACHE *cur_log = rli->cur_log=&rli->cache_buf; |
|
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3638 |
if ((rli->cur_log_fd=open_binlog(cur_log,rli->event_relay_log_name, |
|
2181.142.1
by grog at lemis
slave.cc: |
3639 |
errmsg)) <0) |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3640 |
DBUG_RETURN(0); |
|
1346.7.110
by monty at mysql
Ensure that BEGIN / COMMIT is handled properly if slave dies |
3641 |
/*
|
3642 |
We want to start exactly where we was before:
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3643 |
relay_log_pos Current log pos
|
3644 |
pending Number of bytes already processed from the event
|
|
|
1346.7.110
by monty at mysql
Ensure that BEGIN / COMMIT is handled properly if slave dies |
3645 |
*/
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3646 |
rli->event_relay_log_pos= max(rli->event_relay_log_pos, BIN_LOG_HEADER_SIZE); |
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3647 |
my_b_seek(cur_log,rli->event_relay_log_pos); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3648 |
DBUG_RETURN(cur_log); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3649 |
}
|
3650 |
||
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3651 |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3652 |
static Log_event* next_event(Relay_log_info* rli) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3653 |
{
|
3654 |
Log_event* ev; |
|
3655 |
IO_CACHE* cur_log = rli->cur_log; |
|
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3656 |
pthread_mutex_t *log_lock = rli->relay_log.get_log_lock(); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3657 |
const char* errmsg=0; |
3658 |
THD* thd = rli->sql_thd; |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3659 |
DBUG_ENTER("next_event"); |
|
2169.3.2
by serg at mysql
sql/Makefile.am: better mysqld dependencies |
3660 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3661 |
DBUG_ASSERT(thd != 0); |
3662 |
||
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
3663 |
#ifndef DBUG_OFF
|
3664 |
if (abort_slave_event_count && !rli->events_till_abort--) |
|
3665 |
DBUG_RETURN(0); |
|
3666 |
#endif
|
|
3667 |
||
|
973.26.26
by monty at mysql
New error messages |
3668 |
/*
|
3669 |
For most operations we need to protect rli members with data_lock,
|
|
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
3670 |
so we assume calling function acquired this mutex for us and we will
|
3671 |
hold it for the most of the loop below However, we will release it
|
|
3672 |
whenever it is worth the hassle, and in the cases when we go into a
|
|
3673 |
pthread_cond_wait() with the non-data_lock mutex
|
|
|
973.26.26
by monty at mysql
New error messages |
3674 |
*/
|
|
1546.46.7
by dlenev at dlenev
Implemented support for START SLAVE UNTIL (WL#868) |
3675 |
safe_mutex_assert_owner(&rli->data_lock); |
|
2181.142.1
by grog at lemis
slave.cc: |
3676 |
|
|
1238
by monty at mysql
Changed relay_log_space to ulonglong |
3677 |
while (!sql_slave_killed(thd,rli)) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3678 |
{
|
|
973.26.26
by monty at mysql
New error messages |
3679 |
/*
|
3680 |
We can have two kinds of log reading:
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3681 |
hot_log:
|
3682 |
rli->cur_log points at the IO_CACHE of relay_log, which
|
|
3683 |
is actively being updated by the I/O thread. We need to be careful
|
|
3684 |
in this case and make sure that we are not looking at a stale log that
|
|
3685 |
has already been rotated. If it has been, we reopen the log.
|
|
3686 |
||
3687 |
The other case is much simpler:
|
|
3688 |
We just have a read only log that nobody else will be updating.
|
|
|
973.26.26
by monty at mysql
New error messages |
3689 |
*/
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3690 |
bool hot_log; |
3691 |
if ((hot_log = (cur_log != &rli->cache_buf))) |
|
3692 |
{
|
|
3693 |
DBUG_ASSERT(rli->cur_log_fd == -1); // foreign descriptor |
|
3694 |
pthread_mutex_lock(log_lock); |
|
|
973.26.26
by monty at mysql
New error messages |
3695 |
|
3696 |
/*
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3697 |
Reading xxx_file_id is safe because the log will only
|
3698 |
be rotated when we hold relay_log.LOCK_log
|
|
|
973.26.26
by monty at mysql
New error messages |
3699 |
*/
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3700 |
if (rli->relay_log.get_open_count() != rli->cur_log_old_open_count) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3701 |
{
|
|
2181.142.1
by grog at lemis
slave.cc: |
3702 |
// The master has switched to a new log file; Reopen the old log file
|
3703 |
cur_log=reopen_relay_log(rli, &errmsg); |
|
3704 |
pthread_mutex_unlock(log_lock); |
|
3705 |
if (!cur_log) // No more log files |
|
3706 |
goto err; |
|
3707 |
hot_log=0; // Using old binary log |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3708 |
}
|
3709 |
}
|
|
|
1616.2948.1
by ram at mysql
Fix for bug #10798: If relay log fails to rotate, slave will crash after |
3710 |
/*
|
3711 |
As there is no guarantee that the relay is open (for example, an I/O
|
|
3712 |
error during a write by the slave I/O thread may have closed it), we
|
|
3713 |
have to test it.
|
|
3714 |
*/
|
|
3715 |
if (!my_b_inited(cur_log)) |
|
3716 |
goto err; |
|
|
1346.259.9
by guilhem at mysql
I committed the same changeset in my tree yesterday, but broke the tree since, |
3717 |
#ifndef DBUG_OFF
|
3718 |
{
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3719 |
/* This is an assertion which sometimes fails, let's try to track it */
|
|
1546.59.7
by monty at mysql
Merge with 4.0.14 |
3720 |
char llbuf1[22], llbuf2[22]; |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3721 |
DBUG_PRINT("info", ("my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s", |
|
1659.83.6
by serg at serg
open binlog index file *before* tc_log->open() and binlog itself *after* |
3722 |
llstr(my_b_tell(cur_log),llbuf1), |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3723 |
llstr(rli->event_relay_log_pos,llbuf2))); |
|
1346.259.9
by guilhem at mysql
I committed the same changeset in my tree yesterday, but broke the tree since, |
3724 |
DBUG_ASSERT(my_b_tell(cur_log) >= BIN_LOG_HEADER_SIZE); |
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3725 |
DBUG_ASSERT(my_b_tell(cur_log) == rli->event_relay_log_pos); |
|
1346.259.9
by guilhem at mysql
I committed the same changeset in my tree yesterday, but broke the tree since, |
3726 |
}
|
3727 |
#endif
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3728 |
/*
|
3729 |
Relay log is always in new format - if the master is 3.23, the
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3730 |
I/O thread will convert the format for us.
|
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
3731 |
A problem: the description event may be in a previous relay log. So if
|
3732 |
the slave has been shutdown meanwhile, we would have to look in old relay
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3733 |
logs, which may even have been deleted. So we need to write this
|
3734 |
description event at the beginning of the relay log.
|
|
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
3735 |
When the relay log is created when the I/O thread starts, easy: the
|
3736 |
master will send the description event and we will queue it.
|
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3737 |
But if the relay log is created by new_file(): then the solution is:
|
|
2119.600.1
by petr at mysql
WL#3153 "Split logs". Recommit with post-review fixes |
3738 |
MYSQL_BIN_LOG::open() will write the buffered description event.
|
|
973.49.1
by sasha at sashanet
fixes for slave backward compat |
3739 |
*/
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3740 |
if ((ev=Log_event::read_log_event(cur_log,0, |
3741 |
rli->relay_log.description_event_for_exec))) |
|
|
1659.83.6
by serg at serg
open binlog index file *before* tc_log->open() and binlog itself *after* |
3742 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3743 |
{
|
3744 |
DBUG_ASSERT(thd==rli->sql_thd); |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
3745 |
/*
|
3746 |
read it while we have a lock, to avoid a mutex lock in
|
|
3747 |
inc_event_relay_log_pos()
|
|
3748 |
*/
|
|
3749 |
rli->future_event_relay_log_pos= my_b_tell(cur_log); |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3750 |
if (hot_log) |
|
2181.142.1
by grog at lemis
slave.cc: |
3751 |
pthread_mutex_unlock(log_lock); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3752 |
DBUG_RETURN(ev); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3753 |
}
|
3754 |
DBUG_ASSERT(thd==rli->sql_thd); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3755 |
if (opt_reckless_slave) // For mysql-test |
|
973.135.1
by sasha at sashanet
reckless slave option |
3756 |
cur_log->error = 0; |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3757 |
if (cur_log->error < 0) |
|
973.135.1
by sasha at sashanet
reckless slave option |
3758 |
{
|
3759 |
errmsg = "slave SQL thread aborted because of I/O error"; |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3760 |
if (hot_log) |
|
2181.142.1
by grog at lemis
slave.cc: |
3761 |
pthread_mutex_unlock(log_lock); |
|
973.135.1
by sasha at sashanet
reckless slave option |
3762 |
goto err; |
3763 |
}
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3764 |
if (!cur_log->error) /* EOF */ |
3765 |
{
|
|
|
973.26.26
by monty at mysql
New error messages |
3766 |
/*
|
|
2181.142.1
by grog at lemis
slave.cc: |
3767 |
On a hot log, EOF means that there are no more updates to
|
3768 |
process and we must block until I/O thread adds some and
|
|
3769 |
signals us to continue
|
|
|
973.26.26
by monty at mysql
New error messages |
3770 |
*/
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3771 |
if (hot_log) |
3772 |
{
|
|
|
1616.1290.66
by guilhem at mysql
Very minor fixes for Seconds_Behind_Master column of SHOW SLAVE STATUS. |
3773 |
/*
|
3774 |
We say in Seconds_Behind_Master that we have "caught up". Note that
|
|
3775 |
for example if network link is broken but I/O slave thread hasn't
|
|
3776 |
noticed it (slave_net_timeout not elapsed), then we'll say "caught
|
|
3777 |
up" whereas we're not really caught up. Fixing that would require
|
|
3778 |
internally cutting timeout in smaller pieces in network read, no
|
|
3779 |
thanks. Another example: SQL has caught up on I/O, now I/O has read
|
|
3780 |
a new event and is queuing it; the false "0" will exist until SQL
|
|
3781 |
finishes executing the new event; it will be look abnormal only if
|
|
3782 |
the events have old timestamps (then you get "many", 0, "many").
|
|
|
1810.3452.6
by elkin at inet
Bug #29309 Incorrect "Seconds_Behind_Master" value in SHOW SLAVE STATUS after FLUSH LOGS |
3783 |
|
3784 |
Transient phases like this can be fixed with implemeting
|
|
3785 |
Heartbeat event which provides the slave the status of the
|
|
3786 |
master at time the master does not have any new update to send.
|
|
3787 |
Seconds_Behind_Master would be zero only when master has no
|
|
3788 |
more updates in binlog for slave. The heartbeat can be sent
|
|
3789 |
in a (small) fraction of slave_net_timeout. Until it's done
|
|
3790 |
rli->last_master_timestamp is temporarely (for time of
|
|
3791 |
waiting for the following event) reset whenever EOF is
|
|
3792 |
reached.
|
|
|
1616.1290.66
by guilhem at mysql
Very minor fixes for Seconds_Behind_Master column of SHOW SLAVE STATUS. |
3793 |
*/
|
|
2469.1.92
by mats at romeo
Reverting to use time_t instead of my_time_t since the latter caused |
3794 |
time_t save_timestamp= rli->last_master_timestamp; |
|
1616.1290.66
by guilhem at mysql
Very minor fixes for Seconds_Behind_Master column of SHOW SLAVE STATUS. |
3795 |
rli->last_master_timestamp= 0; |
3796 |
||
|
2181.142.1
by grog at lemis
slave.cc: |
3797 |
DBUG_ASSERT(rli->relay_log.get_open_count() == |
|
1616.2343.6
by monty at mysql
Fixes during review of new code |
3798 |
rli->cur_log_old_open_count); |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3799 |
|
3800 |
if (rli->ign_master_log_name_end[0]) |
|
3801 |
{
|
|
3802 |
/* We generate and return a Rotate, to make our positions advance */
|
|
3803 |
DBUG_PRINT("info",("seeing an ignored end segment")); |
|
|
1979
by lars at mysql
WL#1012: All changes as one single changeset. |
3804 |
ev= new Rotate_log_event(rli->ign_master_log_name_end, |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3805 |
0, rli->ign_master_log_pos_end, |
|
1810.867.6
by guilhem at mysql
fixes after merge of 4.1. |
3806 |
Rotate_log_event::DUP_NAME); |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3807 |
rli->ign_master_log_name_end[0]= 0; |
|
1616.2343.6
by monty at mysql
Fixes during review of new code |
3808 |
pthread_mutex_unlock(log_lock); |
|
1616.2336.3
by guilhem at mysql
Fix for BUG#13023: "SQL Thread is up but doesn't move forward". Details in slave.cc; |
3809 |
if (unlikely(!ev)) |
3810 |
{
|
|
3811 |
errmsg= "Slave SQL thread failed to create a Rotate event " |
|
3812 |
"(out of memory?), SHOW SLAVE STATUS may be inaccurate"; |
|
3813 |
goto err; |
|
3814 |
}
|
|
3815 |
ev->server_id= 0; // don't be ignored by slave SQL thread |
|
3816 |
DBUG_RETURN(ev); |
|
3817 |
}
|
|
3818 |
||
|
2181.142.1
by grog at lemis
slave.cc: |
3819 |
/*
|
3820 |
We can, and should release data_lock while we are waiting for
|
|
3821 |
update. If we do not, show slave status will block
|
|
3822 |
*/
|
|
3823 |
pthread_mutex_unlock(&rli->data_lock); |
|
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
3824 |
|
3825 |
/*
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3826 |
Possible deadlock :
|
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
3827 |
- the I/O thread has reached log_space_limit
|
3828 |
- the SQL thread has read all relay logs, but cannot purge for some
|
|
3829 |
reason:
|
|
3830 |
* it has already purged all logs except the current one
|
|
3831 |
* there are other logs than the current one but they're involved in
|
|
3832 |
a transaction that finishes in the current one (or is not finished)
|
|
3833 |
Solution :
|
|
3834 |
Wake up the possibly waiting I/O thread, and set a boolean asking
|
|
3835 |
the I/O thread to temporarily ignore the log_space_limit
|
|
3836 |
constraint, because we do not want the I/O thread to block because of
|
|
3837 |
space (it's ok if it blocks for any other reason (e.g. because the
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3838 |
master does not send anything). Then the I/O thread stops waiting
|
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
3839 |
and reads more events.
|
3840 |
The SQL thread decides when the I/O thread should take log_space_limit
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3841 |
into account again : ignore_log_space_limit is reset to 0
|
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
3842 |
in purge_first_log (when the SQL thread purges the just-read relay
|
3843 |
log), and also when the SQL thread starts. We should also reset
|
|
3844 |
ignore_log_space_limit to 0 when the user does RESET SLAVE, but in
|
|
3845 |
fact, no need as RESET SLAVE requires that the slave
|
|
|
1346.226.23
by guilhem at mysql
Simplified a test. |
3846 |
be stopped, and the SQL thread sets ignore_log_space_limit to 0 when
|
3847 |
it stops.
|
|
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
3848 |
*/
|
3849 |
pthread_mutex_lock(&rli->log_space_lock); |
|
3850 |
// prevent the I/O thread from blocking next times
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3851 |
rli->ignore_log_space_limit= 1; |
|
1346.220.2
by guilhem at mysql
- Fix for memory leak if the SQL slave thread is killed just after reading an event. |
3852 |
/*
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
3853 |
If the I/O thread is blocked, unblock it. Ok to broadcast
|
3854 |
after unlock, because the mutex is only destroyed in
|
|
3855 |
~Relay_log_info(), i.e. when rli is destroyed, and rli will
|
|
3856 |
not be destroyed before we exit the present function.
|
|
|
1346.220.2
by guilhem at mysql
- Fix for memory leak if the SQL slave thread is killed just after reading an event. |
3857 |
*/
|
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3858 |
pthread_mutex_unlock(&rli->log_space_lock); |
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
3859 |
pthread_cond_broadcast(&rli->log_space_cond); |
3860 |
// Note that wait_for_update unlocks lock_log !
|
|
|
1346.331.1
by guilhem at mysql
Clearer states in SHOW PROCESSLIST for replication threads. |
3861 |
rli->relay_log.wait_for_update(rli->sql_thd, 1); |
|
1346.129.55
by guilhem at mysql
New variable rli->ignore_log_space_limit to resolve |
3862 |
// re-acquire data lock since we released it earlier
|
3863 |
pthread_mutex_lock(&rli->data_lock); |
|
|
1616.1372.5
by guilhem at mysql
A change of behaviour of Seconds_Behind_Master from SHOW SLAVE STATUS. It's going into 4.1 |
3864 |
rli->last_master_timestamp= save_timestamp; |
|
2181.142.1
by grog at lemis
slave.cc: |
3865 |
continue; |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3866 |
}
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3867 |
/*
|
|
2181.142.1
by grog at lemis
slave.cc: |
3868 |
If the log was not hot, we need to move to the next log in
|
3869 |
sequence. The next log could be hot or cold, we deal with both
|
|
3870 |
cases separately after doing some common initialization
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3871 |
*/
|
3872 |
end_io_cache(cur_log); |
|
3873 |
DBUG_ASSERT(rli->cur_log_fd >= 0); |
|
3874 |
my_close(rli->cur_log_fd, MYF(MY_WME)); |
|
3875 |
rli->cur_log_fd = -1; |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3876 |
|
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3877 |
if (relay_log_purge) |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3878 |
{
|
|
2181.142.1
by grog at lemis
slave.cc: |
3879 |
/*
|
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3880 |
purge_first_log will properly set up relay log coordinates in rli.
|
3881 |
If the group's coordinates are equal to the event's coordinates
|
|
3882 |
(i.e. the relay log was not rotated in the middle of a group),
|
|
3883 |
we can purge this relay log too.
|
|
3884 |
We do ulonglong and string comparisons, this may be slow but
|
|
3885 |
- purging the last relay log is nice (it can save 1GB of disk), so we
|
|
3886 |
like to detect the case where we can do it, and given this,
|
|
3887 |
- I see no better detection method
|
|
3888 |
- purge_first_log is not called that often
|
|
3889 |
*/
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3890 |
if (rli->relay_log.purge_first_log |
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3891 |
(rli, |
3892 |
rli->group_relay_log_pos == rli->event_relay_log_pos |
|
3893 |
&& !strcmp(rli->group_relay_log_name,rli->event_relay_log_name))) |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3894 |
{
|
3895 |
errmsg = "Error purging processed logs"; |
|
3896 |
goto err; |
|
3897 |
}
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3898 |
}
|
3899 |
else
|
|
3900 |
{
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3901 |
/*
|
3902 |
If hot_log is set, then we already have a lock on
|
|
3903 |
LOCK_log. If not, we have to get the lock.
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3904 |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3905 |
According to Sasha, the only time this code will ever be executed
|
3906 |
is if we are recovering from a bug.
|
|
3907 |
*/
|
|
3908 |
if (rli->relay_log.find_next_log(&rli->linfo, !hot_log)) |
|
3909 |
{
|
|
3910 |
errmsg = "error switching to the next log"; |
|
3911 |
goto err; |
|
3912 |
}
|
|
3913 |
rli->event_relay_log_pos = BIN_LOG_HEADER_SIZE; |
|
3914 |
strmake(rli->event_relay_log_name,rli->linfo.log_file_name, |
|
3915 |
sizeof(rli->event_relay_log_name)-1); |
|
3916 |
flush_relay_log_info(rli); |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3917 |
}
|
|
1346.433.1
by guilhem at mysql
Fix for BUG#2011 "rare race condition producing "binlog has bad magic number" error in slave". |
3918 |
|
3919 |
/*
|
|
3920 |
Now we want to open this next log. To know if it's a hot log (the one
|
|
3921 |
being written by the I/O thread now) or a cold log, we can use
|
|
3922 |
is_active(); if it is hot, we use the I/O cache; if it's cold we open
|
|
3923 |
the file normally. But if is_active() reports that the log is hot, this
|
|
3924 |
may change between the test and the consequence of the test. So we may
|
|
3925 |
open the I/O cache whereas the log is now cold, which is nonsense.
|
|
3926 |
To guard against this, we need to have LOCK_log.
|
|
3927 |
*/
|
|
3928 |
||
3929 |
DBUG_PRINT("info",("hot_log: %d",hot_log)); |
|
3930 |
if (!hot_log) /* if hot_log, we already have this mutex */ |
|
3931 |
pthread_mutex_lock(log_lock); |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3932 |
if (rli->relay_log.is_active(rli->linfo.log_file_name)) |
3933 |
{
|
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3934 |
#ifdef EXTRA_DEBUG
|
|
2181.142.1
by grog at lemis
slave.cc: |
3935 |
if (global_system_variables.log_warnings) |
3936 |
sql_print_information("next log '%s' is currently active", |
|
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
3937 |
rli->linfo.log_file_name); |
|
2181.142.1
by grog at lemis
slave.cc: |
3938 |
#endif
|
3939 |
rli->cur_log= cur_log= rli->relay_log.get_log_file(); |
|
3940 |
rli->cur_log_old_open_count= rli->relay_log.get_open_count(); |
|
3941 |
DBUG_ASSERT(rli->cur_log_fd == -1); |
|
3942 |
||
3943 |
/*
|
|
3944 |
Read pointer has to be at the start since we are the only
|
|
3945 |
reader.
|
|
|
1346.433.1
by guilhem at mysql
Fix for BUG#2011 "rare race condition producing "binlog has bad magic number" error in slave". |
3946 |
We must keep the LOCK_log to read the 4 first bytes, as this is a hot
|
3947 |
log (same as when we call read_log_event() above: for a hot log we
|
|
3948 |
take the mutex).
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
3949 |
*/
|
3950 |
if (check_binlog_magic(cur_log,&errmsg)) |
|
|
1346.433.1
by guilhem at mysql
Fix for BUG#2011 "rare race condition producing "binlog has bad magic number" error in slave". |
3951 |
{
|
3952 |
if (!hot_log) pthread_mutex_unlock(log_lock); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3953 |
goto err; |
|
1346.433.1
by guilhem at mysql
Fix for BUG#2011 "rare race condition producing "binlog has bad magic number" error in slave". |
3954 |
}
|
3955 |
if (!hot_log) pthread_mutex_unlock(log_lock); |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3956 |
continue; |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3957 |
}
|
|
1346.433.1
by guilhem at mysql
Fix for BUG#2011 "rare race condition producing "binlog has bad magic number" error in slave". |
3958 |
if (!hot_log) pthread_mutex_unlock(log_lock); |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3959 |
/*
|
|
2181.142.1
by grog at lemis
slave.cc: |
3960 |
if we get here, the log was not hot, so we will have to open it
|
3961 |
ourselves. We are sure that the log is still not hot now (a log can get
|
|
3962 |
from hot to cold, but not from cold to hot). No need for LOCK_log.
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3963 |
*/
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3964 |
#ifdef EXTRA_DEBUG
|
|
1616.289.1
by monty at mysql
Fixed many compiler warnings |
3965 |
if (global_system_variables.log_warnings) |
|
2181.142.1
by grog at lemis
slave.cc: |
3966 |
sql_print_information("next log '%s' is not active", |
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
3967 |
rli->linfo.log_file_name); |
|
2181.142.1
by grog at lemis
slave.cc: |
3968 |
#endif
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3969 |
// open_binlog() will check the magic header
|
3970 |
if ((rli->cur_log_fd=open_binlog(cur_log,rli->linfo.log_file_name, |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3971 |
&errmsg)) <0) |
3972 |
goto err; |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3973 |
}
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3974 |
else
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3975 |
{
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3976 |
/*
|
|
2181.142.1
by grog at lemis
slave.cc: |
3977 |
Read failed with a non-EOF error.
|
3978 |
TODO: come up with something better to handle this error
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3979 |
*/
|
3980 |
if (hot_log) |
|
|
2181.142.1
by grog at lemis
slave.cc: |
3981 |
pthread_mutex_unlock(log_lock); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3982 |
sql_print_error("Slave SQL thread: I/O error reading \ |
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3983 |
event(errno: %d cur_log->error: %d)", |
|
2181.142.1
by grog at lemis
slave.cc: |
3984 |
my_errno,cur_log->error); |
|
973.79.1
by sasha at sashanet
fixed replication bug |
3985 |
// set read position to the beginning of the event
|
|
1504.20.22
by guilhem at mysql
Replication: new code to not modify in-memory log positions until the COMMIT |
3986 |
my_b_seek(cur_log,rli->event_relay_log_pos); |
|
973.135.1
by sasha at sashanet
reckless slave option |
3987 |
/* otherwise, we have had a partial read */
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3988 |
errmsg = "Aborting slave SQL thread because of partial event read"; |
|
2181.142.1
by grog at lemis
slave.cc: |
3989 |
break; // To end of function |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3990 |
}
|
3991 |
}
|
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
3992 |
if (!errmsg && global_system_variables.log_warnings) |
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
3993 |
{
|
|
2181.142.1
by grog at lemis
slave.cc: |
3994 |
sql_print_information("Error reading relay log event: %s", |
|
1624.59.12
by monty at mishka
Added options --auto-increment-increment and --auto-increment-offset. |
3995 |
"slave SQL thread was killed"); |
3996 |
DBUG_RETURN(0); |
|
3997 |
}
|
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
3998 |
|
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
3999 |
err:
|
|
1110.10.2
by monty at mysql
Lots of code fixes to the replication code (especially the binary logging and index log file handling) |
4000 |
if (errmsg) |
4001 |
sql_print_error("Error reading relay log event: %s", errmsg); |
|
|
973.26.262
by monty at mysql
removed init_count from IO_CACHE. |
4002 |
DBUG_RETURN(0); |
|
971.2.1
by sasha at sashanet
Here comes a nasty patch, although I am not ready to push it yet. I will |
4003 |
}
|
4004 |
||
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4005 |
/*
|
4006 |
Rotate a relay log (this is used only by FLUSH LOGS; the automatic rotation
|
|
4007 |
because of size is simpler because when we do it we already have all relevant
|
|
|
2181.142.1
by grog at lemis
slave.cc: |
4008 |
locks; here we don't, so this function is mainly taking locks).
|
|
2119.600.1
by petr at mysql
WL#3153 "Split logs". Recommit with post-review fixes |
4009 |
Returns nothing as we cannot catch any error (MYSQL_BIN_LOG::new_file()
|
4010 |
is void).
|
|
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4011 |
*/
|
4012 |
||
|
2476.299.6
by mats at dnsalias
Renaming MASTER_INFO to Master_info in order to follow the coding |
4013 |
void rotate_relay_log(Master_info* mi) |
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4014 |
{
|
4015 |
DBUG_ENTER("rotate_relay_log"); |
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
4016 |
Relay_log_info* rli= &mi->rli; |
|
1346.282.2
by guilhem at mysql
Fix for BUG#791: |
4017 |
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
4018 |
/* We don't lock rli->run_lock. This would lead to deadlocks. */
|
4019 |
pthread_mutex_lock(&mi->run_lock); |
|
4020 |
||
|
2181.142.1
by grog at lemis
slave.cc: |
4021 |
/*
|
|
1346.282.2
by guilhem at mysql
Fix for BUG#791: |
4022 |
We need to test inited because otherwise, new_file() will attempt to lock
|
4023 |
LOCK_log, which may not be inited (if we're not a slave).
|
|
4024 |
*/
|
|
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4025 |
if (!rli->inited) |
4026 |
{
|
|
|
1346.281.1
by monty at mysql
Cleanups |
4027 |
DBUG_PRINT("info", ("rli->inited == 0")); |
|
1346.282.2
by guilhem at mysql
Fix for BUG#791: |
4028 |
goto end; |
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4029 |
}
|
|
1346.281.1
by monty at mysql
Cleanups |
4030 |
|
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4031 |
/* If the relay log is closed, new_file() will do nothing. */
|
|
2119.600.1
by petr at mysql
WL#3153 "Split logs". Recommit with post-review fixes |
4032 |
rli->relay_log.new_file(); |
|
1346.281.1
by monty at mysql
Cleanups |
4033 |
|
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4034 |
/*
|
4035 |
We harvest now, because otherwise BIN_LOG_HEADER_SIZE will not immediately
|
|
4036 |
be counted, so imagine a succession of FLUSH LOGS and assume the slave
|
|
4037 |
threads are started:
|
|
|
1346.281.1
by monty at mysql
Cleanups |
4038 |
relay_log_space decreases by the size of the deleted relay log, but does
|
4039 |
not increase, so flush-after-flush we may become negative, which is wrong.
|
|
4040 |
Even if this will be corrected as soon as a query is replicated on the
|
|
4041 |
slave (because the I/O thread will then call harvest_bytes_written() which
|
|
4042 |
will harvest all these BIN_LOG_HEADER_SIZE we forgot), it may give strange
|
|
4043 |
output in SHOW SLAVE STATUS meanwhile. So we harvest now.
|
|
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4044 |
If the log is closed, then this will just harvest the last writes, probably
|
4045 |
0 as they probably have been harvested.
|
|
4046 |
*/
|
|
4047 |
rli->relay_log.harvest_bytes_written(&rli->log_space_total); |
|
|
1346.282.2
by guilhem at mysql
Fix for BUG#791: |
4048 |
end:
|
|
1624.9.1
by guilhem at gbichot2
This will be pushed only after I fix the testsuite. |
4049 |
pthread_mutex_unlock(&mi->run_lock); |
|
1346.276.1
by guilhem at mysql
WL#912 (more user control on relay logs): |
4050 |
DBUG_VOID_RETURN; |
4051 |
}
|
|
4052 |
||
|
855.3.1
by sasha at sashanet
cleanup |
4053 |
|
|
1810.2606.1
by guilhem at gbichot3
Fix for BUG#24432 |
4054 |
/**
|
4055 |
Detects, based on master's version (as found in the relay log), if master
|
|
4056 |
has a certain bug.
|
|
|
2476.299.5
by mats at dnsalias
Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards |
4057 |
@param rli Relay_log_info which tells the master's version
|
|
1810.2606.1
by guilhem at gbichot3
Fix for BUG#24432 |
4058 |
@param bug_id Number of the bug as found in bugs.mysql.com
|
|
2512.39.1
by hezx at hezx
BUG#33029 5.0 to 5.1 replication fails on dup key when inserting |
4059 |
@param report bool report error message, default TRUE
|
|
1810.2606.1
by guilhem at gbichot3
Fix for BUG#24432 |
4060 |
@return TRUE if master has the bug, FALSE if it does not.
|
4061 |
*/
|
|
|
2512.39.1
by hezx at hezx
BUG#33029 5.0 to 5.1 replication fails on dup key when inserting |
4062 |
bool rpl_master_has_bug(Relay_log_info *rli, uint bug_id, bool report) |
|
1810.2606.1
by guilhem at gbichot3
Fix for BUG#24432 |
4063 |
{
|
4064 |
struct st_version_range_for_one_bug { |
|
4065 |
uint bug_id; |
|
4066 |
const uchar introduced_in[3]; // first version with bug |
|
4067 |
const uchar fixed_in[3]; // first version with fix |
|
4068 |
};
|
|
4069 |
static struct st_version_range_for_one_bug versions_for_all_bugs[]= |
|
4070 |
{
|
|
|
1810.2605.6
by gbichot at mysql
the fix for BUG#24432 |
4071 |
{24432, { 5, 0, 24 }, { 5, 0, 38 } }, |
|
2512.39.1
by hezx at hezx
BUG#33029 5.0 to 5.1 replication fails on dup key when inserting |
4072 |
{24432, { 5, 1, 12 }, { 5, 1, 17 } }, |
4073 |
{33029, { 5, 0, 0 }, { 5, 0, 58 } }, |
|
4074 |
{33029, { 5, 1, 0 }, { 5, 1, 12 } }, |
|
|
1810.2606.1
by guilhem at gbichot3
Fix for BUG#24432 |
4075 |
};
|
4076 |
const uchar *master_ver= |
|
4077 |
rli->relay_log.description_event_for_exec->server_version_split; |
|
4078 |
||
4079 |
DBUG_ASSERT(sizeof(rli->relay_log.description_event_for_exec->server_version_split) == 3); |
|
4080 |
||
4081 |
for (uint i= 0; |
|
4082 |
i < sizeof(versions_for_all_bugs)/sizeof(*versions_for_all_bugs);i++) |
|
4083 |
{
|
|
4084 |
const uchar *introduced_in= versions_for_all_bugs[i].introduced_in, |
|
4085 |
*fixed_in= versions_for_all_bugs[i].fixed_in; |
|
4086 |
if ((versions_for_all_bugs[i].bug_id == bug_id) && |
|
4087 |
(memcmp(introduced_in, master_ver, 3) <= 0) && |
|
4088 |
(memcmp(fixed_in, master_ver, 3) > 0)) |
|
4089 |
{
|
|
|
2512.39.1
by hezx at hezx
BUG#33029 5.0 to 5.1 replication fails on dup key when inserting |
4090 |
if (!report) |
4091 |
return TRUE; |
|
4092 |
||
|
1810.2606.1
by guilhem at gbichot3
Fix for BUG#24432 |
4093 |
// a short message for SHOW SLAVE STATUS (message length constraints)
|
4094 |
my_printf_error(ER_UNKNOWN_ERROR, "master may suffer from" |
|
4095 |
" http://bugs.mysql.com/bug.php?id=%u"
|
|
4096 |
" so slave stops; check error log on slave"
|
|
4097 |
" for more info", MYF(0), bug_id); |
|
|
2390.24.4
by guilhem at gbichot3
Manual merge from 5.0-rpl, of fixes for: |
4098 |
// a verbose message for the error log
|
|
2476.106.18
by mats at dnsalias
BUG#24954 (Last_errno and Last_error not set after master_retry_count has |
4099 |
rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR, |
4100 |
"According to the master's version ('%s'),"
|
|
4101 |
" it is probable that master suffers from this bug:"
|
|
|
2390.24.4
by guilhem at gbichot3
Manual merge from 5.0-rpl, of fixes for: |
4102 |
" http://bugs.mysql.com/bug.php?id=%u"
|
4103 |
" and thus replicating the current binary log event"
|
|
4104 |
" may make the slave's data become different from the"
|
|
4105 |
" master's data."
|
|
4106 |
" To take no risk, slave refuses to replicate"
|
|
4107 |
" this event and stops."
|
|
4108 |
" We recommend that all updates be stopped on the"
|
|
4109 |
" master and slave, that the data of both be"
|
|
4110 |
" manually synchronized,"
|
|
4111 |
" that master's binary logs be deleted,"
|
|
4112 |
" that master be upgraded to a version at least"
|
|
4113 |
" equal to '%d.%d.%d'. Then replication can be"
|
|
4114 |
" restarted.", |
|
4115 |
rli->relay_log.description_event_for_exec->server_version, |
|
4116 |
bug_id, |
|
4117 |
fixed_in[0], fixed_in[1], fixed_in[2]); |
|
|
1810.2606.1
by guilhem at gbichot3
Fix for BUG#24432 |
4118 |
return TRUE; |
4119 |
}
|
|
4120 |
}
|
|
4121 |
return FALSE; |
|
4122 |
}
|
|
4123 |
||
|
2512.39.1
by hezx at hezx
BUG#33029 5.0 to 5.1 replication fails on dup key when inserting |
4124 |
/**
|
4125 |
BUG#33029, For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12
|
|
4126 |
exclusive, if one statement in a SP generated AUTO_INCREMENT value
|
|
4127 |
by the top statement, all statements after it would be considered
|
|
4128 |
generated AUTO_INCREMENT value by the top statement, and a
|
|
4129 |
erroneous INSERT_ID value might be associated with these statement,
|
|
4130 |
which could cause duplicate entry error and stop the slave.
|
|
4131 |
||
4132 |
Detect buggy master to work around.
|
|
4133 |
*/
|
|
4134 |
bool rpl_master_erroneous_autoinc(THD *thd) |
|
4135 |
{
|
|
4136 |
if (active_mi && active_mi->rli.sql_thd == thd) |
|
4137 |
{
|
|
4138 |
Relay_log_info *rli= &active_mi->rli; |
|
|
2646.3.1
by Andrei Elkin
Bug#36443 Server crashes when executing insert when insert trigger on table |
4139 |
DBUG_EXECUTE_IF("simulate_bug33029", return TRUE;); |
|
2512.39.1
by hezx at hezx
BUG#33029 5.0 to 5.1 replication fails on dup key when inserting |
4140 |
return rpl_master_has_bug(rli, 33029, FALSE); |
4141 |
}
|
|
4142 |
return FALSE; |
|
4143 |
}
|
|
4144 |
||
|
1810.211.1
by svoj at mysql
WL#2286 - Compile MySQL w/YASSL support |
4145 |
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
|
|
2
by bk at mysql
Import changeset |
4146 |
template class I_List_iterator<i_string>; |
|
217.1.3
by sasha at sashanet
sql/slave.cc |
4147 |
template class I_List_iterator<i_string_pair>; |
|
2
by bk at mysql
Import changeset |
4148 |
#endif
|
|
1388.15.2
by hf at r18
Big purge about embedded library (scrum) |
4149 |
|
|
2476.768.1
by sven at riska
BUG#32407: Impossible to do point-in-time recovery from older binlog |
4150 |
/**
|
4151 |
@} (end of group Replication)
|
|
4152 |
*/
|
|
4153 |
||
|
1409
by hf at r18
SCRUM |
4154 |
#endif /* HAVE_REPLICATION */ |