Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e5428b2f
Commit
e5428b2f
authored
May 28, 2003
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Lots of conflicts resolved
parents
7df5635f
7a7e0e15
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
2493 additions
and
3705 deletions
+2493
-3705
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
libmysql/libmysql.c
libmysql/libmysql.c
+95
-2287
libmysqld/Makefile.am
libmysqld/Makefile.am
+4
-4
sql-common/client.c
sql-common/client.c
+2299
-0
sql/mini_client.cc
sql/mini_client.cc
+6
-1329
sql/mini_client.h
sql/mini_client.h
+26
-24
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+34
-33
sql/slave.cc
sql/slave.cc
+28
-28
No files found.
BitKeeper/etc/logging_ok
View file @
e5428b2f
...
@@ -29,6 +29,7 @@ heikki@rescue.
...
@@ -29,6 +29,7 @@ heikki@rescue.
heikki@work.mysql.com
heikki@work.mysql.com
hf@bison.(none)
hf@bison.(none)
hf@bisonxp.(none)
hf@bisonxp.(none)
hf@deer.(none)
hf@deer.mysql.r18.ru
hf@deer.mysql.r18.ru
hf@genie.(none)
hf@genie.(none)
igor@hundin.mysql.fi
igor@hundin.mysql.fi
...
...
libmysql/libmysql.c
View file @
e5428b2f
This diff is collapsed.
Click to expand it.
libmysqld/Makefile.am
View file @
e5428b2f
...
@@ -43,14 +43,14 @@ sqlsources = derror.cc field.cc field_conv.cc filesort.cc \
...
@@ -43,14 +43,14 @@ sqlsources = derror.cc field.cc field_conv.cc filesort.cc \
item.cc item_buff.cc item_cmpfunc.cc item_create.cc
\
item.cc item_buff.cc item_cmpfunc.cc item_create.cc
\
item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc
\
item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc
\
item_uniq.cc item_subselect.cc item_row.cc
\
item_uniq.cc item_subselect.cc item_row.cc
\
key.cc lock.cc log.cc log_event.cc
mf_iocache.cc
\
key.cc lock.cc log.cc log_event.cc
\
mini_client.cc
protocol.cc net_serv.cc opt_ft.cc opt_range.cc
\
protocol.cc net_serv.cc opt_ft.cc opt_range.cc
\
opt_sum.cc procedure.cc records.cc sql_acl.cc
\
opt_sum.cc procedure.cc records.cc sql_acl.cc
\
repl_failsafe.cc slave.cc
sql_load.cc sql_olap.cc
\
sql_load.cc sql_olap.cc
\
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc
\
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc
\
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc
\
sql_crypt.cc sql_db.cc sql_delete.cc sql_error.cc sql_insert.cc
\
sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc
\
sql_lex.cc sql_list.cc sql_manager.cc sql_map.cc sql_parse.cc
\
sql_prepare.cc sql_derived.cc sql_rename.cc
sql_repl.cc
\
sql_prepare.cc sql_derived.cc sql_rename.cc
\
sql_select.cc sql_do.cc sql_show.cc set_var.cc
\
sql_select.cc sql_do.cc sql_show.cc set_var.cc
\
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc
\
sql_string.cc sql_table.cc sql_test.cc sql_udf.cc
\
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc
\
sql_update.cc sql_yacc.cc table.cc thr_malloc.cc time.cc
\
...
...
sql-common/client.c
0 → 100644
View file @
e5428b2f
This diff is collapsed.
Click to expand it.
sql/mini_client.cc
View file @
e5428b2f
This diff is collapsed.
Click to expand it.
sql/mini_client.h
View file @
e5428b2f
...
@@ -17,30 +17,32 @@
...
@@ -17,30 +17,32 @@
#ifndef _MINI_CLIENT_H
#ifndef _MINI_CLIENT_H
#define _MINI_CLIENT_H
#define _MINI_CLIENT_H
MYSQL
*
MYSQL
*
mc_mysq
l_connect
(
MYSQL
*
mysql
,
const
char
*
host
,
const
char
*
user
,
mysql_rea
l_connect
(
MYSQL
*
mysql
,
const
char
*
host
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
db
,
const
char
*
passwd
,
const
char
*
db
,
uint
port
,
const
char
*
unix_socket
,
uint
client_flag
,
uint
port
,
const
char
*
unix_socket
,
ulong
client_flag
,
uint
net_read_timeout
);
uint
net_read_timeout
);
int
mc_simple_command
(
MYSQL
*
mysql
,
enum
enum_server_command
command
,
const
char
*
arg
,
uint
length
,
my_bool
skipp_check
);
my_bool
simple_command
(
MYSQL
*
mysql
,
enum
enum_server_command
command
,
void
mc_mysql_close
(
MYSQL
*
mysql
);
const
char
*
arg
,
unsigned
long
length
,
MYSQL
*
mc_mysql_init
(
MYSQL
*
mysql
);
my_bool
skip_check
);
void
mc_mysql_debug
(
const
char
*
debug
);
void
mysql_close
(
MYSQL
*
mysql
);
ulong
mc_net_safe_read
(
MYSQL
*
mysql
);
MYSQL
*
mysql_init
(
MYSQL
*
mysql
);
char
*
mc_mysql_error
(
MYSQL
*
mysql
);
void
mysql_debug
(
const
char
*
debug
);
int
mc_mysql_errno
(
MYSQL
*
mysql
);
ulong
net_safe_read
(
MYSQL
*
mysql
);
my_bool
mc_mysql_reconnect
(
MYSQL
*
mysql
);
const
char
*
mysql_error
(
MYSQL
*
mysql
);
int
mc_mysql_send_query
(
MYSQL
*
mysql
,
const
char
*
query
,
uint
length
);
unsigned
int
mysql_errno
(
MYSQL
*
mysql
);
int
mc_mysql_read_query_result
(
MYSQL
*
mysql
);
my_bool
mysql_reconnect
(
MYSQL
*
mysql
);
int
mc_mysql_query
(
MYSQL
*
mysql
,
const
char
*
query
,
uint
length
);
int
mysql_send_query
(
MYSQL
*
mysql
,
const
char
*
query
,
uint
length
);
MYSQL_RES
*
mc_mysql_store_result
(
MYSQL
*
mysql
);
my_bool
mysql_read_query_result
(
MYSQL
*
mysql
);
void
mc_mysql_free_result
(
MYSQL_RES
*
result
);
int
mysql_real_query
(
MYSQL
*
mysql
,
const
char
*
q
,
unsigned
long
length
);
void
mc_mysql_data_seek
(
MYSQL_RES
*
result
,
my_ulonglong
row
);
MYSQL_RES
*
mysql_store_result
(
MYSQL
*
mysql
);
my_ulonglong
mc_mysql_num_rows
(
MYSQL_RES
*
res
);
void
mysql_free_result
(
MYSQL_RES
*
result
);
unsigned
int
mc_mysql_num_fields
(
MYSQL_RES
*
res
);
void
mysql_data_seek
(
MYSQL_RES
*
result
,
my_ulonglong
row
);
MYSQL_ROW
STDCALL
mc_mysql_fetch_row
(
MYSQL_RES
*
res
);
my_ulonglong
mysql_num_rows
(
MYSQL_RES
*
res
);
int
mc_mysql_select_db
(
MYSQL
*
mysql
,
const
char
*
db
);
unsigned
int
mysql_num_fields
(
MYSQL_RES
*
res
);
void
mc_end_server
(
MYSQL
*
mysql
);
MYSQL_ROW
STDCALL
mysql_fetch_row
(
MYSQL_RES
*
res
);
int
mysql_select_db
(
MYSQL
*
mysql
,
const
char
*
db
);
void
end_server
(
MYSQL
*
mysql
);
#endif
#endif
sql/repl_failsafe.cc
View file @
e5428b2f
...
@@ -484,14 +484,15 @@ int update_slave_list(MYSQL* mysql, MASTER_INFO* mi)
...
@@ -484,14 +484,15 @@ int update_slave_list(MYSQL* mysql, MASTER_INFO* mi)
int
port_ind
;
int
port_ind
;
DBUG_ENTER
(
"update_slave_list"
);
DBUG_ENTER
(
"update_slave_list"
);
if
(
mc_mysql_query
(
mysql
,
"SHOW SLAVE HOSTS"
,
16
)
||
!
(
res
=
mc_mysql_store_result
(
mysql
)))
if
(
mysql_real_query
(
mysql
,
"SHOW SLAVE HOSTS"
,
16
)
||
!
(
res
=
mysql_store_result
(
mysql
)))
{
{
error
=
m
c_m
ysql_error
(
mysql
);
error
=
mysql_error
(
mysql
);
goto
err
;
goto
err
;
}
}
switch
(
m
c_m
ysql_num_fields
(
res
))
{
switch
(
mysql_num_fields
(
res
))
{
case
5
:
case
5
:
have_auth_info
=
0
;
have_auth_info
=
0
;
port_ind
=
2
;
port_ind
=
2
;
...
@@ -508,7 +509,7 @@ HOSTS";
...
@@ -508,7 +509,7 @@ HOSTS";
pthread_mutex_lock
(
&
LOCK_slave_list
);
pthread_mutex_lock
(
&
LOCK_slave_list
);
while
((
row
=
m
c_m
ysql_fetch_row
(
res
)))
while
((
row
=
mysql_fetch_row
(
res
)))
{
{
uint32
server_id
;
uint32
server_id
;
SLAVE_INFO
*
si
,
*
old_si
;
SLAVE_INFO
*
si
,
*
old_si
;
...
@@ -541,7 +542,7 @@ HOSTS";
...
@@ -541,7 +542,7 @@ HOSTS";
err:
err:
if
(
res
)
if
(
res
)
m
c_m
ysql_free_result
(
res
);
mysql_free_result
(
res
);
if
(
error
)
if
(
error
)
{
{
sql_print_error
(
"While trying to obtain the list of slaves from the master \
sql_print_error
(
"While trying to obtain the list of slaves from the master \
...
@@ -566,7 +567,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
...
@@ -566,7 +567,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
thd
->
thread_stack
=
(
char
*
)
&
thd
;
thd
->
thread_stack
=
(
char
*
)
&
thd
;
MYSQL
*
recovery_captain
=
0
;
MYSQL
*
recovery_captain
=
0
;
pthread_detach_this_thread
();
pthread_detach_this_thread
();
if
(
init_failsafe_rpl_thread
(
thd
)
||
!
(
recovery_captain
=
m
c_m
ysql_init
(
0
)))
if
(
init_failsafe_rpl_thread
(
thd
)
||
!
(
recovery_captain
=
mysql_init
(
0
)))
{
{
sql_print_error
(
"Could not initialize failsafe replication thread"
);
sql_print_error
(
"Could not initialize failsafe replication thread"
);
goto
err
;
goto
err
;
...
@@ -599,7 +600,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
...
@@ -599,7 +600,7 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
pthread_mutex_unlock
(
&
LOCK_rpl_status
);
pthread_mutex_unlock
(
&
LOCK_rpl_status
);
err:
err:
if
(
recovery_captain
)
if
(
recovery_captain
)
m
c_m
ysql_close
(
recovery_captain
);
mysql_close
(
recovery_captain
);
delete
thd
;
delete
thd
;
my_thread_end
();
my_thread_end
();
pthread_exit
(
0
);
pthread_exit
(
0
);
...
@@ -668,7 +669,7 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
...
@@ -668,7 +669,7 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
strmov
(
mysql
->
net
.
last_error
,
"Master is not configured"
);
strmov
(
mysql
->
net
.
last_error
,
"Master is not configured"
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
!
m
c_mysq
l_connect
(
mysql
,
mi
->
host
,
mi
->
user
,
mi
->
password
,
0
,
if
(
!
m
ysql_rea
l_connect
(
mysql
,
mi
->
host
,
mi
->
user
,
mi
->
password
,
0
,
mi
->
port
,
0
,
0
,
mi
->
port
,
0
,
0
,
slave_net_timeout
))
slave_net_timeout
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
...
@@ -682,9 +683,9 @@ static inline void cleanup_mysql_results(MYSQL_RES* db_res,
...
@@ -682,9 +683,9 @@ static inline void cleanup_mysql_results(MYSQL_RES* db_res,
for
(;
cur
>=
start
;
--
cur
)
for
(;
cur
>=
start
;
--
cur
)
{
{
if
(
*
cur
)
if
(
*
cur
)
m
c_m
ysql_free_result
(
*
cur
);
mysql_free_result
(
*
cur
);
}
}
m
c_m
ysql_free_result
(
db_res
);
mysql_free_result
(
db_res
);
}
}
...
@@ -692,8 +693,8 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
...
@@ -692,8 +693,8 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
MYSQL_RES
*
table_res
,
MASTER_INFO
*
mi
)
MYSQL_RES
*
table_res
,
MASTER_INFO
*
mi
)
{
{
MYSQL_ROW
row
;
MYSQL_ROW
row
;
for
(
row
=
m
c_m
ysql_fetch_row
(
table_res
);
row
;
for
(
row
=
mysql_fetch_row
(
table_res
);
row
;
row
=
m
c_m
ysql_fetch_row
(
table_res
))
row
=
mysql_fetch_row
(
table_res
))
{
{
TABLE_LIST
table
;
TABLE_LIST
table
;
const
char
*
table_name
=
row
[
0
];
const
char
*
table_name
=
row
[
0
];
...
@@ -727,7 +728,7 @@ int load_master_data(THD* thd)
...
@@ -727,7 +728,7 @@ int load_master_data(THD* thd)
int
error
=
0
;
int
error
=
0
;
const
char
*
errmsg
=
0
;
const
char
*
errmsg
=
0
;
int
restart_thread_mask
;
int
restart_thread_mask
;
m
c_m
ysql_init
(
&
mysql
);
mysql_init
(
&
mysql
);
/*
/*
We do not want anyone messing with the slave at all for the entire
We do not want anyone messing with the slave at all for the entire
...
@@ -749,7 +750,7 @@ int load_master_data(THD* thd)
...
@@ -749,7 +750,7 @@ int load_master_data(THD* thd)
if
(
connect_to_master
(
thd
,
&
mysql
,
active_mi
))
if
(
connect_to_master
(
thd
,
&
mysql
,
active_mi
))
{
{
net_printf
(
thd
,
error
=
ER_CONNECT_TO_MASTER
,
net_printf
(
thd
,
error
=
ER_CONNECT_TO_MASTER
,
m
c_m
ysql_error
(
&
mysql
));
mysql_error
(
&
mysql
));
goto
err
;
goto
err
;
}
}
...
@@ -758,15 +759,15 @@ int load_master_data(THD* thd)
...
@@ -758,15 +759,15 @@ int load_master_data(THD* thd)
MYSQL_RES
*
db_res
,
**
table_res
,
**
table_res_end
,
**
cur_table_res
;
MYSQL_RES
*
db_res
,
**
table_res
,
**
table_res_end
,
**
cur_table_res
;
uint
num_dbs
;
uint
num_dbs
;
if
(
m
c_mysq
l_query
(
&
mysql
,
"SHOW DATABASES"
,
14
)
||
if
(
m
ysql_rea
l_query
(
&
mysql
,
"SHOW DATABASES"
,
14
)
||
!
(
db_res
=
m
c_m
ysql_store_result
(
&
mysql
)))
!
(
db_res
=
mysql_store_result
(
&
mysql
)))
{
{
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
m
c_m
ysql_error
(
&
mysql
));
mysql_error
(
&
mysql
));
goto
err
;
goto
err
;
}
}
if
(
!
(
num_dbs
=
(
uint
)
m
c_m
ysql_num_rows
(
db_res
)))
if
(
!
(
num_dbs
=
(
uint
)
mysql_num_rows
(
db_res
)))
goto
err
;
goto
err
;
/*
/*
In theory, the master could have no databases at all
In theory, the master could have no databases at all
...
@@ -785,12 +786,12 @@ int load_master_data(THD* thd)
...
@@ -785,12 +786,12 @@ int load_master_data(THD* thd)
we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
can to minimize the lock time.
can to minimize the lock time.
*/
*/
if
(
m
c_mysq
l_query
(
&
mysql
,
"FLUSH TABLES WITH READ LOCK"
,
27
)
||
if
(
m
ysql_rea
l_query
(
&
mysql
,
"FLUSH TABLES WITH READ LOCK"
,
27
)
||
m
c_mysq
l_query
(
&
mysql
,
"SHOW MASTER STATUS"
,
18
)
||
m
ysql_rea
l_query
(
&
mysql
,
"SHOW MASTER STATUS"
,
18
)
||
!
(
master_status_res
=
m
c_m
ysql_store_result
(
&
mysql
)))
!
(
master_status_res
=
mysql_store_result
(
&
mysql
)))
{
{
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
m
c_m
ysql_error
(
&
mysql
));
mysql_error
(
&
mysql
));
goto
err
;
goto
err
;
}
}
...
@@ -805,7 +806,7 @@ int load_master_data(THD* thd)
...
@@ -805,7 +806,7 @@ int load_master_data(THD* thd)
cur_table_res
++
)
cur_table_res
++
)
{
{
// since we know how many rows we have, this can never be NULL
// since we know how many rows we have, this can never be NULL
MYSQL_ROW
row
=
m
c_m
ysql_fetch_row
(
db_res
);
MYSQL_ROW
row
=
mysql_fetch_row
(
db_res
);
char
*
db
=
row
[
0
];
char
*
db
=
row
[
0
];
/*
/*
...
@@ -834,12 +835,12 @@ int load_master_data(THD* thd)
...
@@ -834,12 +835,12 @@ int load_master_data(THD* thd)
goto
err
;
goto
err
;
}
}
if
(
m
c_m
ysql_select_db
(
&
mysql
,
db
)
||
if
(
mysql_select_db
(
&
mysql
,
db
)
||
m
c_mysq
l_query
(
&
mysql
,
"SHOW TABLES"
,
11
)
||
m
ysql_rea
l_query
(
&
mysql
,
"SHOW TABLES"
,
11
)
||
!
(
*
cur_table_res
=
m
c_m
ysql_store_result
(
&
mysql
)))
!
(
*
cur_table_res
=
mysql_store_result
(
&
mysql
)))
{
{
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
m
c_m
ysql_error
(
&
mysql
));
mysql_error
(
&
mysql
));
cleanup_mysql_results
(
db_res
,
cur_table_res
-
1
,
table_res
);
cleanup_mysql_results
(
db_res
,
cur_table_res
-
1
,
table_res
);
goto
err
;
goto
err
;
}
}
...
@@ -857,7 +858,7 @@ int load_master_data(THD* thd)
...
@@ -857,7 +858,7 @@ int load_master_data(THD* thd)
// adjust position in the master
// adjust position in the master
if
(
master_status_res
)
if
(
master_status_res
)
{
{
MYSQL_ROW
row
=
m
c_m
ysql_fetch_row
(
master_status_res
);
MYSQL_ROW
row
=
mysql_fetch_row
(
master_status_res
);
/*
/*
We need this check because the master may not be running with
We need this check because the master may not be running with
...
@@ -875,13 +876,13 @@ int load_master_data(THD* thd)
...
@@ -875,13 +876,13 @@ int load_master_data(THD* thd)
active_mi
->
master_log_pos
=
BIN_LOG_HEADER_SIZE
;
active_mi
->
master_log_pos
=
BIN_LOG_HEADER_SIZE
;
flush_master_info
(
active_mi
);
flush_master_info
(
active_mi
);
}
}
m
c_m
ysql_free_result
(
master_status_res
);
mysql_free_result
(
master_status_res
);
}
}
if
(
m
c_mysq
l_query
(
&
mysql
,
"UNLOCK TABLES"
,
13
))
if
(
m
ysql_rea
l_query
(
&
mysql
,
"UNLOCK TABLES"
,
13
))
{
{
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
net_printf
(
thd
,
error
=
ER_QUERY_ON_MASTER
,
m
c_m
ysql_error
(
&
mysql
));
mysql_error
(
&
mysql
));
goto
err
;
goto
err
;
}
}
}
}
...
@@ -920,7 +921,7 @@ err:
...
@@ -920,7 +921,7 @@ err:
UNLOCK_ACTIVE_MI
;
UNLOCK_ACTIVE_MI
;
thd
->
proc_info
=
0
;
thd
->
proc_info
=
0
;
m
c_mysql_close
(
&
mysql
);
// safe to call since we always do mc_
mysql_init()
m
ysql_close
(
&
mysql
);
// safe to call since we always do
mysql_init()
if
(
!
error
)
if
(
!
error
)
send_ok
(
thd
);
send_ok
(
thd
);
...
...
sql/slave.cc
View file @
e5428b2f
...
@@ -1164,15 +1164,15 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
...
@@ -1164,15 +1164,15 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
if
(
!
called_connected
)
if
(
!
called_connected
)
{
{
if
(
!
(
mysql
=
m
c_m
ysql_init
(
NULL
)))
if
(
!
(
mysql
=
mysql_init
(
NULL
)))
{
{
send_error
(
thd
);
// EOM
send_error
(
thd
);
// EOM
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
connect_to_master
(
thd
,
mysql
,
mi
))
if
(
connect_to_master
(
thd
,
mysql
,
mi
))
{
{
net_printf
(
thd
,
ER_CONNECT_TO_MASTER
,
m
c_m
ysql_error
(
mysql
));
net_printf
(
thd
,
ER_CONNECT_TO_MASTER
,
mysql_error
(
mysql
));
m
c_m
ysql_close
(
mysql
);
mysql_close
(
mysql
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
thd
->
killed
)
if
(
thd
->
killed
)
...
@@ -1193,7 +1193,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
...
@@ -1193,7 +1193,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
err:
err:
thd
->
net
.
no_send_ok
=
0
;
// Clear up garbage after create_table_from_dump
thd
->
net
.
no_send_ok
=
0
;
// Clear up garbage after create_table_from_dump
if
(
!
called_connected
)
if
(
!
called_connected
)
m
c_m
ysql_close
(
mysql
);
mysql_close
(
mysql
);
if
(
errmsg
&&
thd
->
net
.
vio
)
if
(
errmsg
&&
thd
->
net
.
vio
)
send_error
(
thd
,
error
,
errmsg
);
send_error
(
thd
,
error
,
errmsg
);
DBUG_RETURN
(
test
(
error
));
// Return 1 on error
DBUG_RETURN
(
test
(
error
));
// Return 1 on error
...
@@ -1560,12 +1560,12 @@ int register_slave_on_master(MYSQL* mysql)
...
@@ -1560,12 +1560,12 @@ int register_slave_on_master(MYSQL* mysql)
/* The master will fill in master_id */
/* The master will fill in master_id */
int4store
(
pos
,
0
);
pos
+=
4
;
int4store
(
pos
,
0
);
pos
+=
4
;
if
(
mc_
simple_command
(
mysql
,
COM_REGISTER_SLAVE
,
(
char
*
)
buf
,
if
(
simple_command
(
mysql
,
COM_REGISTER_SLAVE
,
(
char
*
)
buf
,
(
uint
)
(
pos
-
buf
),
0
))
(
uint
)
(
pos
-
buf
),
0
))
{
{
sql_print_error
(
"Error on COM_REGISTER_SLAVE: %d '%s'"
,
sql_print_error
(
"Error on COM_REGISTER_SLAVE: %d '%s'"
,
m
c_m
ysql_errno
(
mysql
),
mysql_errno
(
mysql
),
m
c_m
ysql_error
(
mysql
));
mysql_error
(
mysql
));
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -1959,18 +1959,18 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
...
@@ -1959,18 +1959,18 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
int4store
(
buf
+
6
,
server_id
);
int4store
(
buf
+
6
,
server_id
);
len
=
(
uint
)
strlen
(
logname
);
len
=
(
uint
)
strlen
(
logname
);
memcpy
(
buf
+
10
,
logname
,
len
);
memcpy
(
buf
+
10
,
logname
,
len
);
if
(
mc_
simple_command
(
mysql
,
COM_BINLOG_DUMP
,
buf
,
len
+
10
,
1
))
if
(
simple_command
(
mysql
,
COM_BINLOG_DUMP
,
buf
,
len
+
10
,
1
))
{
{
/*
/*
Something went wrong, so we will just reconnect and retry later
Something went wrong, so we will just reconnect and retry later
in the future, we should do a better error analysis, but for
in the future, we should do a better error analysis, but for
now we just fill up the error log :-)
now we just fill up the error log :-)
*/
*/
if
(
m
c_m
ysql_errno
(
mysql
)
==
ER_NET_READ_INTERRUPTED
)
if
(
mysql_errno
(
mysql
)
==
ER_NET_READ_INTERRUPTED
)
*
suppress_warnings
=
1
;
// Suppress reconnect warning
*
suppress_warnings
=
1
;
// Suppress reconnect warning
else
else
sql_print_error
(
"Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs"
,
sql_print_error
(
"Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs"
,
m
c_mysql_errno
(
mysql
),
mc_
mysql_error
(
mysql
),
m
ysql_errno
(
mysql
),
mysql_error
(
mysql
),
master_connect_retry
);
master_connect_retry
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
...
@@ -1997,7 +1997,7 @@ static int request_table_dump(MYSQL* mysql, const char* db, const char* table)
...
@@ -1997,7 +1997,7 @@ static int request_table_dump(MYSQL* mysql, const char* db, const char* table)
*
p
++
=
table_len
;
*
p
++
=
table_len
;
memcpy
(
p
,
table
,
table_len
);
memcpy
(
p
,
table
,
table_len
);
if
(
mc_
simple_command
(
mysql
,
COM_TABLE_DUMP
,
buf
,
p
-
buf
+
table_len
,
1
))
if
(
simple_command
(
mysql
,
COM_TABLE_DUMP
,
buf
,
p
-
buf
+
table_len
,
1
))
{
{
sql_print_error
(
"request_table_dump: Error sending the table dump \
sql_print_error
(
"request_table_dump: Error sending the table dump \
command"
);
command"
);
...
@@ -2041,10 +2041,10 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
...
@@ -2041,10 +2041,10 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
return
packet_error
;
return
packet_error
;
#endif
#endif
len
=
mc_
net_safe_read
(
mysql
);
len
=
net_safe_read
(
mysql
);
if
(
len
==
packet_error
||
(
long
)
len
<
1
)
if
(
len
==
packet_error
||
(
long
)
len
<
1
)
{
{
if
(
m
c_m
ysql_errno
(
mysql
)
==
ER_NET_READ_INTERRUPTED
)
if
(
mysql_errno
(
mysql
)
==
ER_NET_READ_INTERRUPTED
)
{
{
/*
/*
We are trying a normal reconnect after a read timeout;
We are trying a normal reconnect after a read timeout;
...
@@ -2056,7 +2056,7 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
...
@@ -2056,7 +2056,7 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings)
else
else
sql_print_error
(
"Error reading packet from server: %s (\
sql_print_error
(
"Error reading packet from server: %s (\
server_errno=%d)"
,
server_errno=%d)"
,
m
c_mysql_error
(
mysql
),
mc_
mysql_errno
(
mysql
));
m
ysql_error
(
mysql
),
mysql_errno
(
mysql
));
return
packet_error
;
return
packet_error
;
}
}
...
@@ -2064,7 +2064,7 @@ server_errno=%d)",
...
@@ -2064,7 +2064,7 @@ server_errno=%d)",
{
{
sql_print_error
(
"Slave: received 0 length packet from server, apparent\
sql_print_error
(
"Slave: received 0 length packet from server, apparent\
master shutdown: %s"
,
master shutdown: %s"
,
m
c_m
ysql_error
(
mysql
));
mysql_error
(
mysql
));
return
packet_error
;
return
packet_error
;
}
}
...
@@ -2214,7 +2214,7 @@ slave_begin:
...
@@ -2214,7 +2214,7 @@ slave_begin:
mi
->
master_log_name
,
mi
->
master_log_name
,
llstr
(
mi
->
master_log_pos
,
llbuff
)));
llstr
(
mi
->
master_log_pos
,
llbuff
)));
if
(
!
(
mi
->
mysql
=
mysql
=
m
c_m
ysql_init
(
NULL
)))
if
(
!
(
mi
->
mysql
=
mysql
=
mysql_init
(
NULL
)))
{
{
sql_print_error
(
"Slave I/O thread: error in mc_mysql_init()"
);
sql_print_error
(
"Slave I/O thread: error in mc_mysql_init()"
);
goto
err
;
goto
err
;
...
@@ -2269,7 +2269,7 @@ dump");
...
@@ -2269,7 +2269,7 @@ dump");
}
}
thd
->
proc_info
=
"Waiiting to reconnect after a failed dump request"
;
thd
->
proc_info
=
"Waiiting to reconnect after a failed dump request"
;
mc_
end_server
(
mysql
);
end_server
(
mysql
);
/*
/*
First time retry immediately, assuming that we can recover
First time retry immediately, assuming that we can recover
right away - if first time fails, sleep between re-tries
right away - if first time fails, sleep between re-tries
...
@@ -2319,7 +2319,7 @@ after reconnect");
...
@@ -2319,7 +2319,7 @@ after reconnect");
if
(
event_len
==
packet_error
)
if
(
event_len
==
packet_error
)
{
{
uint
mysql_error_number
=
m
c_m
ysql_errno
(
mysql
);
uint
mysql_error_number
=
mysql_errno
(
mysql
);
if
(
mysql_error_number
==
ER_NET_PACKET_TOO_LARGE
)
if
(
mysql_error_number
==
ER_NET_PACKET_TOO_LARGE
)
{
{
sql_print_error
(
"\
sql_print_error
(
"\
...
@@ -2332,11 +2332,11 @@ max_allowed_packet",
...
@@ -2332,11 +2332,11 @@ max_allowed_packet",
if
(
mysql_error_number
==
ER_MASTER_FATAL_ERROR_READING_BINLOG
)
if
(
mysql_error_number
==
ER_MASTER_FATAL_ERROR_READING_BINLOG
)
{
{
sql_print_error
(
ER
(
mysql_error_number
),
mysql_error_number
,
sql_print_error
(
ER
(
mysql_error_number
),
mysql_error_number
,
m
c_m
ysql_error
(
mysql
));
mysql_error
(
mysql
));
goto
err
;
goto
err
;
}
}
thd
->
proc_info
=
"Waiting to reconnect after a failed read"
;
thd
->
proc_info
=
"Waiting to reconnect after a failed read"
;
mc_
end_server
(
mysql
);
end_server
(
mysql
);
if
(
retry_count
++
)
if
(
retry_count
++
)
{
{
if
(
retry_count
>
master_retry_count
)
if
(
retry_count
>
master_retry_count
)
...
@@ -2406,7 +2406,7 @@ err:
...
@@ -2406,7 +2406,7 @@ err:
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
if
(
mysql
)
if
(
mysql
)
{
{
m
c_m
ysql_close
(
mysql
);
mysql_close
(
mysql
);
mi
->
mysql
=
0
;
mi
->
mysql
=
0
;
}
}
thd
->
proc_info
=
"Waiting for slave mutex on exit"
;
thd
->
proc_info
=
"Waiting for slave mutex on exit"
;
...
@@ -2947,22 +2947,22 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
...
@@ -2947,22 +2947,22 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
client_flag
=
CLIENT_COMPRESS
;
/* We will use compression */
client_flag
=
CLIENT_COMPRESS
;
/* We will use compression */
while
(
!
(
slave_was_killed
=
io_slave_killed
(
thd
,
mi
))
&&
while
(
!
(
slave_was_killed
=
io_slave_killed
(
thd
,
mi
))
&&
(
reconnect
?
m
c_m
ysql_reconnect
(
mysql
)
!=
0
:
(
reconnect
?
mysql_reconnect
(
mysql
)
!=
0
:
!
m
c_mysq
l_connect
(
mysql
,
mi
->
host
,
mi
->
user
,
mi
->
password
,
0
,
!
m
ysql_rea
l_connect
(
mysql
,
mi
->
host
,
mi
->
user
,
mi
->
password
,
0
,
mi
->
port
,
0
,
client_flag
,
mi
->
port
,
0
,
client_flag
,
thd
->
variables
.
net_read_timeout
)))
thd
->
variables
.
net_read_timeout
)))
{
{
/* Don't repeat last error */
/* Don't repeat last error */
if
(
mc_
mysql_errno
(
mysql
)
!=
last_errno
)
if
(
(
int
)
mysql_errno
(
mysql
)
!=
last_errno
)
{
{
last_errno
=
m
c_m
ysql_errno
(
mysql
);
last_errno
=
mysql_errno
(
mysql
);
suppress_warnings
=
0
;
suppress_warnings
=
0
;
sql_print_error
(
"Slave I/O thread: error %s to master \
sql_print_error
(
"Slave I/O thread: error %s to master \
'%s@%s:%d': \
'%s@%s:%d': \
Error: '%s' errno: %d retry-time: %d retries: %d"
,
Error: '%s' errno: %d retry-time: %d retries: %d"
,
(
reconnect
?
"reconnecting"
:
"connecting"
),
(
reconnect
?
"reconnecting"
:
"connecting"
),
mi
->
user
,
mi
->
host
,
mi
->
port
,
mi
->
user
,
mi
->
host
,
mi
->
port
,
m
c_m
ysql_error
(
mysql
),
last_errno
,
mysql_error
(
mysql
),
last_errno
,
mi
->
connect_retry
,
mi
->
connect_retry
,
master_retry_count
);
master_retry_count
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment