merge
This commit is contained in:
commit
510ce83799
@ -236,7 +236,7 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
|
|||||||
{
|
{
|
||||||
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
|
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
|
||||||
safe_cd("${test_dir}/mysql-test");
|
safe_cd("${test_dir}/mysql-test");
|
||||||
check_system("./mysql-test-run --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
|
check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start the server if we are going to run any of the benchmarks
|
# Start the server if we are going to run any of the benchmarks
|
||||||
|
@ -8104,14 +8104,39 @@ dumping core after you upgrade MySQL.
|
|||||||
@node Upgrading-from-3.23, Upgrading-from-3.22, Upgrade, Upgrade
|
@node Upgrading-from-3.23, Upgrading-from-3.22, Upgrade, Upgrade
|
||||||
@subsection Upgrading From Version 3.23 to Version 4.0
|
@subsection Upgrading From Version 3.23 to Version 4.0
|
||||||
|
|
||||||
You can use your old datafiles without any modification with Version 4.0.
|
In general what you have to do when upgrading to 4.0 from an earlier
|
||||||
If you want to move your data from a MySQL 4.0 server to an older server,
|
MySQL version:
|
||||||
you have to use @code{mysqldump}.
|
|
||||||
|
@itemize
|
||||||
|
@item
|
||||||
|
Run the @code{mysql_fix_privilege_tables} to add new privileges and features
|
||||||
|
to the MySQL privilege tables.
|
||||||
|
@item
|
||||||
|
Edit any MySQL startup scripts or configure files to not use any of the
|
||||||
|
deprecated options listed below.
|
||||||
|
@item
|
||||||
|
Convert your old ISAM files to MyISAM files with the command:
|
||||||
|
@code{mysql_convert_table_format database}. Note that this should only
|
||||||
|
be run if all tables in the given database is ISAM or MyISAM tables. If
|
||||||
|
this is not the case you should run @code{ALTER TABLE table_name TYPE=MyISAM}
|
||||||
|
on all ISAM tables.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
|
MySQL 4.0 will work even if you don't do the above, but you will not be
|
||||||
|
able to use the new security privileges that MySQL 4.0 and you may run
|
||||||
|
into problems when upgrading later to MySQL 4.1 or newer. The ISAM file
|
||||||
|
format still works in MySQL 4.0 but it's deprecated and will be disabled
|
||||||
|
in MySQL 5.0.
|
||||||
|
|
||||||
Old clients should work with a Version 4.0 server without any problems.
|
Old clients should work with a Version 4.0 server without any problems.
|
||||||
|
|
||||||
The following lists tell what you have to watch out for when upgrading to
|
Even if you do the above, you can still downgrade to MySQL 3.23.52 or newer
|
||||||
version 4.0;
|
if you run into problems with the MySQL 4.0 series. In this case you have
|
||||||
|
to do a mysqldump of any tables using a fulltext index and restore these
|
||||||
|
in 3.23 (because 4.0 uses a new format for fulltext index).
|
||||||
|
|
||||||
|
The following is a more complete lists tell what you have to watch out
|
||||||
|
for when upgrading to version 4.0;
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
@ -8141,9 +8166,9 @@ before. In particular, you will need @code{REPLICATION SLAVE}
|
|||||||
The startup parameters @code{myisam_max_extra_sort_file_size} and
|
The startup parameters @code{myisam_max_extra_sort_file_size} and
|
||||||
@code{myisam_max_extra_sort_file_size} are now given in bytes
|
@code{myisam_max_extra_sort_file_size} are now given in bytes
|
||||||
(was megabytes before 4.0.3).
|
(was megabytes before 4.0.3).
|
||||||
External system locking of @code{MyISAM}/@code{ISAM} files is now turned
|
External system locking of MyISAM/ISAM files is now turned off by default.
|
||||||
off by default. One can turn this on with @code{--external-locking}.
|
One can turn this on by doing @code{--external-locking}. (For most users
|
||||||
(For most users this is never needed).
|
this is never needed).
|
||||||
@item
|
@item
|
||||||
The following startup variables/options have been renamed:
|
The following startup variables/options have been renamed:
|
||||||
@multitable @columnfractions .50 .50
|
@multitable @columnfractions .50 .50
|
||||||
@ -50271,6 +50296,9 @@ each individual 4.0.x release.
|
|||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
|
Don't increment warnings when setting @code{AUTO_INCREMENT} columns to
|
||||||
|
@code{NULL} in @code{LOAD DATA INFILE}.
|
||||||
|
@item
|
||||||
Fixed all boolean type variables/options to work with the old syntax,
|
Fixed all boolean type variables/options to work with the old syntax,
|
||||||
e.g. all of these work: --lower-case-table-names, --lower-case-table-names=1,
|
e.g. all of these work: --lower-case-table-names, --lower-case-table-names=1,
|
||||||
-O lower-case-table-names=1, --set-variable=lower-case-table-names=1
|
-O lower-case-table-names=1, --set-variable=lower-case-table-names=1
|
||||||
@ -50308,7 +50336,7 @@ Fixed some problems with @code{CREATE TABLE ... SELECT function()}.
|
|||||||
@code{mysqld} now has the option @code{--temp-pool} enabled by default as this
|
@code{mysqld} now has the option @code{--temp-pool} enabled by default as this
|
||||||
gives better performance with some operating systems.
|
gives better performance with some operating systems.
|
||||||
@item
|
@item
|
||||||
Big cleanup in replication code.
|
Big cleanup in replication code (less logging, better error messages, etc..)
|
||||||
@item
|
@item
|
||||||
If the @code{--code-file} option is specified, the server calls
|
If the @code{--code-file} option is specified, the server calls
|
||||||
@code{setrlimit()} to set the maximum allowed core file size to unlimited,
|
@code{setrlimit()} to set the maximum allowed core file size to unlimited,
|
||||||
@ -50344,9 +50372,9 @@ Allow @code{DEFAULT} with @code{INSERT} statement.
|
|||||||
The startup parameters @code{myisam_max_sort_file_size} and
|
The startup parameters @code{myisam_max_sort_file_size} and
|
||||||
@code{myisam_max_extra_sort_file_size} are now given in bytes, not megabytes.
|
@code{myisam_max_extra_sort_file_size} are now given in bytes, not megabytes.
|
||||||
@item
|
@item
|
||||||
External system locking of MyISAM/ISAM files is now turned off by default.
|
External system locking of @code{MyISAM}/@code{ISAM} files is now turned
|
||||||
One can turn this one by doing @code{--external-locking}. (For most users
|
off by default. One can turn this on with @code{--external-locking}.
|
||||||
this is never needed).
|
(For most users this is never needed).
|
||||||
@item
|
@item
|
||||||
Fixed core dump bug with @code{INSERT ... SET db_name.table_name.colname=''}.
|
Fixed core dump bug with @code{INSERT ... SET db_name.table_name.colname=''}.
|
||||||
@item
|
@item
|
||||||
|
@ -1186,7 +1186,7 @@ then
|
|||||||
else
|
else
|
||||||
# CC="$CC -Kthread -DOpenUNIX8";
|
# CC="$CC -Kthread -DOpenUNIX8";
|
||||||
# CXX="$CXX -Kthread -DOpenUNIX8";
|
# CXX="$CXX -Kthread -DOpenUNIX8";
|
||||||
CC="$CC -Kthread -DUNIXWARE_7";
|
CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
|
||||||
CXX="$CXX -Kthread -DUNIXWARE_7";
|
CXX="$CXX -Kthread -DUNIXWARE_7";
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT("yes")
|
AC_MSG_RESULT("yes")
|
||||||
|
@ -487,6 +487,12 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
|
|||||||
|
|
||||||
/* READ-WRITE thread locking */
|
/* READ-WRITE thread locking */
|
||||||
|
|
||||||
|
#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */
|
||||||
|
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
|
||||||
|
#undef HAVE_RWLOCK_INIT
|
||||||
|
#undef HAVE_RWLOCK_T
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
|
#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS)
|
||||||
/* use these defs for simple mutex locking */
|
/* use these defs for simple mutex locking */
|
||||||
#define rw_lock_t pthread_mutex_t
|
#define rw_lock_t pthread_mutex_t
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
#else
|
#else
|
||||||
#define PROTOCOL_VERSION @PROTOCOL_VERSION@
|
#define PROTOCOL_VERSION @PROTOCOL_VERSION@
|
||||||
#define MYSQL_SERVER_VERSION "@VERSION@"
|
#define MYSQL_SERVER_VERSION "@VERSION@"
|
||||||
|
#ifndef MYSQL_SERVER_SUFFIX
|
||||||
#define MYSQL_SERVER_SUFFIX "@MYSQL_SERVER_SUFFIX@"
|
#define MYSQL_SERVER_SUFFIX "@MYSQL_SERVER_SUFFIX@"
|
||||||
|
#endif
|
||||||
#define FRM_VER @DOT_FRM_VERSION@
|
#define FRM_VER @DOT_FRM_VERSION@
|
||||||
#define MYSQL_VERSION_ID @MYSQL_VERSION_ID@
|
#define MYSQL_VERSION_ID @MYSQL_VERSION_ID@
|
||||||
#define MYSQL_PORT @MYSQL_TCP_PORT@
|
#define MYSQL_PORT @MYSQL_TCP_PORT@
|
||||||
|
@ -252,4 +252,5 @@
|
|||||||
#define ER_VAR_CANT_BE_READ 1233
|
#define ER_VAR_CANT_BE_READ 1233
|
||||||
#define ER_CANT_USE_OPTION_HERE 1234
|
#define ER_CANT_USE_OPTION_HERE 1234
|
||||||
#define ER_NOT_SUPPORTED_YET 1235
|
#define ER_NOT_SUPPORTED_YET 1235
|
||||||
#define ER_ERROR_MESSAGES 236
|
#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
|
||||||
|
#define ER_ERROR_MESSAGES 237
|
||||||
|
@ -465,11 +465,7 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
|||||||
if (mysql->net.vio == 0)
|
if (mysql->net.vio == 0)
|
||||||
{ /* Do reconnect if possible */
|
{ /* Do reconnect if possible */
|
||||||
if (mysql_reconnect(mysql))
|
if (mysql_reconnect(mysql))
|
||||||
{
|
|
||||||
net->last_errno=CR_SERVER_GONE_ERROR;
|
|
||||||
strmov(net->last_error,ER(net->last_errno));
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mysql->status != MYSQL_STATUS_READY)
|
if (mysql->status != MYSQL_STATUS_READY)
|
||||||
{
|
{
|
||||||
@ -490,8 +486,9 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
|
DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
|
||||||
end_server(mysql);
|
end_server(mysql);
|
||||||
if (mysql_reconnect(mysql) ||
|
if (mysql_reconnect(mysql))
|
||||||
net_write_command(net,(uchar) command,arg,
|
goto end;
|
||||||
|
if (net_write_command(net,(uchar) command,arg,
|
||||||
length ? length : (ulong) strlen(arg)))
|
length ? length : (ulong) strlen(arg)))
|
||||||
{
|
{
|
||||||
net->last_errno=CR_SERVER_GONE_ERROR;
|
net->last_errno=CR_SERVER_GONE_ERROR;
|
||||||
@ -1136,17 +1133,22 @@ int STDCALL mysql_reads_from_master_enabled(MYSQL* mysql)
|
|||||||
return !(mysql->options.no_master_reads);
|
return !(mysql->options.no_master_reads);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We may get an error while doing replication internals.
|
|
||||||
In this case, we add a special explanation to the original
|
/*
|
||||||
error
|
We may get an error while doing replication internals.
|
||||||
|
In this case, we add a special explanation to the original
|
||||||
|
error
|
||||||
*/
|
*/
|
||||||
static inline void expand_error(MYSQL* mysql, int error)
|
|
||||||
|
static void expand_error(MYSQL* mysql, int error)
|
||||||
{
|
{
|
||||||
char tmp[MYSQL_ERRMSG_SIZE];
|
char tmp[MYSQL_ERRMSG_SIZE];
|
||||||
char* p, *tmp_end;
|
char *p;
|
||||||
tmp_end = strnmov(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE);
|
uint err_length;
|
||||||
p = strnmov(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE);
|
strmake(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE-1);
|
||||||
memcpy(p, tmp, tmp_end - tmp);
|
p = strmake(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE-1);
|
||||||
|
err_length= (uint) (p - mysql->net.last_error);
|
||||||
|
strmake(p, tmp, MYSQL_ERRMSG_SIZE-1 - err_length);
|
||||||
mysql->net.last_errno = error;
|
mysql->net.last_errno = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1155,7 +1157,7 @@ static inline void expand_error(MYSQL* mysql, int error)
|
|||||||
read the given result and row
|
read the given result and row
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline int get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row)
|
static int get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
MYSQL* master;
|
MYSQL* master;
|
||||||
if (mysql_num_fields(res) < 3)
|
if (mysql_num_fields(res) < 3)
|
||||||
@ -1174,7 +1176,7 @@ static inline int get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row)
|
|||||||
retrieve all the slaves
|
retrieve all the slaves
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline int get_slaves_from_master(MYSQL* mysql)
|
static int get_slaves_from_master(MYSQL* mysql)
|
||||||
{
|
{
|
||||||
MYSQL_RES* res = 0;
|
MYSQL_RES* res = 0;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
@ -1239,6 +1241,7 @@ err:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int STDCALL mysql_rpl_probe(MYSQL* mysql)
|
int STDCALL mysql_rpl_probe(MYSQL* mysql)
|
||||||
{
|
{
|
||||||
MYSQL_RES* res = 0;
|
MYSQL_RES* res = 0;
|
||||||
@ -1620,7 +1623,11 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
if (mysql->options.named_pipe ||
|
if (mysql->options.named_pipe ||
|
||||||
(host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
|
(host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) ||
|
||||||
(unix_socket && !strcmp(unix_socket,MYSQL_NAMEDPIPE)))
|
(unix_socket && !strcmp(unix_socket,MYSQL_NAMEDPIPE)))
|
||||||
|
{
|
||||||
|
net->last_errno= CR_SERVER_LOST;
|
||||||
|
strmov(net->last_error,ER(net->last_errno));
|
||||||
goto error; /* User only requested named pipes */
|
goto error; /* User only requested named pipes */
|
||||||
|
}
|
||||||
/* Try also with TCP/IP */
|
/* Try also with TCP/IP */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1669,9 +1676,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
&tmp_errno);
|
&tmp_errno);
|
||||||
if (!hp)
|
if (!hp)
|
||||||
{
|
{
|
||||||
|
my_gethostbyname_r_free();
|
||||||
net->last_errno=CR_UNKNOWN_HOST;
|
net->last_errno=CR_UNKNOWN_HOST;
|
||||||
sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno);
|
sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno);
|
||||||
my_gethostbyname_r_free();
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
|
memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
|
||||||
@ -1853,7 +1860,11 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
if (client_flag & CLIENT_SSL)
|
if (client_flag & CLIENT_SSL)
|
||||||
{
|
{
|
||||||
if (my_net_write(net,buff,(uint) (2)) || net_flush(net))
|
if (my_net_write(net,buff,(uint) (2)) || net_flush(net))
|
||||||
|
{
|
||||||
|
net->last_errno= CR_SERVER_LOST;
|
||||||
|
strmov(net->last_error,ER(net->last_errno));
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
/* Do the SSL layering. */
|
/* Do the SSL layering. */
|
||||||
DBUG_PRINT("info", ("IO layer change in progress..."));
|
DBUG_PRINT("info", ("IO layer change in progress..."));
|
||||||
DBUG_PRINT("info", ("IO context %p",((struct st_VioSSLConnectorFd*)mysql->connector_fd)->ssl_context_));
|
DBUG_PRINT("info", ("IO context %p",((struct st_VioSSLConnectorFd*)mysql->connector_fd)->ssl_context_));
|
||||||
@ -1883,8 +1894,13 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||||
db=0;
|
db=0;
|
||||||
}
|
}
|
||||||
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net) ||
|
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net))
|
||||||
net_safe_read(mysql) == packet_error)
|
{
|
||||||
|
net->last_errno= CR_SERVER_LOST;
|
||||||
|
strmov(net->last_error,ER(net->last_errno));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (net_safe_read(mysql) == packet_error)
|
||||||
goto error;
|
goto error;
|
||||||
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
||||||
net->compress=1;
|
net->compress=1;
|
||||||
@ -1952,6 +1968,8 @@ static my_bool mysql_reconnect(MYSQL *mysql)
|
|||||||
{
|
{
|
||||||
/* Allow reconnect next time */
|
/* Allow reconnect next time */
|
||||||
mysql->server_status&= ~SERVER_STATUS_IN_TRANS;
|
mysql->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
|
mysql->net.last_errno=CR_SERVER_GONE_ERROR;
|
||||||
|
strmov(mysql->net.last_error,ER(mysql->net.last_errno));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
mysql_init(&tmp_mysql);
|
mysql_init(&tmp_mysql);
|
||||||
|
@ -93,7 +93,7 @@ FIND=find
|
|||||||
GCOV=`which gcov | $SED q`
|
GCOV=`which gcov | $SED q`
|
||||||
PRINTF=printf
|
PRINTF=printf
|
||||||
RM=rm
|
RM=rm
|
||||||
TIME=time
|
TIME=`which time | $SED q`
|
||||||
TR=tr
|
TR=tr
|
||||||
XARGS=`which xargs | $SED q`
|
XARGS=`which xargs | $SED q`
|
||||||
|
|
||||||
@ -391,7 +391,12 @@ if [ x$SOURCE_DIST = x1 ] ; then
|
|||||||
CHARSETSDIR="$BASEDIR/sql/share/charsets"
|
CHARSETSDIR="$BASEDIR/sql/share/charsets"
|
||||||
INSTALL_DB="./install_test_db"
|
INSTALL_DB="./install_test_db"
|
||||||
else
|
else
|
||||||
MYSQLD="$BASEDIR/bin/mysqld"
|
if test -x "$BASEDIR/libexec/mysqld"
|
||||||
|
then
|
||||||
|
MYSQLD="$BASEDIR/libexec/mysqld"
|
||||||
|
else
|
||||||
|
MYSQLD="$BASEDIR/bin/mysqld"
|
||||||
|
fi
|
||||||
MYSQL_TEST="$BASEDIR/bin/mysqltest"
|
MYSQL_TEST="$BASEDIR/bin/mysqltest"
|
||||||
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
|
MYSQLADMIN="$BASEDIR/bin/mysqladmin"
|
||||||
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager"
|
MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager"
|
||||||
@ -530,6 +535,18 @@ total_inc () {
|
|||||||
TOT_TEST=`$EXPR $TOT_TEST + 1`
|
TOT_TEST=`$EXPR $TOT_TEST + 1`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
skip_test() {
|
||||||
|
USERT=" ...."
|
||||||
|
SYST=" ...."
|
||||||
|
REALT=" ...."
|
||||||
|
timestr="$USERT $SYST $REALT"
|
||||||
|
pname=`$ECHO "$1 "|$CUT -c 1-24`
|
||||||
|
RES="$pname $timestr"
|
||||||
|
skip_inc
|
||||||
|
$ECHO "$RES$RES_SPACE [ skipped ]"
|
||||||
|
}
|
||||||
|
|
||||||
report_stats () {
|
report_stats () {
|
||||||
if [ $TOT_FAIL = 0 ]; then
|
if [ $TOT_FAIL = 0 ]; then
|
||||||
$ECHO "All $TOT_TEST tests were successful."
|
$ECHO "All $TOT_TEST tests were successful."
|
||||||
@ -567,7 +584,7 @@ mysql_install_db () {
|
|||||||
|
|
||||||
for slave_num in 1 2 ;
|
for slave_num in 1 2 ;
|
||||||
do
|
do
|
||||||
$RM -rf var/slave$slave_num-data/
|
$RM -rf var/slave$slave_num-data
|
||||||
mkdir -p var/slave$slave_num-data/mysql
|
mkdir -p var/slave$slave_num-data/mysql
|
||||||
mkdir -p var/slave$slave_num-data/test
|
mkdir -p var/slave$slave_num-data/test
|
||||||
cp var/slave-data/mysql/* var/slave$slave_num-data/mysql
|
cp var/slave-data/mysql/* var/slave$slave_num-data/mysql
|
||||||
@ -1026,7 +1043,8 @@ run_testcase ()
|
|||||||
SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0`
|
SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0`
|
||||||
if [ x$SKIP_THIS_TEST = x1 ] ;
|
if [ x$SKIP_THIS_TEST = x1 ] ;
|
||||||
then
|
then
|
||||||
return;
|
skip_test $tname;
|
||||||
|
return;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1034,21 +1052,15 @@ run_testcase ()
|
|||||||
DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0`
|
DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0`
|
||||||
if [ x$DO_THIS_TEST = x0 ] ;
|
if [ x$DO_THIS_TEST = x0 ] ;
|
||||||
then
|
then
|
||||||
return;
|
skip_test $tname;
|
||||||
|
return;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ;
|
if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ;
|
||||||
then
|
then
|
||||||
USERT=" ...."
|
skip_test $tname;
|
||||||
SYST=" ...."
|
|
||||||
REALT=" ...."
|
|
||||||
timestr="$USERT $SYST $REALT"
|
|
||||||
pname=`$ECHO "$tname "|$CUT -c 1-24`
|
|
||||||
RES="$pname $timestr"
|
|
||||||
skip_inc
|
|
||||||
$ECHO "$RES$RES_SPACE [ skipped ]"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,4 +8,6 @@ drop table if exists t1;
|
|||||||
show slave status;
|
show slave status;
|
||||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||||
load table t1 from master;
|
load table t1 from master;
|
||||||
Error in fetch_master_table
|
Error connecting to master: Master is not configured
|
||||||
|
load table t1 from master;
|
||||||
|
Error from master: 'Table 'test.t1' doesn't exist'
|
||||||
|
@ -19,22 +19,24 @@ Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Lo
|
|||||||
slave start;
|
slave start;
|
||||||
show slave status;
|
show slave status;
|
||||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 Yes Yes 0 0 73 4
|
127.0.0.1 root MASTER_PORT 1 master-bin.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4
|
||||||
change master to master_log_pos=173;
|
change master to master_log_pos=173;
|
||||||
|
slave start;
|
||||||
show slave status;
|
show slave status;
|
||||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 173 slave-relay-bin.001 4 master-bin.001 Yes Yes 0 0 173 4
|
127.0.0.1 root MASTER_PORT 1 master-bin.001 173 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 173 4
|
||||||
show master status;
|
show master status;
|
||||||
File Position Binlog_do_db Binlog_ignore_db
|
File Position Binlog_do_db Binlog_ignore_db
|
||||||
master-bin.001 79
|
master-bin.001 79
|
||||||
create table if not exists foo(n int);
|
create table if not exists t1 (n int);
|
||||||
drop table if exists foo;
|
drop table if exists t1;
|
||||||
create table foo (n int);
|
create table t1 (n int);
|
||||||
insert into foo values (1),(2),(3);
|
insert into t1 values (1),(2),(3);
|
||||||
change master to master_log_pos=79;
|
change master to master_log_pos=79;
|
||||||
select * from foo;
|
slave start;
|
||||||
|
select * from t1;
|
||||||
n
|
n
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
drop table foo;
|
drop table t1;
|
@ -1,5 +1,11 @@
|
|||||||
source include/master-slave.inc;
|
source include/master-slave.inc;
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
show slave status;
|
show slave status;
|
||||||
|
#
|
||||||
|
# Load table should not succeed on the master as this is not a slave
|
||||||
|
#
|
||||||
--error 1218
|
--error 1218
|
||||||
load table t1 from master;
|
load table t1 from master;
|
||||||
|
connection slave;
|
||||||
|
--error 1188
|
||||||
|
load table t1 from master;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#
|
||||||
|
# Testing of setting slave to wrong log position with master_log_pos
|
||||||
|
#
|
||||||
source include/master-slave.inc;
|
source include/master-slave.inc;
|
||||||
show master status;
|
show master status;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
@ -12,24 +15,28 @@ change master to master_log_pos=73;
|
|||||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
||||||
show slave status;
|
show slave status;
|
||||||
slave start;
|
slave start;
|
||||||
|
sleep 2;
|
||||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
||||||
show slave status;
|
show slave status;
|
||||||
change master to master_log_pos=173;
|
change master to master_log_pos=173;
|
||||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
||||||
|
slave start;
|
||||||
|
sleep 2;
|
||||||
show slave status;
|
show slave status;
|
||||||
connection master;
|
connection master;
|
||||||
show master status;
|
show master status;
|
||||||
create table if not exists foo(n int);
|
create table if not exists t1 (n int);
|
||||||
drop table if exists foo;
|
drop table if exists t1;
|
||||||
create table foo (n int);
|
create table t1 (n int);
|
||||||
insert into foo values (1),(2),(3);
|
insert into t1 values (1),(2),(3);
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
connection slave;
|
connection slave;
|
||||||
change master to master_log_pos=79;
|
change master to master_log_pos=79;
|
||||||
|
slave start;
|
||||||
sync_with_master;
|
sync_with_master;
|
||||||
select * from foo;
|
select * from t1;
|
||||||
connection master;
|
connection master;
|
||||||
drop table foo;
|
drop table t1;
|
||||||
save_master_pos;
|
save_master_pos;
|
||||||
connection slave;
|
connection slave;
|
||||||
sync_with_master;
|
sync_with_master;
|
@ -392,8 +392,8 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
|
|||||||
if ((read_length=my_read(info->file,Buffer,(uint) length,info->myflags))
|
if ((read_length=my_read(info->file,Buffer,(uint) length,info->myflags))
|
||||||
!= (uint) length)
|
!= (uint) length)
|
||||||
{
|
{
|
||||||
info->error= read_length == (uint) -1 ? -1 :
|
info->error= (read_length == (uint) -1 ? -1 :
|
||||||
(int) (read_length+left_length);
|
(int) (read_length+left_length));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
Count-=length;
|
Count-=length;
|
||||||
@ -422,6 +422,7 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
|
|||||||
{
|
{
|
||||||
if (length != (uint) -1)
|
if (length != (uint) -1)
|
||||||
memcpy(Buffer,info->buffer,(size_t) length);
|
memcpy(Buffer,info->buffer,(size_t) length);
|
||||||
|
info->pos_in_file= pos_in_file;
|
||||||
info->error= length == (uint) -1 ? -1 : (int) (length+left_length);
|
info->error= length == (uint) -1 ? -1 : (int) (length+left_length);
|
||||||
info->read_pos=info->read_end=info->buffer;
|
info->read_pos=info->read_end=info->buffer;
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
@ -220,7 +220,7 @@ my_off_t my_b_filelength(IO_CACHE *info)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info->seek_not_done=0;
|
info->seek_not_done=1;
|
||||||
return my_seek(info->file,0L,MY_SEEK_END,MYF(0));
|
return my_seek(info->file,0L,MY_SEEK_END,MYF(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,8 @@ void thr_end_alarm(thr_alarm_t *alarmed)
|
|||||||
printf("Warning: Didn't find alarm %lx in queue of %d alarms\n",
|
printf("Warning: Didn't find alarm %lx in queue of %d alarms\n",
|
||||||
(long) *alarmed, alarm_queue.elements);
|
(long) *alarmed, alarm_queue.elements);
|
||||||
#endif
|
#endif
|
||||||
DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",*alarmed));
|
DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",
|
||||||
|
(long) *alarmed));
|
||||||
}
|
}
|
||||||
if (alarm_aborted && !alarm_queue.elements)
|
if (alarm_aborted && !alarm_queue.elements)
|
||||||
delete_queue(&alarm_queue);
|
delete_queue(&alarm_queue);
|
||||||
@ -244,8 +245,10 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
|||||||
{
|
{
|
||||||
sigset_t old_mask;
|
sigset_t old_mask;
|
||||||
ALARM *alarm_data;
|
ALARM *alarm_data;
|
||||||
DBUG_ENTER("process_alarm");
|
|
||||||
DBUG_PRINT("info",("sig: %d active alarms: %d",sig,alarm_queue.elements));
|
/*
|
||||||
|
This must be first as we can't call DBUG inside an alarm for a normal thread
|
||||||
|
*/
|
||||||
|
|
||||||
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
|
#if THR_SERVER_ALARM == THR_CLIENT_ALARM
|
||||||
if (!pthread_equal(pthread_self(),alarm_thread))
|
if (!pthread_equal(pthread_self(),alarm_thread))
|
||||||
@ -256,16 +259,19 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
|||||||
#ifdef DONT_REMEMBER_SIGNAL
|
#ifdef DONT_REMEMBER_SIGNAL
|
||||||
sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */
|
sigset(THR_CLIENT_ALARM,process_alarm); /* int. thread system calls */
|
||||||
#endif
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
#if defined(MAIN) && !defined(__bsdi__)
|
|
||||||
printf("process_alarm\n"); fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#ifndef USE_ALARM_THREAD
|
#ifndef USE_ALARM_THREAD
|
||||||
pthread_sigmask(SIG_SETMASK,&full_signal_set,&old_mask);
|
pthread_sigmask(SIG_SETMASK,&full_signal_set,&old_mask);
|
||||||
pthread_mutex_lock(&LOCK_alarm);
|
pthread_mutex_lock(&LOCK_alarm);
|
||||||
|
#endif
|
||||||
|
DBUG_ENTER("process_alarm");
|
||||||
|
DBUG_PRINT("info",("sig: %d active alarms: %d",sig,alarm_queue.elements));
|
||||||
|
|
||||||
|
#if defined(MAIN) && !defined(__bsdi__)
|
||||||
|
printf("process_alarm\n"); fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
if (alarm_queue.elements)
|
if (alarm_queue.elements)
|
||||||
{
|
{
|
||||||
@ -335,6 +341,7 @@ sig_handler process_alarm(int sig __attribute__((unused)))
|
|||||||
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
|
pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
|
||||||
#endif
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line)
|
|||||||
pthread_mutex_lock(&mp->global);
|
pthread_mutex_lock(&mp->global);
|
||||||
if (mp->count > 0 && pthread_equal(pthread_self(),mp->thread))
|
if (mp->count > 0 && pthread_equal(pthread_self(),mp->thread))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"safe_mutex: Trying to lock mutex at %s, line %d, when the mutex was already locked at %s, line %d\n",
|
fprintf(stderr,"safe_mutex: Trying to lock mutex at %s, line %d, when the mutex was already locked at %s, line %d in thread %s\n",
|
||||||
file,line,mp->file,mp->line);
|
file,line,mp->file, mp->line, my_thread_name());
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
@ -437,6 +437,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||||||
ulong data_len;
|
ulong data_len;
|
||||||
int result=0;
|
int result=0;
|
||||||
char buf[LOG_EVENT_HEADER_LEN];
|
char buf[LOG_EVENT_HEADER_LEN];
|
||||||
|
DBUG_ENTER("read_log_event");
|
||||||
|
|
||||||
if (log_lock)
|
if (log_lock)
|
||||||
pthread_mutex_lock(log_lock);
|
pthread_mutex_lock(log_lock);
|
||||||
@ -447,17 +448,18 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||||||
will know it can go into cond_wait to be woken up on the next
|
will know it can go into cond_wait to be woken up on the next
|
||||||
update to the log.
|
update to the log.
|
||||||
*/
|
*/
|
||||||
|
DBUG_PRINT("error",("file->error: %d", file->error));
|
||||||
if (!file->error)
|
if (!file->error)
|
||||||
result= LOG_READ_EOF;
|
result= LOG_READ_EOF;
|
||||||
else
|
else
|
||||||
result= (file->error > 0 ? LOG_READ_TRUNC: LOG_READ_IO);
|
result= (file->error > 0 ? LOG_READ_TRUNC : LOG_READ_IO);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
data_len= uint4korr(buf + EVENT_LEN_OFFSET);
|
data_len= uint4korr(buf + EVENT_LEN_OFFSET);
|
||||||
if (data_len < LOG_EVENT_HEADER_LEN ||
|
if (data_len < LOG_EVENT_HEADER_LEN ||
|
||||||
data_len > current_thd->variables.max_allowed_packet)
|
data_len > current_thd->variables.max_allowed_packet)
|
||||||
{
|
{
|
||||||
|
DBUG_PRINT("error",("data_len: %ld", data_len));
|
||||||
result= ((data_len < LOG_EVENT_HEADER_LEN) ? LOG_READ_BOGUS :
|
result= ((data_len < LOG_EVENT_HEADER_LEN) ? LOG_READ_BOGUS :
|
||||||
LOG_READ_TOO_LARGE);
|
LOG_READ_TOO_LARGE);
|
||||||
goto end;
|
goto end;
|
||||||
@ -469,8 +471,8 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||||||
if (packet->append(file, data_len))
|
if (packet->append(file, data_len))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Here we should never hit eof in a non-error condtion
|
Here we should never hit EOF in a non-error condition.
|
||||||
eof means we are reading the event partially, which should
|
EOF means we are reading the event partially, which should
|
||||||
never happen.
|
never happen.
|
||||||
*/
|
*/
|
||||||
result= file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO;
|
result= file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO;
|
||||||
@ -481,7 +483,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
|
|||||||
end:
|
end:
|
||||||
if (log_lock)
|
if (log_lock)
|
||||||
pthread_mutex_unlock(log_lock);
|
pthread_mutex_unlock(log_lock);
|
||||||
return result;
|
DBUG_RETURN(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MYSQL_CLIENT
|
#endif // MYSQL_CLIENT
|
||||||
|
@ -407,20 +407,23 @@ my_bool mc_mysql_reconnect(MYSQL *mysql)
|
|||||||
DBUG_ENTER("mc_mysql_reconnect");
|
DBUG_ENTER("mc_mysql_reconnect");
|
||||||
|
|
||||||
if (!mysql->reconnect)
|
if (!mysql->reconnect)
|
||||||
|
{
|
||||||
|
mysql->net.last_errno=CR_SERVER_GONE_ERROR;
|
||||||
|
strmov(mysql->net.last_error, ER(mysql->net.last_errno));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
}
|
||||||
mc_mysql_init(&tmp_mysql);
|
mc_mysql_init(&tmp_mysql);
|
||||||
tmp_mysql.options=mysql->options;
|
tmp_mysql.options=mysql->options;
|
||||||
if (!mc_mysql_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
|
if (!mc_mysql_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
|
||||||
mysql->db, mysql->port, mysql->unix_socket,
|
mysql->db, mysql->port, mysql->unix_socket,
|
||||||
mysql->client_flag, mysql->net.read_timeout))
|
mysql->client_flag, mysql->net.read_timeout))
|
||||||
{
|
{
|
||||||
tmp_mysql.reconnect=0;
|
#ifdef NOT_USED
|
||||||
mc_mysql_close(&tmp_mysql);
|
mysql->net.last_errno=CR_RECONNECT_FAILED;
|
||||||
mysql->net.last_errno=CR_SERVER_GONE_ERROR;
|
strmov(mysql->net.last_error, ER(mysql->net.last_errno));
|
||||||
strmov(mysql->net.last_error,ER(mysql->net.last_errno));
|
#endif
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
tmp_mysql.free_me=mysql->free_me;
|
tmp_mysql.free_me=mysql->free_me;
|
||||||
mysql->free_me=0;
|
mysql->free_me=0;
|
||||||
bzero((char*) &mysql->options,sizeof(&mysql->options));
|
bzero((char*) &mysql->options,sizeof(&mysql->options));
|
||||||
@ -443,11 +446,7 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command,
|
|||||||
if (mysql->net.vio == 0)
|
if (mysql->net.vio == 0)
|
||||||
{ /* Do reconnect if possible */
|
{ /* Do reconnect if possible */
|
||||||
if (mc_mysql_reconnect(mysql))
|
if (mc_mysql_reconnect(mysql))
|
||||||
{
|
|
||||||
net->last_errno=CR_SERVER_GONE_ERROR;
|
|
||||||
strmov(net->last_error,ER(net->last_errno));
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (mysql->status != MYSQL_STATUS_READY)
|
if (mysql->status != MYSQL_STATUS_READY)
|
||||||
{
|
{
|
||||||
@ -468,8 +467,9 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command,
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
|
DBUG_PRINT("error",("Can't send command to server. Error: %d",socket_errno));
|
||||||
mc_end_server(mysql);
|
mc_end_server(mysql);
|
||||||
if (mc_mysql_reconnect(mysql) ||
|
if (mc_mysql_reconnect(mysql))
|
||||||
net_write_command(net,(uchar) command,arg,
|
goto end;
|
||||||
|
if (net_write_command(net,(uchar) command,arg,
|
||||||
length ? length :(uint) strlen(arg)))
|
length ? length :(uint) strlen(arg)))
|
||||||
{
|
{
|
||||||
net->last_errno=CR_SERVER_GONE_ERROR;
|
net->last_errno=CR_SERVER_GONE_ERROR;
|
||||||
@ -515,8 +515,6 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
user ? user : "(Null)",
|
user ? user : "(Null)",
|
||||||
net_read_timeout,
|
net_read_timeout,
|
||||||
(uint) slave_net_timeout));
|
(uint) slave_net_timeout));
|
||||||
thr_alarm_init(&alarmed);
|
|
||||||
thr_alarm(&alarmed, net_read_timeout, &alarm_buff);
|
|
||||||
|
|
||||||
net->vio = 0; /* If something goes wrong */
|
net->vio = 0; /* If something goes wrong */
|
||||||
mysql->charset=default_charset_info; /* Set character set */
|
mysql->charset=default_charset_info; /* Set character set */
|
||||||
@ -527,6 +525,8 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
|
|
||||||
mysql->reconnect=1; /* Reconnect as default */
|
mysql->reconnect=1; /* Reconnect as default */
|
||||||
mysql->server_status=SERVER_STATUS_AUTOCOMMIT;
|
mysql->server_status=SERVER_STATUS_AUTOCOMMIT;
|
||||||
|
if (!mysql->options.connect_timeout)
|
||||||
|
mysql->options.connect_timeout= net_read_timeout;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Grab a socket and connect it to the server
|
** Grab a socket and connect it to the server
|
||||||
@ -598,7 +598,11 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
host=LOCAL_HOST;
|
host=LOCAL_HOST;
|
||||||
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
|
sprintf(host_info=buff,ER(CR_TCP_CONNECTION),host);
|
||||||
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
|
DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host,port));
|
||||||
if ((sock = (my_socket) socket(AF_INET,SOCK_STREAM,0)) == SOCKET_ERROR)
|
thr_alarm_init(&alarmed);
|
||||||
|
thr_alarm(&alarmed, net_read_timeout, &alarm_buff);
|
||||||
|
sock = (my_socket) socket(AF_INET,SOCK_STREAM,0);
|
||||||
|
thr_end_alarm(&alarmed);
|
||||||
|
if (sock == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
net->last_errno=CR_IPSOCK_ERROR;
|
net->last_errno=CR_IPSOCK_ERROR;
|
||||||
sprintf(net->last_error,ER(net->last_errno),socket_errno);
|
sprintf(net->last_error,ER(net->last_errno),socket_errno);
|
||||||
@ -641,12 +645,8 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
socket_errno,host));
|
socket_errno,host));
|
||||||
net->last_errno= CR_CONN_HOST_ERROR;
|
net->last_errno= CR_CONN_HOST_ERROR;
|
||||||
sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno);
|
sprintf(net->last_error ,ER(CR_CONN_HOST_ERROR), host, socket_errno);
|
||||||
if (thr_alarm_in_use(&alarmed))
|
|
||||||
thr_end_alarm(&alarmed);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (thr_alarm_in_use(&alarmed))
|
|
||||||
thr_end_alarm(&alarmed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!net->vio || my_net_init(net, net->vio))
|
if (!net->vio || my_net_init(net, net->vio))
|
||||||
@ -778,7 +778,11 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
if (client_flag & CLIENT_SSL)
|
if (client_flag & CLIENT_SSL)
|
||||||
{
|
{
|
||||||
if (my_net_write(net,buff,(uint) (2)) || net_flush(net))
|
if (my_net_write(net,buff,(uint) (2)) || net_flush(net))
|
||||||
|
{
|
||||||
|
net->last_errno= CR_SERVER_LOST;
|
||||||
|
strmov(net->last_error,ER(net->last_errno));
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
/* Do the SSL layering. */
|
/* Do the SSL layering. */
|
||||||
DBUG_PRINT("info", ("IO layer change in progress..."));
|
DBUG_PRINT("info", ("IO layer change in progress..."));
|
||||||
DBUG_PRINT("info", ("IO context %p",((struct st_VioSSLConnectorFd*)mysql->connector_fd)->ssl_context_));
|
DBUG_PRINT("info", ("IO context %p",((struct st_VioSSLConnectorFd*)mysql->connector_fd)->ssl_context_));
|
||||||
@ -808,8 +812,13 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
|||||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
mysql->db=my_strdup(db,MYF(MY_WME));
|
||||||
db=0;
|
db=0;
|
||||||
}
|
}
|
||||||
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net) ||
|
if (my_net_write(net,buff,(ulong) (end-buff)) || net_flush(net))
|
||||||
mc_net_safe_read(mysql) == packet_error)
|
{
|
||||||
|
net->last_errno= CR_SERVER_LOST;
|
||||||
|
strmov(net->last_error,ER(net->last_errno));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (mc_net_safe_read(mysql) == packet_error)
|
||||||
goto error;
|
goto error;
|
||||||
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
if (client_flag & CLIENT_COMPRESS) /* We will use compression */
|
||||||
net->compress=1;
|
net->compress=1;
|
||||||
|
@ -293,7 +293,7 @@ inline THD *_current_thd(void)
|
|||||||
|
|
||||||
int mysql_create_db(THD *thd, char *db, uint create_info, bool silent);
|
int mysql_create_db(THD *thd, char *db, uint create_info, bool silent);
|
||||||
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
|
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
|
||||||
void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags);
|
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
|
||||||
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists);
|
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists);
|
||||||
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||||
bool log_query);
|
bool log_query);
|
||||||
|
@ -787,9 +787,12 @@ static pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
|
|||||||
|
|
||||||
static sig_handler print_signal_warning(int sig)
|
static sig_handler print_signal_warning(int sig)
|
||||||
{
|
{
|
||||||
if (global_system_variables.log_warnings)
|
if (!DBUG_IN_USE)
|
||||||
sql_print_error("Warning: Got signal %d from thread %d",
|
{
|
||||||
sig,my_thread_id());
|
if (global_system_variables.log_warnings)
|
||||||
|
sql_print_error("Warning: Got signal %d from thread %d",
|
||||||
|
sig,my_thread_id());
|
||||||
|
}
|
||||||
#ifdef DONT_REMEMBER_SIGNAL
|
#ifdef DONT_REMEMBER_SIGNAL
|
||||||
sigset(sig,print_signal_warning); /* int. thread system calls */
|
sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||||
#endif
|
#endif
|
||||||
@ -1555,6 +1558,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
|
|||||||
(void) pthread_cond_signal(&COND_thread_count);
|
(void) pthread_cond_signal(&COND_thread_count);
|
||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
|
|
||||||
|
(void) pthread_sigmask(SIG_BLOCK,&set,NULL);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int error; // Used when debugging
|
int error; // Used when debugging
|
||||||
@ -1608,7 +1612,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
|
|||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
#ifdef EXTRA_DEBUG
|
#ifdef EXTRA_DEBUG
|
||||||
sql_print_error("Warning: Got signal: %d, error: %d",sig,error); /* purecov: tested */
|
sql_print_error("Warning: Got signal: %d error: %d",sig,error); /* purecov: tested */
|
||||||
#endif
|
#endif
|
||||||
break; /* purecov: tested */
|
break; /* purecov: tested */
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ void send_error(NET *net, uint sql_errno, const char *err)
|
|||||||
{
|
{
|
||||||
if (sql_errno)
|
if (sql_errno)
|
||||||
err=ER(sql_errno);
|
err=ER(sql_errno);
|
||||||
else if (!err)
|
else
|
||||||
{
|
{
|
||||||
if ((err=net->last_error)[0])
|
if ((err=net->last_error)[0])
|
||||||
sql_errno=net->last_errno;
|
sql_errno=net->last_errno;
|
||||||
|
@ -392,6 +392,9 @@ net_real_write(NET *net,const char *packet,ulong len)
|
|||||||
"%s: my_net_write: fcntl returned error %d, aborting thread\n",
|
"%s: my_net_write: fcntl returned error %d, aborting thread\n",
|
||||||
my_progname,vio_errno(net->vio));
|
my_progname,vio_errno(net->vio));
|
||||||
#endif /* EXTRA_DEBUG */
|
#endif /* EXTRA_DEBUG */
|
||||||
|
#ifdef MYSQL_SERVER
|
||||||
|
net->last_errno=ER_NET_ERROR_ON_WRITE;
|
||||||
|
#endif
|
||||||
net->error=2; /* Close socket */
|
net->error=2; /* Close socket */
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -140,41 +140,54 @@ void unregister_slave(THD* thd, bool only_mine, bool need_mutex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Register slave in 'slave_list' hash table
|
||||||
|
|
||||||
|
RETURN VALUES
|
||||||
|
0 ok
|
||||||
|
1 Error. Error message sent to client
|
||||||
|
*/
|
||||||
|
|
||||||
int register_slave(THD* thd, uchar* packet, uint packet_length)
|
int register_slave(THD* thd, uchar* packet, uint packet_length)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
SLAVE_INFO *si;
|
SLAVE_INFO *si;
|
||||||
int res = 1;
|
uchar *p= packet, *p_end= packet + packet_length;
|
||||||
uchar* p = packet, *p_end = packet + packet_length;
|
|
||||||
|
|
||||||
if (check_access(thd, REPL_SLAVE_ACL, any_db))
|
if (check_access(thd, REPL_SLAVE_ACL, any_db))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME))))
|
if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME))))
|
||||||
goto err;
|
goto err2;
|
||||||
|
|
||||||
thd->server_id = si->server_id = uint4korr(p);
|
thd->server_id= si->server_id= uint4korr(p);
|
||||||
p += 4;
|
p+= 4;
|
||||||
get_object(p,si->host);
|
get_object(p,si->host);
|
||||||
get_object(p,si->user);
|
get_object(p,si->user);
|
||||||
get_object(p,si->password);
|
get_object(p,si->password);
|
||||||
si->port = uint2korr(p);
|
if (p+10 > p_end)
|
||||||
|
goto err;
|
||||||
|
si->port= uint2korr(p);
|
||||||
p += 2;
|
p += 2;
|
||||||
si->rpl_recovery_rank = uint4korr(p);
|
si->rpl_recovery_rank= uint4korr(p);
|
||||||
p += 4;
|
p += 4;
|
||||||
if (!(si->master_id = uint4korr(p)))
|
if (!(si->master_id= uint4korr(p)))
|
||||||
si->master_id = server_id;
|
si->master_id= server_id;
|
||||||
si->thd = thd;
|
si->thd= thd;
|
||||||
pthread_mutex_lock(&LOCK_slave_list);
|
|
||||||
|
|
||||||
|
pthread_mutex_lock(&LOCK_slave_list);
|
||||||
unregister_slave(thd,0,0);
|
unregister_slave(thd,0,0);
|
||||||
res = hash_insert(&slave_list, (byte*) si);
|
res= hash_insert(&slave_list, (byte*) si);
|
||||||
pthread_mutex_unlock(&LOCK_slave_list);
|
pthread_mutex_unlock(&LOCK_slave_list);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (si)
|
my_free((gptr) si, MYF(MY_WME));
|
||||||
my_free((gptr) si, MYF(MY_WME));
|
my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave",
|
||||||
return res;
|
MYF(0));
|
||||||
|
err2:
|
||||||
|
send_error(&thd->net);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32* slave_list_key(SLAVE_INFO* si, uint* len,
|
static uint32* slave_list_key(SLAVE_INFO* si, uint* len,
|
||||||
@ -446,6 +459,7 @@ int update_slave_list(MYSQL* mysql)
|
|||||||
const char* error=0;
|
const char* error=0;
|
||||||
bool have_auth_info;
|
bool have_auth_info;
|
||||||
int port_ind;
|
int port_ind;
|
||||||
|
DBUG_ENTER("update_slave_list");
|
||||||
|
|
||||||
if (mc_mysql_query(mysql,"SHOW SLAVE HOSTS",0) ||
|
if (mc_mysql_query(mysql,"SHOW SLAVE HOSTS",0) ||
|
||||||
!(res = mc_mysql_store_result(mysql)))
|
!(res = mc_mysql_store_result(mysql)))
|
||||||
@ -506,10 +520,10 @@ err:
|
|||||||
mc_mysql_free_result(res);
|
mc_mysql_free_result(res);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
sql_print_error("Error updating slave list:",error);
|
sql_print_error("Error updating slave list: %s",error);
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -622,17 +636,13 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
|
|||||||
|
|
||||||
if (!mi->host || !*mi->host) /* empty host */
|
if (!mi->host || !*mi->host) /* empty host */
|
||||||
{
|
{
|
||||||
DBUG_PRINT("error",("empty hostname"));
|
strmov(mysql->net.last_error, "Master is not configured");
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
|
if (!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
|
||||||
mi->port, 0, 0,
|
mi->port, 0, 0,
|
||||||
slave_net_timeout))
|
slave_net_timeout))
|
||||||
{
|
|
||||||
sql_print_error("Connection to master failed: %s",
|
|
||||||
mc_mysql_error(mysql));
|
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,26 +659,26 @@ static inline void cleanup_mysql_results(MYSQL_RES* db_res,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline int fetch_db_tables(THD* thd, MYSQL* mysql, const char* db,
|
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 = mc_mysql_fetch_row(table_res); row;
|
for (row = mc_mysql_fetch_row(table_res); row;
|
||||||
row = mc_mysql_fetch_row(table_res))
|
row = mc_mysql_fetch_row(table_res))
|
||||||
{
|
{
|
||||||
TABLE_LIST table;
|
TABLE_LIST table;
|
||||||
const char* table_name = row[0];
|
const char* table_name= row[0];
|
||||||
int error;
|
int error;
|
||||||
if (table_rules_on)
|
if (table_rules_on)
|
||||||
{
|
{
|
||||||
table.next = 0;
|
table.next= 0;
|
||||||
table.db = (char*)db;
|
table.db= (char*) db;
|
||||||
table.real_name = (char*)table_name;
|
table.real_name= (char*) table_name;
|
||||||
table.updating = 1;
|
table.updating= 1;
|
||||||
if (!tables_ok(thd, &table))
|
if (!tables_ok(thd, &table))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((error = fetch_master_table(thd, db, table_name, mi, mysql)))
|
if ((error= fetch_master_table(thd, db, table_name, mi, mysql)))
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -709,7 +719,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->net, error = ER_CONNECT_TO_MASTER,
|
net_printf(&thd->net, error= ER_CONNECT_TO_MASTER,
|
||||||
mc_mysql_error(&mysql));
|
mc_mysql_error(&mysql));
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -246,3 +246,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -240,3 +240,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -247,3 +247,4 @@
|
|||||||
"Variabele '%-.64s' kan alleen worden gewijzigd, niet gelezen",
|
"Variabele '%-.64s' kan alleen worden gewijzigd, niet gelezen",
|
||||||
"Foutieve toepassing/plaatsing van '%s'",
|
"Foutieve toepassing/plaatsing van '%s'",
|
||||||
"Deze versie van MySQL ondersteunt nog geen '%s'",
|
"Deze versie van MySQL ondersteunt nog geen '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -237,3 +237,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -242,3 +242,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -237,3 +237,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -240,3 +240,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -237,3 +237,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -239,3 +239,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -237,3 +237,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -239,3 +239,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -237,3 +237,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -239,3 +239,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -239,3 +239,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -241,3 +241,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -237,3 +237,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -241,3 +241,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -240,3 +240,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -245,3 +245,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -238,3 +238,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -237,3 +237,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
@ -242,3 +242,4 @@
|
|||||||
"Variable '%-.64s' can only be set, not read",
|
"Variable '%-.64s' can only be set, not read",
|
||||||
"Wrong usage/placement of '%s'",
|
"Wrong usage/placement of '%s'",
|
||||||
"This version of MySQL doesn't yet support '%s'",
|
"This version of MySQL doesn't yet support '%s'",
|
||||||
|
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||||
|
161
sql/slave.cc
161
sql/slave.cc
@ -88,25 +88,16 @@ char* rewrite_db(char* db);
|
|||||||
restart these threads
|
restart these threads
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse)
|
void init_thread_mask(int* mask,MASTER_INFO* mi,bool inverse)
|
||||||
{
|
{
|
||||||
bool set_io = mi->slave_running, set_sql = mi->rli.slave_running;
|
bool set_io = mi->slave_running, set_sql = mi->rli.slave_running;
|
||||||
if (inverse)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
This makes me think of the Russian idiom "I am not I, and this is
|
|
||||||
not my horse", which is used to deny reponsibility for
|
|
||||||
one's actions.
|
|
||||||
*/
|
|
||||||
set_io = !set_io;
|
|
||||||
set_sql = !set_sql;
|
|
||||||
}
|
|
||||||
register int tmp_mask=0;
|
register int tmp_mask=0;
|
||||||
if (set_io)
|
if (set_io)
|
||||||
tmp_mask |= SLAVE_IO;
|
tmp_mask |= SLAVE_IO;
|
||||||
if (set_sql)
|
if (set_sql)
|
||||||
tmp_mask |= SLAVE_SQL;
|
tmp_mask |= SLAVE_SQL;
|
||||||
|
if (inverse)
|
||||||
|
tmp_mask^= (SLAVE_IO | SLAVE_SQL);
|
||||||
*mask = tmp_mask;
|
*mask = tmp_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,6 +371,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
|
|||||||
int error,force_all = (thread_mask & SLAVE_FORCE_ALL);
|
int error,force_all = (thread_mask & SLAVE_FORCE_ALL);
|
||||||
pthread_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock;
|
pthread_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock;
|
||||||
pthread_mutex_t *sql_cond_lock,*io_cond_lock;
|
pthread_mutex_t *sql_cond_lock,*io_cond_lock;
|
||||||
|
DBUG_ENTER("terminate_slave_threads");
|
||||||
|
|
||||||
sql_cond_lock=sql_lock;
|
sql_cond_lock=sql_lock;
|
||||||
io_cond_lock=io_lock;
|
io_cond_lock=io_lock;
|
||||||
@ -396,7 +388,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
|
|||||||
&mi->stop_cond,
|
&mi->stop_cond,
|
||||||
&mi->slave_running)) &&
|
&mi->slave_running)) &&
|
||||||
!force_all)
|
!force_all)
|
||||||
return error;
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) && mi->rli.slave_running)
|
if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) && mi->rli.slave_running)
|
||||||
{
|
{
|
||||||
@ -407,9 +399,9 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
|
|||||||
&mi->rli.stop_cond,
|
&mi->rli.stop_cond,
|
||||||
&mi->rli.slave_running)) &&
|
&mi->rli.slave_running)) &&
|
||||||
!force_all)
|
!force_all)
|
||||||
return error;
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -552,9 +544,13 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
|
|||||||
cond_io,&mi->slave_running,
|
cond_io,&mi->slave_running,
|
||||||
mi);
|
mi);
|
||||||
if (!error && (thread_mask & SLAVE_SQL))
|
if (!error && (thread_mask & SLAVE_SQL))
|
||||||
|
{
|
||||||
error=start_slave_thread(handle_slave_sql,lock_sql,lock_cond_sql,
|
error=start_slave_thread(handle_slave_sql,lock_sql,lock_cond_sql,
|
||||||
cond_sql,
|
cond_sql,
|
||||||
&mi->rli.slave_running,mi);
|
&mi->rli.slave_running,mi);
|
||||||
|
if (error)
|
||||||
|
terminate_slave_threads(mi, thread_mask & SLAVE_IO, 0);
|
||||||
|
}
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -958,54 +954,51 @@ err:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fetch_master_table(THD* thd, const char* db_name, const char* table_name,
|
int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
|
||||||
MASTER_INFO* mi, MYSQL* mysql)
|
MASTER_INFO *mi, MYSQL *mysql)
|
||||||
{
|
{
|
||||||
int error = 1;
|
int error= 1;
|
||||||
int fetch_errno = 0;
|
const char *errmsg=0;
|
||||||
bool called_connected = (mysql != NULL);
|
bool called_connected= (mysql != NULL);
|
||||||
if (!called_connected && !(mysql = mc_mysql_init(NULL)))
|
DBUG_ENTER("fetch_master_table");
|
||||||
{
|
DBUG_PRINT("enter", ("db_name: '%s' table_name: '%s'",
|
||||||
sql_print_error("fetch_master_table: Error in mysql_init()");
|
db_name,table_name));
|
||||||
fetch_errno = ER_GET_ERRNO;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!called_connected)
|
if (!called_connected)
|
||||||
{
|
{
|
||||||
|
if (!(mysql = mc_mysql_init(NULL)))
|
||||||
|
{
|
||||||
|
send_error(&thd->net); // EOM
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
}
|
||||||
if (connect_to_master(thd, mysql, mi))
|
if (connect_to_master(thd, mysql, mi))
|
||||||
{
|
{
|
||||||
sql_print_error("Could not connect to master while fetching table\
|
net_printf(&thd->net, ER_CONNECT_TO_MASTER, mc_mysql_error(mysql));
|
||||||
'%-64s.%-64s'", db_name, table_name);
|
mc_mysql_close(mysql);
|
||||||
fetch_errno = ER_CONNECT_TO_MASTER;
|
DBUG_RETURN(1);
|
||||||
goto err;
|
|
||||||
}
|
}
|
||||||
|
if (thd->killed)
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
if (thd->killed)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
if (request_table_dump(mysql, db_name, table_name))
|
if (request_table_dump(mysql, db_name, table_name))
|
||||||
{
|
{
|
||||||
fetch_errno = ER_GET_ERRNO;
|
error= ER_UNKNOWN_ERROR;
|
||||||
sql_print_error("fetch_master_table: failed on table dump request ");
|
errmsg= "Failed on table dump request";
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (create_table_from_dump(thd, &mysql->net, db_name,
|
if (create_table_from_dump(thd, &mysql->net, db_name,
|
||||||
table_name))
|
table_name))
|
||||||
{
|
goto err; // create_table_from_dump will have sent the error already
|
||||||
// create_table_from_dump will have sent the error alread
|
|
||||||
sql_print_error("fetch_master_table: failed on create table ");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
error = 0;
|
error = 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (mysql && !called_connected)
|
|
||||||
mc_mysql_close(mysql);
|
|
||||||
if (fetch_errno && thd->net.vio)
|
|
||||||
send_error(&thd->net, fetch_errno, "Error in fetch_master_table");
|
|
||||||
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
|
||||||
return error;
|
if (!called_connected)
|
||||||
|
mc_mysql_close(mysql);
|
||||||
|
if (errmsg && thd->net.vio)
|
||||||
|
send_error(&thd->net, error, errmsg);
|
||||||
|
DBUG_RETURN(test(error)); // Return 1 on error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1372,7 +1365,8 @@ int register_slave_on_master(MYSQL* mysql)
|
|||||||
if (mc_simple_command(mysql, COM_REGISTER_SLAVE, (char*)packet.ptr(),
|
if (mc_simple_command(mysql, COM_REGISTER_SLAVE, (char*)packet.ptr(),
|
||||||
packet.length(), 0))
|
packet.length(), 0))
|
||||||
{
|
{
|
||||||
sql_print_error("Error on COM_REGISTER_SLAVE: '%s'",
|
sql_print_error("Error on COM_REGISTER_SLAVE: %d '%s'",
|
||||||
|
mc_mysql_errno(mysql),
|
||||||
mc_mysql_error(mysql));
|
mc_mysql_error(mysql));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1471,22 +1465,21 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
|
|||||||
{
|
{
|
||||||
if (!inited)
|
if (!inited)
|
||||||
return -1;
|
return -1;
|
||||||
bool pos_reached = 0;
|
|
||||||
int event_count = 0;
|
int event_count = 0;
|
||||||
pthread_mutex_lock(&data_lock);
|
ulong init_abort_pos_wait;
|
||||||
abort_pos_wait=0; // abort only if master info changes during wait
|
DBUG_ENTER("wait_for_pos");
|
||||||
|
|
||||||
while (!thd->killed || !abort_pos_wait)
|
pthread_mutex_lock(&data_lock);
|
||||||
|
// abort only if master info changes during wait
|
||||||
|
init_abort_pos_wait= abort_pos_wait;
|
||||||
|
|
||||||
|
while (!thd->killed &&
|
||||||
|
init_abort_pos_wait == abort_pos_wait &&
|
||||||
|
mi->slave_running)
|
||||||
{
|
{
|
||||||
int cmp_result;
|
bool pos_reached;
|
||||||
if (abort_pos_wait)
|
int cmp_result= 0;
|
||||||
{
|
|
||||||
abort_pos_wait=0;
|
|
||||||
pthread_mutex_unlock(&data_lock);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
DBUG_ASSERT(*master_log_name || master_log_pos == 0);
|
DBUG_ASSERT(*master_log_name || master_log_pos == 0);
|
||||||
cmp_result = 0;
|
|
||||||
if (*master_log_name)
|
if (*master_log_name)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1512,7 +1505,13 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
|
|||||||
event_count++;
|
event_count++;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&data_lock);
|
pthread_mutex_unlock(&data_lock);
|
||||||
return thd->killed ? -1 : event_count;
|
DBUG_PRINT("exit",("killed: %d abort: %d slave_running: %d",
|
||||||
|
(int) thd->killed,
|
||||||
|
(int) (init_abort_pos_wait != abort_pos_wait),
|
||||||
|
(int) mi->slave_running));
|
||||||
|
DBUG_RETURN((thd->killed || init_abort_pos_wait != abort_pos_wait ||
|
||||||
|
!mi->slave_running) ?
|
||||||
|
-1 : event_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1564,28 +1563,23 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
|||||||
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
|
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
|
||||||
void* thread_killed_arg)
|
void* thread_killed_arg)
|
||||||
{
|
{
|
||||||
|
int nap_time;
|
||||||
thr_alarm_t alarmed;
|
thr_alarm_t alarmed;
|
||||||
thr_alarm_init(&alarmed);
|
thr_alarm_init(&alarmed);
|
||||||
time_t start_time= time((time_t*) 0);
|
time_t start_time= time((time_t*) 0);
|
||||||
time_t end_time= start_time+sec;
|
time_t end_time= start_time+sec;
|
||||||
ALARM alarm_buff;
|
|
||||||
|
|
||||||
while (start_time < end_time)
|
while ((nap_time= (int) (end_time - start_time)) > 0)
|
||||||
{
|
{
|
||||||
int nap_time = (int) (end_time - start_time);
|
ALARM alarm_buff;
|
||||||
/*
|
/*
|
||||||
The only reason we are asking for alarm is so that
|
The only reason we are asking for alarm is so that
|
||||||
we will be woken up in case of murder, so if we do not get killed,
|
we will be woken up in case of murder, so if we do not get killed,
|
||||||
set the alarm so it goes off after we wake up naturally
|
set the alarm so it goes off after we wake up naturally
|
||||||
*/
|
*/
|
||||||
thr_alarm(&alarmed, 2 * nap_time,&alarm_buff);
|
thr_alarm(&alarmed, 2 * nap_time, &alarm_buff);
|
||||||
sleep(nap_time);
|
sleep(nap_time);
|
||||||
/*
|
thr_end_alarm(&alarmed);
|
||||||
If we wake up before the alarm goes off, hit the button
|
|
||||||
so it will not wake up the wife and kids :-)
|
|
||||||
*/
|
|
||||||
if (thr_alarm_in_use(&alarmed))
|
|
||||||
thr_end_alarm(&alarmed);
|
|
||||||
|
|
||||||
if ((*thread_killed)(thd,thread_killed_arg))
|
if ((*thread_killed)(thd,thread_killed_arg))
|
||||||
return 1;
|
return 1;
|
||||||
@ -1594,6 +1588,7 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
|
static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
|
||||||
bool *suppress_warnings)
|
bool *suppress_warnings)
|
||||||
{
|
{
|
||||||
@ -1601,6 +1596,8 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
|
|||||||
int len;
|
int len;
|
||||||
int binlog_flags = 0; // for now
|
int binlog_flags = 0; // for now
|
||||||
char* logname = mi->master_log_name;
|
char* logname = mi->master_log_name;
|
||||||
|
DBUG_ENTER("request_dump");
|
||||||
|
|
||||||
// TODO if big log files: Change next to int8store()
|
// TODO if big log files: Change next to int8store()
|
||||||
int4store(buf, (longlong) mi->master_log_pos);
|
int4store(buf, (longlong) mi->master_log_pos);
|
||||||
int2store(buf + 4, binlog_flags);
|
int2store(buf + 4, binlog_flags);
|
||||||
@ -1617,12 +1614,13 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi,
|
|||||||
if (mc_mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
|
if (mc_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: %s, will retry in %d secs",
|
sql_print_error("Error on COM_BINLOG_DUMP: %d %s, will retry in %d secs",
|
||||||
mc_mysql_error(mysql), master_connect_retry);
|
mc_mysql_errno(mysql), mc_mysql_error(mysql),
|
||||||
return 1;
|
master_connect_retry);
|
||||||
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1895,6 +1893,7 @@ connected:
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBUG_PRINT("info",("Starting reading binary log from master"));
|
||||||
while (!io_slave_killed(thd,mi))
|
while (!io_slave_killed(thd,mi))
|
||||||
{
|
{
|
||||||
bool suppress_warnings= 0;
|
bool suppress_warnings= 0;
|
||||||
@ -1960,7 +1959,8 @@ after reconnect");
|
|||||||
|
|
||||||
if (event_len == packet_error)
|
if (event_len == packet_error)
|
||||||
{
|
{
|
||||||
if (mc_mysql_errno(mysql) == ER_NET_PACKET_TOO_LARGE)
|
uint mysql_error_number= mc_mysql_errno(mysql);
|
||||||
|
if (mysql_error_number == ER_NET_PACKET_TOO_LARGE)
|
||||||
{
|
{
|
||||||
sql_print_error("\
|
sql_print_error("\
|
||||||
Log entry on master is longer than max_allowed_packet (%ld) on \
|
Log entry on master is longer than max_allowed_packet (%ld) on \
|
||||||
@ -1969,7 +1969,12 @@ max_allowed_packet",
|
|||||||
thd->variables.max_allowed_packet);
|
thd->variables.max_allowed_packet);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
if (mysql_error_number == ER_MASTER_FATAL_ERROR_READING_BINLOG)
|
||||||
|
{
|
||||||
|
sql_print_error(ER(mysql_error_number), mysql_error_number,
|
||||||
|
mc_mysql_error(mysql));
|
||||||
|
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);
|
mc_end_server(mysql);
|
||||||
if (retry_count++)
|
if (retry_count++)
|
||||||
@ -2535,9 +2540,11 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
|
|||||||
suppress_warnings= 0;
|
suppress_warnings= 0;
|
||||||
sql_print_error("Slave I/O thread: error connecting to master \
|
sql_print_error("Slave I/O thread: error connecting to master \
|
||||||
'%s@%s:%d': \
|
'%s@%s:%d': \
|
||||||
Error: '%s' errno: %d retry-time: %d",mi->user,mi->host,mi->port,
|
Error: '%s' errno: %d retry-time: %d retries: %d",
|
||||||
|
mi->user,mi->host,mi->port,
|
||||||
mc_mysql_error(mysql), last_errno,
|
mc_mysql_error(mysql), last_errno,
|
||||||
mi->connect_retry);
|
mi->connect_retry,
|
||||||
|
master_retry_count);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
By default we try forever. The reason is that failure will trigger
|
By default we try forever. The reason is that failure will trigger
|
||||||
|
@ -152,6 +152,7 @@ typedef struct st_relay_log_info
|
|||||||
errors, and have been manually applied by DBA already.
|
errors, and have been manually applied by DBA already.
|
||||||
*/
|
*/
|
||||||
volatile uint32 slave_skip_counter;
|
volatile uint32 slave_skip_counter;
|
||||||
|
volatile ulong abort_pos_wait; /* Incremented on change master */
|
||||||
pthread_mutex_t log_space_lock;
|
pthread_mutex_t log_space_lock;
|
||||||
pthread_cond_t log_space_cond;
|
pthread_cond_t log_space_cond;
|
||||||
THD * sql_thd;
|
THD * sql_thd;
|
||||||
@ -165,13 +166,12 @@ typedef struct st_relay_log_info
|
|||||||
bool inited;
|
bool inited;
|
||||||
volatile bool abort_slave, slave_running;
|
volatile bool abort_slave, slave_running;
|
||||||
bool log_pos_current;
|
bool log_pos_current;
|
||||||
bool abort_pos_wait;
|
|
||||||
bool skip_log_purge;
|
bool skip_log_purge;
|
||||||
|
|
||||||
st_relay_log_info()
|
st_relay_log_info()
|
||||||
:info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0),
|
:info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0),
|
||||||
inited(0), abort_slave(0), slave_running(0), log_pos_current(0),
|
inited(0), abort_slave(0), slave_running(0), log_pos_current(0),
|
||||||
abort_pos_wait(0), skip_log_purge(0)
|
skip_log_purge(0)
|
||||||
{
|
{
|
||||||
relay_log_name[0] = master_log_name[0] = 0;
|
relay_log_name[0] = master_log_name[0] = 0;
|
||||||
bzero(&info_file,sizeof(info_file));
|
bzero(&info_file,sizeof(info_file));
|
||||||
|
@ -430,7 +430,7 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
|||||||
{
|
{
|
||||||
if (field->type() == FIELD_TYPE_TIMESTAMP)
|
if (field->type() == FIELD_TYPE_TIMESTAMP)
|
||||||
((Field_timestamp*) field)->set_time();
|
((Field_timestamp*) field)->set_time();
|
||||||
else
|
else if (field != table->next_number_field)
|
||||||
thd->cuted_fields++;
|
thd->cuted_fields++;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -889,9 +889,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
break;
|
break;
|
||||||
case COM_REGISTER_SLAVE:
|
case COM_REGISTER_SLAVE:
|
||||||
{
|
{
|
||||||
if (register_slave(thd, (uchar*)packet, packet_length))
|
if (!register_slave(thd, (uchar*)packet, packet_length))
|
||||||
send_error(&thd->net);
|
|
||||||
else
|
|
||||||
send_ok(&thd->net);
|
send_ok(&thd->net);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1077,6 +1075,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
ulong pos;
|
ulong pos;
|
||||||
ushort flags;
|
ushort flags;
|
||||||
uint32 slave_server_id;
|
uint32 slave_server_id;
|
||||||
|
/* TODO: The following has to be changed to an 8 byte integer */
|
||||||
pos = uint4korr(packet);
|
pos = uint4korr(packet);
|
||||||
flags = uint2korr(packet + 4);
|
flags = uint2korr(packet + 4);
|
||||||
pthread_mutex_lock(&LOCK_server_id);
|
pthread_mutex_lock(&LOCK_server_id);
|
||||||
@ -1084,7 +1083,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
kill_zombie_dump_threads(slave_server_id = uint4korr(packet+6));
|
kill_zombie_dump_threads(slave_server_id = uint4korr(packet+6));
|
||||||
thd->server_id = slave_server_id;
|
thd->server_id = slave_server_id;
|
||||||
pthread_mutex_unlock(&LOCK_server_id);
|
pthread_mutex_unlock(&LOCK_server_id);
|
||||||
mysql_binlog_send(thd, thd->strdup(packet + 10), pos, flags);
|
mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
|
||||||
unregister_slave(thd,1,1);
|
unregister_slave(thd,1,1);
|
||||||
// fake COM_QUIT -- if we get here, the thread needs to terminate
|
// fake COM_QUIT -- if we get here, the thread needs to terminate
|
||||||
error = TRUE;
|
error = TRUE;
|
||||||
|
@ -291,8 +291,12 @@ binlog purge"; break;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO: Clean up loop to only have one call to send_file()
|
||||||
|
*/
|
||||||
|
|
||||||
void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
|
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
|
||||||
|
ushort flags)
|
||||||
{
|
{
|
||||||
LOG_INFO linfo;
|
LOG_INFO linfo;
|
||||||
char *log_file_name = linfo.log_file_name;
|
char *log_file_name = linfo.log_file_name;
|
||||||
@ -307,12 +311,15 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
|
|||||||
int left_events = max_binlog_dump_events;
|
int left_events = max_binlog_dump_events;
|
||||||
#endif
|
#endif
|
||||||
DBUG_ENTER("mysql_binlog_send");
|
DBUG_ENTER("mysql_binlog_send");
|
||||||
|
DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos));
|
||||||
|
|
||||||
bzero((char*) &log,sizeof(log));
|
bzero((char*) &log,sizeof(log));
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
|
if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
|
||||||
{
|
{
|
||||||
errmsg = "Master failed COM_BINLOG_DUMP to test if slave can recover";
|
errmsg = "Master failed COM_BINLOG_DUMP to test if slave can recover";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -320,11 +327,13 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
|
|||||||
if (!mysql_bin_log.is_open())
|
if (!mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
errmsg = "Binary log is not open";
|
errmsg = "Binary log is not open";
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!server_id_supplied)
|
if (!server_id_supplied)
|
||||||
{
|
{
|
||||||
errmsg = "Misconfigured master - server id was not set";
|
errmsg = "Misconfigured master - server id was not set";
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,16 +349,20 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
|
|||||||
if (mysql_bin_log.find_log_pos(&linfo, name))
|
if (mysql_bin_log.find_log_pos(&linfo, name))
|
||||||
{
|
{
|
||||||
errmsg = "Could not find first log file name in binary log index file";
|
errmsg = "Could not find first log file name in binary log index file";
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0)
|
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0)
|
||||||
|
{
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
if (pos < 4)
|
if (pos < BIN_LOG_HEADER_SIZE || pos > my_b_filelength(&log))
|
||||||
{
|
{
|
||||||
errmsg= "Client requested master to start replication from \
|
errmsg= "Client requested master to start replication from \
|
||||||
impossible position";
|
impossible position";
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +378,10 @@ impossible position";
|
|||||||
{
|
{
|
||||||
// tell the client log name with a fake rotate_event
|
// tell the client log name with a fake rotate_event
|
||||||
if (fake_rotate_event(net, packet, log_file_name, &errmsg))
|
if (fake_rotate_event(net, packet, log_file_name, &errmsg))
|
||||||
|
{
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
packet->set("\0", 1);
|
packet->set("\0", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,12 +396,14 @@ impossible position";
|
|||||||
{
|
{
|
||||||
net_flush(net);
|
net_flush(net);
|
||||||
errmsg = "Debugging binlog dump abort";
|
errmsg = "Debugging binlog dump abort";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (my_net_write(net, (char*)packet->ptr(), packet->length()) )
|
if (my_net_write(net, (char*)packet->ptr(), packet->length()) )
|
||||||
{
|
{
|
||||||
errmsg = "Failed on my_net_write()";
|
errmsg = "Failed on my_net_write()";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("log event code %d",
|
DBUG_PRINT("info", ("log event code %d",
|
||||||
@ -395,6 +413,7 @@ impossible position";
|
|||||||
if (send_file(thd))
|
if (send_file(thd))
|
||||||
{
|
{
|
||||||
errmsg = "failed in send_file()";
|
errmsg = "failed in send_file()";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,6 +425,7 @@ impossible position";
|
|||||||
*/
|
*/
|
||||||
if (error != LOG_READ_EOF)
|
if (error != LOG_READ_EOF)
|
||||||
{
|
{
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case LOG_READ_BOGUS:
|
case LOG_READ_BOGUS:
|
||||||
errmsg = "bogus data in log event";
|
errmsg = "bogus data in log event";
|
||||||
@ -439,6 +459,7 @@ Increase max_allowed_packet on master";
|
|||||||
if (net_flush(net))
|
if (net_flush(net))
|
||||||
{
|
{
|
||||||
errmsg = "failed on net_flush()";
|
errmsg = "failed on net_flush()";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,8 +476,8 @@ Increase max_allowed_packet on master";
|
|||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
if (max_binlog_dump_events && !left_events--)
|
if (max_binlog_dump_events && !left_events--)
|
||||||
{
|
{
|
||||||
net_flush(net);
|
|
||||||
errmsg = "Debugging binlog dump abort";
|
errmsg = "Debugging binlog dump abort";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -465,9 +486,12 @@ Increase max_allowed_packet on master";
|
|||||||
No one will update the log while we are reading
|
No one will update the log while we are reading
|
||||||
now, but we'll be quick and just read one record
|
now, but we'll be quick and just read one record
|
||||||
|
|
||||||
To be able to handle EOF properly, we have to have the
|
TODO:
|
||||||
pthread_mutex_unlock() statements in the case statements.
|
Add an counter that is incremented for each time we update
|
||||||
|
the binary log. We can avoid the following read if the counter
|
||||||
|
has not been updated since last read.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pthread_mutex_lock(log_lock);
|
pthread_mutex_lock(log_lock);
|
||||||
switch (Log_event::read_log_event(&log, packet, (pthread_mutex_t*)0)) {
|
switch (Log_event::read_log_event(&log, packet, (pthread_mutex_t*)0)) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -494,6 +518,7 @@ Increase max_allowed_packet on master";
|
|||||||
if (my_net_write(net, (char*)packet->ptr(), packet->length()) )
|
if (my_net_write(net, (char*)packet->ptr(), packet->length()) )
|
||||||
{
|
{
|
||||||
errmsg = "Failed on my_net_write()";
|
errmsg = "Failed on my_net_write()";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,6 +527,7 @@ Increase max_allowed_packet on master";
|
|||||||
if (send_file(thd))
|
if (send_file(thd))
|
||||||
{
|
{
|
||||||
errmsg = "failed in send_file()";
|
errmsg = "failed in send_file()";
|
||||||
|
my_errno= ER_UNKNOWN_ERROR;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -515,6 +541,7 @@ Increase max_allowed_packet on master";
|
|||||||
if (fatal_error)
|
if (fatal_error)
|
||||||
{
|
{
|
||||||
errmsg = "error reading log entry";
|
errmsg = "error reading log entry";
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
log.error=0;
|
log.error=0;
|
||||||
@ -533,6 +560,7 @@ Increase max_allowed_packet on master";
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errmsg = "could not find next log";
|
errmsg = "could not find next log";
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,8 +574,10 @@ Increase max_allowed_packet on master";
|
|||||||
// otherwise the slave make get confused about the offset
|
// otherwise the slave make get confused about the offset
|
||||||
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0 ||
|
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0 ||
|
||||||
fake_rotate_event(net, packet, log_file_name, &errmsg))
|
fake_rotate_event(net, packet, log_file_name, &errmsg))
|
||||||
|
{
|
||||||
|
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
packet->length(0);
|
packet->length(0);
|
||||||
packet->append("\0",1);
|
packet->append("\0",1);
|
||||||
}
|
}
|
||||||
@ -836,7 +866,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
|||||||
mi->rli.master_log_pos=0;
|
mi->rli.master_log_pos=0;
|
||||||
|
|
||||||
pthread_mutex_lock(&mi->rli.data_lock);
|
pthread_mutex_lock(&mi->rli.data_lock);
|
||||||
mi->rli.abort_pos_wait = 1;
|
mi->rli.abort_pos_wait++;
|
||||||
pthread_cond_broadcast(&mi->data_cond);
|
pthread_cond_broadcast(&mi->data_cond);
|
||||||
pthread_mutex_unlock(&mi->rli.data_lock);
|
pthread_mutex_unlock(&mi->rli.data_lock);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user