mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/home/mydev/mysql-5.0-bug15591
into mysql.com:/home/mydev/mysql-5.1-bug15591 mysql-test/mysql-test-run.sh: Auto merged sql/mysqld.cc: Bug#15591 - Occasional test suite abort due to port in use Manual merge.
This commit is contained in:
@ -1273,6 +1273,7 @@ start_master()
|
|||||||
--server-id=$id \
|
--server-id=$id \
|
||||||
--basedir=$MY_BASEDIR \
|
--basedir=$MY_BASEDIR \
|
||||||
--port=$this_master_myport \
|
--port=$this_master_myport \
|
||||||
|
--port-open-timeout=380 \
|
||||||
--local-infile \
|
--local-infile \
|
||||||
--exit-info=256 \
|
--exit-info=256 \
|
||||||
--core \
|
--core \
|
||||||
@ -1298,6 +1299,7 @@ start_master()
|
|||||||
--server-id=$id --rpl-recovery-rank=1 \
|
--server-id=$id --rpl-recovery-rank=1 \
|
||||||
--basedir=$MY_BASEDIR --init-rpl-role=master \
|
--basedir=$MY_BASEDIR --init-rpl-role=master \
|
||||||
--port=$this_master_myport \
|
--port=$this_master_myport \
|
||||||
|
--port-open-timeout=380 \
|
||||||
--local-infile \
|
--local-infile \
|
||||||
--datadir=$MASTER_MYDDIR$1 \
|
--datadir=$MASTER_MYDDIR$1 \
|
||||||
--pid-file=$MASTER_MYPID$1 \
|
--pid-file=$MASTER_MYPID$1 \
|
||||||
@ -1431,6 +1433,7 @@ start_slave()
|
|||||||
--datadir=$slave_datadir \
|
--datadir=$slave_datadir \
|
||||||
--pid-file=$slave_pid \
|
--pid-file=$slave_pid \
|
||||||
--port=$slave_port \
|
--port=$slave_port \
|
||||||
|
--port-open-timeout=380 \
|
||||||
--socket=$slave_sock \
|
--socket=$slave_sock \
|
||||||
--character-sets-dir=$CHARSETSDIR \
|
--character-sets-dir=$CHARSETSDIR \
|
||||||
--default-character-set=$CHARACTER_SET \
|
--default-character-set=$CHARACTER_SET \
|
||||||
|
@ -472,6 +472,7 @@ enum binlog_format opt_binlog_format_id= BF_UNSPECIFIED;
|
|||||||
static bool calling_initgroups= FALSE; /* Used in SIGSEGV handler. */
|
static bool calling_initgroups= FALSE; /* Used in SIGSEGV handler. */
|
||||||
#endif
|
#endif
|
||||||
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
|
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
|
||||||
|
uint mysqld_port_timeout;
|
||||||
uint delay_key_write_options, protocol_version;
|
uint delay_key_write_options, protocol_version;
|
||||||
uint lower_case_table_names;
|
uint lower_case_table_names;
|
||||||
uint tc_heuristic_recover= 0;
|
uint tc_heuristic_recover= 0;
|
||||||
@ -1445,7 +1446,12 @@ static void network_init(void)
|
|||||||
struct sockaddr_un UNIXaddr;
|
struct sockaddr_un UNIXaddr;
|
||||||
#endif
|
#endif
|
||||||
int arg=1;
|
int arg=1;
|
||||||
|
int ret;
|
||||||
|
uint waited;
|
||||||
|
uint this_wait;
|
||||||
|
uint retry;
|
||||||
DBUG_ENTER("network_init");
|
DBUG_ENTER("network_init");
|
||||||
|
LINT_INIT(ret);
|
||||||
|
|
||||||
set_ports();
|
set_ports();
|
||||||
|
|
||||||
@ -1471,8 +1477,26 @@ static void network_init(void)
|
|||||||
*/
|
*/
|
||||||
(void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg));
|
(void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg));
|
||||||
#endif /* __WIN__ */
|
#endif /* __WIN__ */
|
||||||
if (bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr),
|
/*
|
||||||
sizeof(IPaddr)) < 0)
|
Sometimes the port is not released fast enough when stopping and
|
||||||
|
restarting the server. This happens quite often with the test suite
|
||||||
|
on busy Linux systems. Retry to bind the address at these intervals:
|
||||||
|
Sleep intervals: 1, 2, 4, 6, 9, 13, 17, 22, ...
|
||||||
|
Retry at second: 1, 3, 7, 13, 22, 35, 52, 74, ...
|
||||||
|
Limit the sequence by mysqld_port_timeout (set --port-open-timeout=#).
|
||||||
|
*/
|
||||||
|
for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
|
||||||
|
{
|
||||||
|
if (((ret= bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr),
|
||||||
|
sizeof(IPaddr))) >= 0) ||
|
||||||
|
(socket_errno != EADDRINUSE) ||
|
||||||
|
(waited >= mysqld_port_timeout))
|
||||||
|
break;
|
||||||
|
sql_print_information("Retrying bind on TCP/IP port %u", mysqld_port);
|
||||||
|
this_wait= retry * retry / 3 + 1;
|
||||||
|
sleep(this_wait);
|
||||||
|
}
|
||||||
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("error",("Got error: %d from bind",socket_errno));
|
DBUG_PRINT("error",("Got error: %d from bind",socket_errno));
|
||||||
sql_perror("Can't start server: Bind on TCP/IP port");
|
sql_perror("Can't start server: Bind on TCP/IP port");
|
||||||
@ -4721,7 +4745,8 @@ enum options_mysqld
|
|||||||
OPT_OLD_STYLE_USER_LIMITS,
|
OPT_OLD_STYLE_USER_LIMITS,
|
||||||
OPT_LOG_SLOW_ADMIN_STATEMENTS,
|
OPT_LOG_SLOW_ADMIN_STATEMENTS,
|
||||||
OPT_TABLE_LOCK_WAIT_TIMEOUT,
|
OPT_TABLE_LOCK_WAIT_TIMEOUT,
|
||||||
OPT_PLUGIN_DIR
|
OPT_PLUGIN_DIR,
|
||||||
|
OPT_PORT_OPEN_TIMEOUT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -5334,6 +5359,10 @@ Disable with --skip-ndbcluster (will save memory).",
|
|||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"port", 'P', "Port number to use for connection.", (gptr*) &mysqld_port,
|
{"port", 'P', "Port number to use for connection.", (gptr*) &mysqld_port,
|
||||||
(gptr*) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
|
||||||
|
"Maximum time in seconds to wait for the port to become free. "
|
||||||
|
"(Default: no wait)", (gptr*) &mysqld_port_timeout,
|
||||||
|
(gptr*) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"relay-log", OPT_RELAY_LOG,
|
{"relay-log", OPT_RELAY_LOG,
|
||||||
"The location and name to use for relay logs.",
|
"The location and name to use for relay logs.",
|
||||||
(gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0,
|
(gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0,
|
||||||
|
Reference in New Issue
Block a user