Portability fixes (for binary build)
Added --protocol to mysqlbinlog client/mysql.cc: Indentation cleanup client/mysqlbinlog.cc: Added protocol option mysql-test/r/rpl_until.result: Update results mysql-test/t/rpl_until.test: If --sleep option was given then the salve could do many retries, which affected the size of the binary log. This is fixed by not comparing the binary log size/position sql/mysqld.cc: More debugging with set_maximum_open_files() vio/viosocket.c: Portability fix.
This commit is contained in:
parent
046b80bbeb
commit
91de6fdbce
@ -34,6 +34,7 @@ ulong server_id = 0;
|
|||||||
ulong bytes_sent = 0L, bytes_received = 0L;
|
ulong bytes_sent = 0L, bytes_received = 0L;
|
||||||
ulong mysqld_net_retry_count = 10L;
|
ulong mysqld_net_retry_count = 10L;
|
||||||
uint test_flags = 0;
|
uint test_flags = 0;
|
||||||
|
static uint opt_protocol= 0;
|
||||||
|
|
||||||
static FILE *result_file;
|
static FILE *result_file;
|
||||||
|
|
||||||
@ -233,6 +234,10 @@ static struct my_option my_long_options[] =
|
|||||||
{"position", 'j', "Start reading the binlog at position N.",
|
{"position", 'j', "Start reading the binlog at position N.",
|
||||||
(gptr*) &position, (gptr*) &position, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0,
|
(gptr*) &position, (gptr*) &position, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
|
{"protocol", OPT_MYSQL_PROTOCOL,
|
||||||
|
"The protocol of connection (tcp,socket,pipe,memory).",
|
||||||
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
|
||||||
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
|
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
|
||||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
|
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
|
||||||
@ -285,7 +290,7 @@ static void die(const char* fmt, ...)
|
|||||||
|
|
||||||
static void print_version()
|
static void print_version()
|
||||||
{
|
{
|
||||||
printf("%s Ver 2.4 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
printf("%s Ver 2.5 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -369,6 +374,17 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case 'R':
|
case 'R':
|
||||||
remote_opt= 1;
|
remote_opt= 1;
|
||||||
break;
|
break;
|
||||||
|
case OPT_MYSQL_PROTOCOL:
|
||||||
|
{
|
||||||
|
if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) ==
|
||||||
|
~(ulong) 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Unknown option to protocol: %s\n", argument);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version();
|
print_version();
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -401,6 +417,8 @@ static MYSQL* safe_connect()
|
|||||||
if (!local_mysql)
|
if (!local_mysql)
|
||||||
die("Failed on mysql_init");
|
die("Failed on mysql_init");
|
||||||
|
|
||||||
|
if (opt_protocol)
|
||||||
|
mysql_options(local_mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
|
||||||
if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
|
if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
|
||||||
die("failed on connect: %s", mysql_error(local_mysql));
|
die("failed on connect: %s", mysql_error(local_mysql));
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ n
|
|||||||
4
|
4
|
||||||
show slave status;
|
show slave status;
|
||||||
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244 649 Master master-no-such-bin.000001 291 No #
|
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244 # Master master-no-such-bin.000001 291 No #
|
||||||
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
|
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
|
||||||
select * from t2;
|
select * from t2;
|
||||||
n
|
n
|
||||||
@ -49,13 +49,13 @@ n
|
|||||||
2
|
2
|
||||||
show slave status;
|
show slave status;
|
||||||
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 449 649 Relay slave-relay-bin.000002 537 No #
|
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 449 # Relay slave-relay-bin.000002 537 No #
|
||||||
start slave;
|
start slave;
|
||||||
stop slave;
|
stop slave;
|
||||||
start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
||||||
show slave status;
|
show slave status;
|
||||||
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
Slave_IO_State 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 Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||||
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 561 693 Master master-bin.000001 561 No #
|
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 561 # Master master-bin.000001 561 No #
|
||||||
start slave until master_log_file='master-bin', master_log_pos=561;
|
start slave until master_log_file='master-bin', master_log_pos=561;
|
||||||
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
|
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
|
||||||
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
|
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
|
||||||
|
@ -38,7 +38,7 @@ start slave until master_log_file='master-no-such-bin.000001', master_log_pos=29
|
|||||||
select * from t1;
|
select * from t1;
|
||||||
sleep 2;
|
sleep 2;
|
||||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||||
--replace_column 1 # 9 # 33 #
|
--replace_column 1 # 9 # 23 # 33 #
|
||||||
show slave status;
|
show slave status;
|
||||||
|
|
||||||
# try replicate all until second insert to t2;
|
# try replicate all until second insert to t2;
|
||||||
@ -46,7 +46,7 @@ start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
|
|||||||
sleep 2;
|
sleep 2;
|
||||||
select * from t2;
|
select * from t2;
|
||||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||||
--replace_column 1 # 9 # 33 #
|
--replace_column 1 # 9 # 23 # 33 #
|
||||||
show slave status;
|
show slave status;
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
@ -62,7 +62,7 @@ start slave until master_log_file='master-bin.000001', master_log_pos=561;
|
|||||||
sleep 2;
|
sleep 2;
|
||||||
# here the sql slave thread should be stopped
|
# here the sql slave thread should be stopped
|
||||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||||
--replace_column 1 # 9 # 33 #
|
--replace_column 1 # 9 # 23 # 33 #
|
||||||
show slave status;
|
show slave status;
|
||||||
|
|
||||||
#testing various error conditions
|
#testing various error conditions
|
||||||
|
@ -5785,45 +5785,61 @@ static void fix_paths(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SET_RLIMIT_NOFILE
|
#ifdef SET_RLIMIT_NOFILE
|
||||||
|
|
||||||
|
#ifndef RLIM_INFINITY
|
||||||
|
#define RLIM_INFINITY ((uint) 0xffffffff)
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint set_maximum_open_files(uint max_file_limit)
|
static uint set_maximum_open_files(uint max_file_limit)
|
||||||
{
|
{
|
||||||
struct rlimit rlimit;
|
struct rlimit rlimit;
|
||||||
ulong old_cur;
|
uint old_cur;
|
||||||
|
DBUG_ENTER("set_maximum_open_files");
|
||||||
|
DBUG_PRINT("enter",("files: %u", max_file_limit));
|
||||||
|
|
||||||
if (!getrlimit(RLIMIT_NOFILE,&rlimit))
|
if (!getrlimit(RLIMIT_NOFILE,&rlimit))
|
||||||
{
|
{
|
||||||
old_cur=rlimit.rlim_cur;
|
old_cur= (uint) rlimit.rlim_cur;
|
||||||
if (rlimit.rlim_cur >= max_file_limit) // Nothing to do
|
DBUG_PRINT("info", ("rlim_cur: %u rlim_max: %u",
|
||||||
return rlimit.rlim_cur; /* purecov: inspected */
|
(uint) rlimit.rlim_cur,
|
||||||
|
(uint) rlimit.rlim_max));
|
||||||
|
if (rlimit.rlim_cur >= max_file_limit ||
|
||||||
|
rlimit.rlim_cur == RLIM_INFINITY)
|
||||||
|
DBUG_RETURN(rlimit.rlim_cur); /* purecov: inspected */
|
||||||
rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
|
rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
|
||||||
if (setrlimit(RLIMIT_NOFILE,&rlimit))
|
if (setrlimit(RLIMIT_NOFILE,&rlimit))
|
||||||
{
|
{
|
||||||
if (global_system_variables.log_warnings)
|
if (global_system_variables.log_warnings)
|
||||||
sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %lu (request: %u)",
|
sql_print_error("Warning: setrlimit couldn't increase number of open files to more than %u (request: %u)",
|
||||||
old_cur, max_file_limit); /* purecov: inspected */
|
old_cur, max_file_limit); /* purecov: inspected */
|
||||||
max_file_limit= old_cur;
|
max_file_limit= old_cur;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
rlimit.rlim_cur= 0; // Safety if next call fails
|
||||||
(void) getrlimit(RLIMIT_NOFILE,&rlimit);
|
(void) getrlimit(RLIMIT_NOFILE,&rlimit);
|
||||||
if ((uint) rlimit.rlim_cur != max_file_limit &&
|
DBUG_PRINT("info", ("rlim_cur: %u", (uint) rlimit.rlim_cur));
|
||||||
|
if ((uint) rlimit.rlim_cur < max_file_limit &&
|
||||||
global_system_variables.log_warnings)
|
global_system_variables.log_warnings)
|
||||||
sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)",
|
sql_print_error("Warning: setrlimit returned ok, but didn't change limits. Max open files is %u (request: %u)",
|
||||||
(ulong) rlimit.rlim_cur,
|
(uint) rlimit.rlim_cur,
|
||||||
max_file_limit); /* purecov: inspected */
|
max_file_limit); /* purecov: inspected */
|
||||||
max_file_limit=rlimit.rlim_cur;
|
max_file_limit= (uint) rlimit.rlim_cur;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return max_file_limit;
|
DBUG_PRINT("exit",("max_file_limit: %u", max_file_limit));
|
||||||
|
DBUG_RETURN(max_file_limit);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef OS2
|
#ifdef OS2
|
||||||
static uint set_maximum_open_files(uint max_file_limit)
|
static uint set_maximum_open_files(uint max_file_limit)
|
||||||
{
|
{
|
||||||
LONG cbReqCount;
|
LONG cbReqCount;
|
||||||
ULONG cbCurMaxFH, cbCurMaxFH0;
|
ULONG cbCurMaxFH, cbCurMaxFH0;
|
||||||
APIRET ulrc;
|
APIRET ulrc;
|
||||||
|
DBUG_ENTER("set_maximum_open_files");
|
||||||
|
|
||||||
// get current limit
|
// get current limit
|
||||||
cbReqCount = 0;
|
cbReqCount = 0;
|
||||||
@ -5838,10 +5854,11 @@ static uint set_maximum_open_files(uint max_file_limit)
|
|||||||
cbCurMaxFH = cbCurMaxFH0;
|
cbCurMaxFH = cbCurMaxFH0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cbCurMaxFH;
|
DBUG_RETURN(cbCurMaxFH);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return a bitfield from a string of substrings separated by ','
|
Return a bitfield from a string of substrings separated by ','
|
||||||
returns ~(ulong) 0 on error.
|
returns ~(ulong) 0 on error.
|
||||||
|
@ -249,8 +249,8 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_socket addrLen = sizeof(struct sockaddr);
|
size_socket addrLen = sizeof(vio->remote);
|
||||||
if (getpeername(vio->sd, (struct sockaddr *) (& (vio->remote)),
|
if (getpeername(vio->sd, (struct sockaddr *) (&vio->remote),
|
||||||
&addrLen) != 0)
|
&addrLen) != 0)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("exit", ("getpeername gave error: %d", socket_errno));
|
DBUG_PRINT("exit", ("getpeername gave error: %d", socket_errno));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user