mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Added usage of --master-retry-count to make mysql-test-run safer.
Build-tools/Do-compile: Remove --no-delete Docs/manual.texi: Udated IA64 section mysql-test/mysql-test-run.sh: Added usage of --master-retry-count set LD_LIBRARY_PATH sql/mysqld.cc: Added master-retry-count (needed by mysql-test-run) sql/slave.cc: Added master-retry-count Don't write same error to log on retry sql/slave.h: Added master-retry-count (needed by mysql-test-run)
This commit is contained in:
@ -4,10 +4,10 @@ use Getopt::Long;
|
|||||||
$opt_distribution=$opt_user=$opt_result=$opt_config_options=$opt_config_env="";
|
$opt_distribution=$opt_user=$opt_result=$opt_config_options=$opt_config_env="";
|
||||||
$opt_dbd_options=$opt_perl_options=$opt_suffix="";
|
$opt_dbd_options=$opt_perl_options=$opt_suffix="";
|
||||||
$opt_tmp=$version_suffix="";
|
$opt_tmp=$version_suffix="";
|
||||||
$opt_help=$opt_Information=$opt_no_delete=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0;
|
$opt_help=$opt_Information=$opt_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_no_mysqltest=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=0;
|
||||||
$opt_innodb=$opt_bdb=0;
|
$opt_innodb=$opt_bdb=0;
|
||||||
|
|
||||||
GetOptions("Information","help","distribution=s","user=s","result=s","no-delete","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip") || usage();
|
GetOptions("Information","help","distribution=s","user=s","result=s","delete","no-test","no-mysqltest","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s","tcpip","suffix=s","build-thread=i","innodb","bdb","use-old-distribution","enable-shared","no-crash-me","no-strip") || usage();
|
||||||
|
|
||||||
usage() if ($opt_help || $opt_Information);
|
usage() if ($opt_help || $opt_Information);
|
||||||
usage() if (!$opt_distribution);
|
usage() if (!$opt_distribution);
|
||||||
@ -143,7 +143,7 @@ if ($opt_stage <= 1)
|
|||||||
|
|
||||||
if ($opt_stage <= 2)
|
if ($opt_stage <= 2)
|
||||||
{
|
{
|
||||||
unlink($opt_distribution) if (!$opt_delete && !$opt_use_old_distribution);
|
unlink($opt_distribution) if ($opt_delete && !$opt_use_old_distribution);
|
||||||
safe_system("$make");
|
safe_system("$make");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10151,31 +10151,13 @@ work). You must also use the @code{egcs} C++ compiler
|
|||||||
@node Linux-IA64, , Linux-MIPS, Linux
|
@node Linux-IA64, , Linux-MIPS, Linux
|
||||||
@subsubsection Linux IA64 Notes
|
@subsubsection Linux IA64 Notes
|
||||||
|
|
||||||
To get MySQL to compile on Linux Ia64, we had to do the following
|
To get MySQL to compile on Linux Ia64, we use the following compile line:
|
||||||
(we assume that this will be easier when next gcc version for ia64 is
|
Using @code{gcc-2.96}:
|
||||||
released).
|
|
||||||
|
|
||||||
Using @code{gcc-2.9-final}:
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
CFLAGS="-O2" CXX=gcc CXXFLAGS="-O2 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
|
CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql "--with-comment=Official MySQL binary" --with-extra-charsets=complex
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
After @code{make} you will get an error that @code{sql/opt_range.cc}
|
|
||||||
will not compile (internal compiler error). To fix this, go to the sql
|
|
||||||
directory and type @code{make} again. Copy the compile line, but change
|
|
||||||
-O2 to -O0. The file should now compile.
|
|
||||||
|
|
||||||
Now you can do:
|
|
||||||
|
|
||||||
@example
|
|
||||||
cd ..
|
|
||||||
make
|
|
||||||
make_install
|
|
||||||
@end example
|
|
||||||
|
|
||||||
and @code{mysqld} should be ready to run.
|
|
||||||
|
|
||||||
On Ia64 the MySQL client binaries are using shared libraries. This means
|
On Ia64 the MySQL client binaries are using shared libraries. This means
|
||||||
that if you install our binary distribution in some other place than
|
that if you install our binary distribution in some other place than
|
||||||
@file{/usr/local/mysql} you need to either modify @file{/etc/ld.so.conf}
|
@file{/usr/local/mysql} you need to either modify @file{/etc/ld.so.conf}
|
||||||
|
@ -113,6 +113,11 @@ SLAVE_LOAD_TMPDIR=../../var/tmp #needs to be same length to test logging
|
|||||||
RES_SPACE=" "
|
RES_SPACE=" "
|
||||||
MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
|
MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
|
||||||
myisammrg heap sql"
|
myisammrg heap sql"
|
||||||
|
#
|
||||||
|
# Set LD_LIBRARY_PATH if we are using shared libraries
|
||||||
|
#
|
||||||
|
LD_LIBRARY_PATH="$BASEDIR/lib:$LD_LIBRARY_PATH"
|
||||||
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
MASTER_RUNNING=0
|
MASTER_RUNNING=0
|
||||||
MASTER_MYPORT=9306
|
MASTER_MYPORT=9306
|
||||||
@ -574,17 +579,18 @@ start_slave()
|
|||||||
slave_args="--no-defaults $master_info \
|
slave_args="--no-defaults $master_info \
|
||||||
--exit-info=256 \
|
--exit-info=256 \
|
||||||
--log-bin=slave-bin --log-slave-updates \
|
--log-bin=slave-bin --log-slave-updates \
|
||||||
|
--log=$SLAVE_MYLOG \
|
||||||
--basedir=$MY_BASEDIR \
|
--basedir=$MY_BASEDIR \
|
||||||
--datadir=$SLAVE_MYDDIR \
|
--datadir=$SLAVE_MYDDIR \
|
||||||
--pid-file=$SLAVE_MYPID \
|
--pid-file=$SLAVE_MYPID \
|
||||||
--port=$SLAVE_MYPORT \
|
--port=$SLAVE_MYPORT \
|
||||||
--socket=$SLAVE_MYSOCK \
|
--socket=$SLAVE_MYSOCK \
|
||||||
--log=$SLAVE_MYLOG \
|
|
||||||
--character-sets-dir=$CHARSETSDIR \
|
--character-sets-dir=$CHARSETSDIR \
|
||||||
--core \
|
--core \
|
||||||
--tmpdir=$MYSQL_TMP_DIR \
|
--tmpdir=$MYSQL_TMP_DIR \
|
||||||
--language=$LANGUAGE \
|
--language=$LANGUAGE \
|
||||||
--skip-innodb --skip-slave-start \
|
--skip-innodb --skip-slave-start \
|
||||||
|
--master-retry-count=5 \
|
||||||
$SMALL_SERVER \
|
$SMALL_SERVER \
|
||||||
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
|
$EXTRA_SLAVE_OPT $EXTRA_SLAVE_MYSQLD_OPT"
|
||||||
if [ x$DO_DDD = x1 ]
|
if [ x$DO_DDD = x1 ]
|
||||||
|
@ -276,7 +276,7 @@ const char *localhost=LOCAL_HOST;
|
|||||||
const char *delayed_user="DELAYED";
|
const char *delayed_user="DELAYED";
|
||||||
uint master_port = MYSQL_PORT, master_connect_retry = 60;
|
uint master_port = MYSQL_PORT, master_connect_retry = 60;
|
||||||
|
|
||||||
ulong max_tmp_tables,max_heap_table_size;
|
ulong max_tmp_tables,max_heap_table_size,master_retry_count=0;
|
||||||
ulong bytes_sent = 0L, bytes_received = 0L;
|
ulong bytes_sent = 0L, bytes_received = 0L;
|
||||||
|
|
||||||
bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory;
|
bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory;
|
||||||
@ -2534,6 +2534,7 @@ enum options {
|
|||||||
OPT_MASTER_HOST, OPT_MASTER_USER,
|
OPT_MASTER_HOST, OPT_MASTER_USER,
|
||||||
OPT_MASTER_PASSWORD, OPT_MASTER_PORT,
|
OPT_MASTER_PASSWORD, OPT_MASTER_PORT,
|
||||||
OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY,
|
OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY,
|
||||||
|
OPT_MASTER_RETRY_COUNT,
|
||||||
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
|
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
|
||||||
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
|
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
|
||||||
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB,
|
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB,
|
||||||
@ -2635,6 +2636,7 @@ static struct option long_options[] = {
|
|||||||
{"master-password", required_argument, 0, (int) OPT_MASTER_PASSWORD},
|
{"master-password", required_argument, 0, (int) OPT_MASTER_PASSWORD},
|
||||||
{"master-port", required_argument, 0, (int) OPT_MASTER_PORT},
|
{"master-port", required_argument, 0, (int) OPT_MASTER_PORT},
|
||||||
{"master-connect-retry", required_argument, 0, (int) OPT_MASTER_CONNECT_RETRY},
|
{"master-connect-retry", required_argument, 0, (int) OPT_MASTER_CONNECT_RETRY},
|
||||||
|
{"master-retry-count", required_argument, 0, (int) OPT_MASTER_RETRY_COUNT},
|
||||||
{"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE},
|
{"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE},
|
||||||
{"myisam-recover", optional_argument, 0, (int) OPT_MYISAM_RECOVER},
|
{"myisam-recover", optional_argument, 0, (int) OPT_MYISAM_RECOVER},
|
||||||
{"memlock", no_argument, 0, (int) OPT_MEMLOCK},
|
{"memlock", no_argument, 0, (int) OPT_MEMLOCK},
|
||||||
@ -3859,6 +3861,9 @@ static void get_options(int argc,char **argv)
|
|||||||
case OPT_MASTER_CONNECT_RETRY:
|
case OPT_MASTER_CONNECT_RETRY:
|
||||||
master_connect_retry= atoi(optarg);
|
master_connect_retry= atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case OPT_MASTER_RETRY_COUNT:
|
||||||
|
master_retry_count= atoi(optarg);
|
||||||
|
break;
|
||||||
case OPT_SAFE_SHOW_DB:
|
case OPT_SAFE_SHOW_DB:
|
||||||
opt_safe_show_db=1;
|
opt_safe_show_db=1;
|
||||||
break;
|
break;
|
||||||
|
49
sql/slave.cc
49
sql/slave.cc
@ -504,7 +504,7 @@ int init_master_info(MASTER_INFO* mi)
|
|||||||
if (master_user)
|
if (master_user)
|
||||||
strmake(mi->user, master_user, sizeof(mi->user) - 1);
|
strmake(mi->user, master_user, sizeof(mi->user) - 1);
|
||||||
if (master_password)
|
if (master_password)
|
||||||
strmake(mi->password, master_password, sizeof(mi->password) - 1);
|
strmake(mi->password, master_password, HASH_PASSWORD_LENGTH);
|
||||||
mi->port = master_port;
|
mi->port = master_port;
|
||||||
mi->connect_retry = master_connect_retry;
|
mi->connect_retry = master_connect_retry;
|
||||||
}
|
}
|
||||||
@ -543,7 +543,7 @@ int init_master_info(MASTER_INFO* mi)
|
|||||||
master_host) ||
|
master_host) ||
|
||||||
init_strvar_from_file(mi->user, sizeof(mi->user), &mi->file,
|
init_strvar_from_file(mi->user, sizeof(mi->user), &mi->file,
|
||||||
master_user) ||
|
master_user) ||
|
||||||
init_strvar_from_file(mi->password, sizeof(mi->password), &mi->file,
|
init_strvar_from_file(mi->password, HASH_PASSWORD_LENGTH+1, &mi->file,
|
||||||
master_password) ||
|
master_password) ||
|
||||||
init_intvar_from_file((int*)&mi->port, &mi->file, master_port) ||
|
init_intvar_from_file((int*)&mi->port, &mi->file, master_port) ||
|
||||||
init_intvar_from_file((int*)&mi->connect_retry, &mi->file,
|
init_intvar_from_file((int*)&mi->connect_retry, &mi->file,
|
||||||
@ -927,7 +927,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
|
|||||||
(actual_error = thd->net.last_errno) && expected_error)
|
(actual_error = thd->net.last_errno) && expected_error)
|
||||||
{
|
{
|
||||||
const char* errmsg = "Slave: did not get the expected error\
|
const char* errmsg = "Slave: did not get the expected error\
|
||||||
running query from master - expected: '%s'(%d), got '%s'(%d)";
|
running query from master - expected: '%s' (%d), got '%s' (%d)";
|
||||||
sql_print_error(errmsg, ER_SAFE(expected_error),
|
sql_print_error(errmsg, ER_SAFE(expected_error),
|
||||||
expected_error,
|
expected_error,
|
||||||
actual_error ? thd->net.last_error:"no error",
|
actual_error ? thd->net.last_error:"no error",
|
||||||
@ -1435,7 +1435,7 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
|
|||||||
!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
|
!mc_mysql_connect(mysql, mi->host, mi->user, mi->password, 0,
|
||||||
mi->port, 0, 0))
|
mi->port, 0, 0))
|
||||||
{
|
{
|
||||||
sql_print_error("Slave thread: error connecting to master:%s(%d),\
|
sql_print_error("Slave thread: error connecting to master: %s (%d),\
|
||||||
retry in %d sec", mc_mysql_error(mysql), errno, mi->connect_retry);
|
retry in %d sec", mc_mysql_error(mysql), errno, mi->connect_retry);
|
||||||
safe_sleep(thd, mi->connect_retry);
|
safe_sleep(thd, mi->connect_retry);
|
||||||
}
|
}
|
||||||
@ -1452,38 +1452,55 @@ static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
|
|||||||
return slave_was_killed;
|
return slave_was_killed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to connect until successful or slave killed */
|
/*
|
||||||
|
Try to connect until successful or slave killed or we have retried
|
||||||
|
master_retry_count times
|
||||||
|
*/
|
||||||
|
|
||||||
static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
|
static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
|
||||||
{
|
{
|
||||||
int slave_was_killed;
|
int slave_was_killed;
|
||||||
|
int last_errno= -2; // impossible error
|
||||||
|
ulong err_count=0;
|
||||||
char llbuff[22];
|
char llbuff[22];
|
||||||
|
|
||||||
// if we lost connection after reading a state set event
|
/*
|
||||||
// we will be re-reading it, so pending needs to be cleared
|
If we lost connection after reading a state set event
|
||||||
|
we will be re-reading it, so pending needs to be cleared
|
||||||
|
*/
|
||||||
mi->pending = 0;
|
mi->pending = 0;
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
events_till_disconnect = disconnect_slave_event_count;
|
events_till_disconnect = disconnect_slave_event_count;
|
||||||
#endif
|
#endif
|
||||||
while(!(slave_was_killed = slave_killed(thd)) && mc_mysql_reconnect(mysql))
|
while (!(slave_was_killed = slave_killed(thd)) && mc_mysql_reconnect(mysql))
|
||||||
{
|
{
|
||||||
sql_print_error("Slave thread: error re-connecting to master:\
|
/* Don't repeat last error */
|
||||||
|
if (mc_mysql_errno(mysql) != last_errno)
|
||||||
|
{
|
||||||
|
sql_print_error("Slave thread: error re-connecting to master: \
|
||||||
%s, last_errno=%d, retry in %d sec",
|
%s, last_errno=%d, retry in %d sec",
|
||||||
mc_mysql_error(mysql), errno, mi->connect_retry);
|
mc_mysql_error(mysql), last_errno=mc_mysql_errno(mysql),
|
||||||
safe_sleep(thd, mi->connect_retry);
|
mi->connect_retry);
|
||||||
|
safe_sleep(thd, mi->connect_retry);
|
||||||
|
}
|
||||||
|
if (err_count++ == master_retry_count)
|
||||||
|
{
|
||||||
|
slave_was_killed=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!slave_was_killed)
|
if (!slave_was_killed)
|
||||||
{
|
{
|
||||||
sql_print_error("Slave: reconnected to master '%s@%s:%d',\
|
sql_print_error("Slave: reconnected to master '%s@%s:%d',\
|
||||||
replication resumed in log '%s' at position %s", glob_mi.user,
|
replication resumed in log '%s' at position %s", glob_mi.user,
|
||||||
glob_mi.host, glob_mi.port,
|
glob_mi.host, glob_mi.port,
|
||||||
RPL_LOG_NAME,
|
RPL_LOG_NAME,
|
||||||
llstr(glob_mi.pos,llbuff));
|
llstr(glob_mi.pos,llbuff));
|
||||||
#ifdef SIGNAL_WITH_VIO_CLOSE
|
#ifdef SIGNAL_WITH_VIO_CLOSE
|
||||||
thd->set_active_vio(mysql->net.vio);
|
thd->set_active_vio(mysql->net.vio);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return slave_was_killed;
|
return slave_was_killed;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define SLAVE_NET_TIMEOUT 3600
|
#define SLAVE_NET_TIMEOUT 3600
|
||||||
|
|
||||||
extern ulong slave_net_timeout;
|
extern ulong slave_net_timeout, master_retry_count;
|
||||||
|
|
||||||
typedef struct st_master_info
|
typedef struct st_master_info
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user