Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
07df8fd4
Commit
07df8fd4
authored
Jan 29, 2007
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge pilot.mysql.com:/home/msvensson/mysql/bug22943/my50-bug22943
into pilot.mysql.com:/home/msvensson/mysql/mysql-5.0-maint
parents
84947802
007d170a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
72 additions
and
32 deletions
+72
-32
sql-common/client.c
sql-common/client.c
+7
-1
sql/mysql_priv.h
sql/mysql_priv.h
+3
-0
sql/mysqld.cc
sql/mysqld.cc
+2
-8
sql/net_serv.cc
sql/net_serv.cc
+25
-2
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+6
-3
sql/set_var.cc
sql/set_var.cc
+2
-2
sql/slave.cc
sql/slave.cc
+0
-1
sql/sql_parse.cc
sql/sql_parse.cc
+24
-12
sql/sql_repl.cc
sql/sql_repl.cc
+3
-3
No files found.
sql-common/client.c
View file @
07df8fd4
...
@@ -2044,11 +2044,17 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -2044,11 +2044,17 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
goto
error
;
goto
error
;
}
}
vio_keepalive
(
net
->
vio
,
TRUE
);
vio_keepalive
(
net
->
vio
,
TRUE
);
/* Override local client variables */
/* If user set read_timeout, let it override the default */
if
(
mysql
->
options
.
read_timeout
)
if
(
mysql
->
options
.
read_timeout
)
net
->
read_timeout
=
mysql
->
options
.
read_timeout
;
net
->
read_timeout
=
mysql
->
options
.
read_timeout
;
vio_timeout
(
net
->
vio
,
0
,
net
->
read_timeout
);
/* If user set write_timeout, let it override the default */
if
(
mysql
->
options
.
write_timeout
)
if
(
mysql
->
options
.
write_timeout
)
net
->
write_timeout
=
mysql
->
options
.
write_timeout
;
net
->
write_timeout
=
mysql
->
options
.
write_timeout
;
vio_timeout
(
net
->
vio
,
1
,
net
->
write_timeout
);
if
(
mysql
->
options
.
max_allowed_packet
)
if
(
mysql
->
options
.
max_allowed_packet
)
net
->
max_packet_size
=
mysql
->
options
.
max_allowed_packet
;
net
->
max_packet_size
=
mysql
->
options
.
max_allowed_packet
;
...
...
sql/mysql_priv.h
View file @
07df8fd4
...
@@ -89,6 +89,9 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query);
...
@@ -89,6 +89,9 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query);
bool
net_request_file
(
NET
*
net
,
const
char
*
fname
);
bool
net_request_file
(
NET
*
net
,
const
char
*
fname
);
char
*
query_table_status
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
char
*
query_table_status
(
THD
*
thd
,
const
char
*
db
,
const
char
*
table_name
);
void
net_set_write_timeout
(
NET
*
net
,
uint
timeout
);
void
net_set_read_timeout
(
NET
*
net
,
uint
timeout
);
#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
#define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
#define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
...
...
sql/mysqld.cc
View file @
07df8fd4
...
@@ -3886,10 +3886,9 @@ static bool read_init_file(char *file_name)
...
@@ -3886,10 +3886,9 @@ static bool read_init_file(char *file_name)
static
void
create_new_thread
(
THD
*
thd
)
static
void
create_new_thread
(
THD
*
thd
)
{
{
NET
*
net
=&
thd
->
net
;
DBUG_ENTER
(
"create_new_thread"
);
DBUG_ENTER
(
"create_new_thread"
);
NET
*
net
=&
thd
->
net
;
// For easy ref
net
->
read_timeout
=
(
uint
)
connect_timeout
;
if
(
protocol_version
>
9
)
if
(
protocol_version
>
9
)
net
->
return_errno
=
1
;
net
->
return_errno
=
1
;
...
@@ -4183,12 +4182,7 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
...
@@ -4183,12 +4182,7 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
}
}
if
(
sock
==
unix_sock
)
if
(
sock
==
unix_sock
)
thd
->
security_ctx
->
host
=
(
char
*
)
my_localhost
;
thd
->
security_ctx
->
host
=
(
char
*
)
my_localhost
;
#ifdef __WIN__
/* Set default wait_timeout */
ulong
wait_timeout
=
global_system_variables
.
net_wait_timeout
*
1000
;
(
void
)
setsockopt
(
new_sock
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
char
*
)
&
wait_timeout
,
sizeof
(
wait_timeout
));
#endif
create_new_thread
(
thd
);
create_new_thread
(
thd
);
}
}
...
...
sql/net_serv.cc
View file @
07df8fd4
...
@@ -606,7 +606,7 @@ net_real_write(NET *net,const char *packet,ulong len)
...
@@ -606,7 +606,7 @@ net_real_write(NET *net,const char *packet,ulong len)
thr_alarm
(
&
alarmed
,(
uint
)
net
->
write_timeout
,
&
alarm_buff
);
thr_alarm
(
&
alarmed
,(
uint
)
net
->
write_timeout
,
&
alarm_buff
);
#else
#else
alarmed
=
0
;
alarmed
=
0
;
vio_timeout
(
net
->
vio
,
1
,
net
->
write_timeout
);
/* Write timeout is set in net_set_write_timeout */
#endif
/* NO_ALARM */
#endif
/* NO_ALARM */
pos
=
(
char
*
)
packet
;
end
=
pos
+
len
;
pos
=
(
char
*
)
packet
;
end
=
pos
+
len
;
...
@@ -799,7 +799,7 @@ my_real_read(NET *net, ulong *complen)
...
@@ -799,7 +799,7 @@ my_real_read(NET *net, ulong *complen)
if
(
net_blocking
)
if
(
net_blocking
)
thr_alarm
(
&
alarmed
,
net
->
read_timeout
,
&
alarm_buff
);
thr_alarm
(
&
alarmed
,
net
->
read_timeout
,
&
alarm_buff
);
#else
#else
vio_timeout
(
net
->
vio
,
0
,
net
->
read_timeout
);
/* Read timeout is set in net_set_read_timeout */
#endif
/* NO_ALARM */
#endif
/* NO_ALARM */
pos
=
net
->
buff
+
net
->
where_b
;
/* net->packet -4 */
pos
=
net
->
buff
+
net
->
where_b
;
/* net->packet -4 */
...
@@ -1110,3 +1110,26 @@ my_net_read(NET *net)
...
@@ -1110,3 +1110,26 @@ my_net_read(NET *net)
return
len
;
return
len
;
}
}
void
net_set_read_timeout
(
NET
*
net
,
uint
timeout
)
{
DBUG_ENTER
(
"net_set_read_timeout"
);
DBUG_PRINT
(
"enter"
,
(
"timeout: %d"
,
timeout
));
net
->
read_timeout
=
timeout
;
#ifdef NO_ALARM
vio_timeout
(
net
->
vio
,
0
,
timeout
);
#endif
DBUG_VOID_RETURN
;
}
void
net_set_write_timeout
(
NET
*
net
,
uint
timeout
)
{
DBUG_ENTER
(
"net_set_write_timeout"
);
DBUG_PRINT
(
"enter"
,
(
"timeout: %d"
,
timeout
));
net
->
write_timeout
=
timeout
;
#ifdef NO_ALARM
vio_timeout
(
net
->
vio
,
1
,
timeout
);
#endif
DBUG_VOID_RETURN
;
}
sql/repl_failsafe.cc
View file @
07df8fd4
...
@@ -56,6 +56,7 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
...
@@ -56,6 +56,7 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
functions like register_slave()) are working.
functions like register_slave()) are working.
*/
*/
#if NOT_USED
static
int
init_failsafe_rpl_thread
(
THD
*
thd
)
static
int
init_failsafe_rpl_thread
(
THD
*
thd
)
{
{
DBUG_ENTER
(
"init_failsafe_rpl_thread"
);
DBUG_ENTER
(
"init_failsafe_rpl_thread"
);
...
@@ -96,7 +97,7 @@ static int init_failsafe_rpl_thread(THD* thd)
...
@@ -96,7 +97,7 @@ static int init_failsafe_rpl_thread(THD* thd)
thd
->
set_time
();
thd
->
set_time
();
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
#endif
void
change_rpl_status
(
RPL_STATUS
from_status
,
RPL_STATUS
to_status
)
void
change_rpl_status
(
RPL_STATUS
from_status
,
RPL_STATUS
to_status
)
{
{
...
@@ -570,12 +571,14 @@ err:
...
@@ -570,12 +571,14 @@ err:
}
}
#if NOT_USED
int
find_recovery_captain
(
THD
*
thd
,
MYSQL
*
mysql
)
int
find_recovery_captain
(
THD
*
thd
,
MYSQL
*
mysql
)
{
{
return
0
;
return
0
;
}
}
#endif
#if NOT_USED
pthread_handler_t
handle_failsafe_rpl
(
void
*
arg
)
pthread_handler_t
handle_failsafe_rpl
(
void
*
arg
)
{
{
DBUG_ENTER
(
"handle_failsafe_rpl"
);
DBUG_ENTER
(
"handle_failsafe_rpl"
);
...
@@ -623,7 +626,7 @@ err:
...
@@ -623,7 +626,7 @@ err:
pthread_exit
(
0
);
pthread_exit
(
0
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
#endif
bool
show_slave_hosts
(
THD
*
thd
)
bool
show_slave_hosts
(
THD
*
thd
)
{
{
...
...
sql/set_var.cc
View file @
07df8fd4
...
@@ -1273,14 +1273,14 @@ static int check_completion_type(THD *thd, set_var *var)
...
@@ -1273,14 +1273,14 @@ static int check_completion_type(THD *thd, set_var *var)
static
void
fix_net_read_timeout
(
THD
*
thd
,
enum_var_type
type
)
static
void
fix_net_read_timeout
(
THD
*
thd
,
enum_var_type
type
)
{
{
if
(
type
!=
OPT_GLOBAL
)
if
(
type
!=
OPT_GLOBAL
)
thd
->
net
.
read_timeout
=
thd
->
variables
.
net_read_timeout
;
net_set_read_timeout
(
&
thd
->
net
,
thd
->
variables
.
net_read_timeout
)
;
}
}
static
void
fix_net_write_timeout
(
THD
*
thd
,
enum_var_type
type
)
static
void
fix_net_write_timeout
(
THD
*
thd
,
enum_var_type
type
)
{
{
if
(
type
!=
OPT_GLOBAL
)
if
(
type
!=
OPT_GLOBAL
)
thd
->
net
.
write_timeout
=
thd
->
variables
.
net_write_timeout
;
net_set_write_timeout
(
&
thd
->
net
,
thd
->
variables
.
net_write_timeout
)
;
}
}
static
void
fix_net_retry_count
(
THD
*
thd
,
enum_var_type
type
)
static
void
fix_net_retry_count
(
THD
*
thd
,
enum_var_type
type
)
...
...
sql/slave.cc
View file @
07df8fd4
...
@@ -2901,7 +2901,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
...
@@ -2901,7 +2901,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
*/
*/
thd
->
variables
.
max_allowed_packet
=
global_system_variables
.
max_allowed_packet
thd
->
variables
.
max_allowed_packet
=
global_system_variables
.
max_allowed_packet
+
MAX_LOG_EVENT_HEADER
;
/* note, incr over the global not session var */
+
MAX_LOG_EVENT_HEADER
;
/* note, incr over the global not session var */
thd
->
net
.
read_timeout
=
slave_net_timeout
;
thd
->
slave_thread
=
1
;
thd
->
slave_thread
=
1
;
set_slave_thread_options
(
thd
);
set_slave_thread_options
(
thd
);
thd
->
client_capabilities
=
CLIENT_LOCAL_FILES
;
thd
->
client_capabilities
=
CLIENT_LOCAL_FILES
;
...
...
sql/sql_parse.cc
View file @
07df8fd4
...
@@ -965,7 +965,7 @@ static int check_connection(THD *thd)
...
@@ -965,7 +965,7 @@ static int check_connection(THD *thd)
return
(
ER_HANDSHAKE_ERROR
);
return
(
ER_HANDSHAKE_ERROR
);
}
}
DBUG_PRINT
(
"info"
,
(
"IO layer change in progress..."
));
DBUG_PRINT
(
"info"
,
(
"IO layer change in progress..."
));
if
(
sslaccept
(
ssl_acceptor_fd
,
net
->
vio
,
thd
->
variables
.
net_wait
_timeout
))
if
(
sslaccept
(
ssl_acceptor_fd
,
net
->
vio
,
net
->
read
_timeout
))
{
{
DBUG_PRINT
(
"error"
,
(
"Failed to accept new SSL connection"
));
DBUG_PRINT
(
"error"
,
(
"Failed to accept new SSL connection"
));
inc_host_errors
(
&
thd
->
remote
.
sin_addr
);
inc_host_errors
(
&
thd
->
remote
.
sin_addr
);
...
@@ -994,7 +994,6 @@ static int check_connection(THD *thd)
...
@@ -994,7 +994,6 @@ static int check_connection(THD *thd)
if
((
thd
->
client_capabilities
&
CLIENT_TRANSACTIONS
)
&&
if
((
thd
->
client_capabilities
&
CLIENT_TRANSACTIONS
)
&&
opt_using_transactions
)
opt_using_transactions
)
net
->
return_status
=
&
thd
->
server_status
;
net
->
return_status
=
&
thd
->
server_status
;
net
->
read_timeout
=
(
uint
)
thd
->
variables
.
net_read_timeout
;
char
*
user
=
end
;
char
*
user
=
end
;
char
*
passwd
=
strend
(
user
)
+
1
;
char
*
passwd
=
strend
(
user
)
+
1
;
...
@@ -1138,6 +1137,10 @@ pthread_handler_t handle_one_connection(void *arg)
...
@@ -1138,6 +1137,10 @@ pthread_handler_t handle_one_connection(void *arg)
Security_context
*
sctx
=
thd
->
security_ctx
;
Security_context
*
sctx
=
thd
->
security_ctx
;
net
->
no_send_error
=
0
;
net
->
no_send_error
=
0
;
/* Use "connect_timeout" value during connection phase */
net_set_read_timeout
(
net
,
connect_timeout
);
net_set_write_timeout
(
net
,
connect_timeout
);
if
((
error
=
check_connection
(
thd
)))
if
((
error
=
check_connection
(
thd
)))
{
// Wrong permissions
{
// Wrong permissions
if
(
error
>
0
)
if
(
error
>
0
)
...
@@ -1180,6 +1183,10 @@ pthread_handler_t handle_one_connection(void *arg)
...
@@ -1180,6 +1183,10 @@ pthread_handler_t handle_one_connection(void *arg)
thd
->
init_for_queries
();
thd
->
init_for_queries
();
}
}
/* Connect completed, set read/write timeouts back to tdefault */
net_set_read_timeout
(
net
,
thd
->
variables
.
net_read_timeout
);
net_set_write_timeout
(
net
,
thd
->
variables
.
net_write_timeout
);
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
while
(
!
net
->
error
&&
net
->
vio
!=
0
&&
!
(
thd
->
killed
==
THD
::
KILL_CONNECTION
))
!
(
thd
->
killed
==
THD
::
KILL_CONNECTION
))
{
{
...
@@ -1486,7 +1493,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
...
@@ -1486,7 +1493,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
/*
/*
Read one command from
socket
and execute it (query or simple command).
Read one command from
connection
and execute it (query or simple command).
This function is called in loop from thread function.
This function is called in loop from thread function.
SYNOPSIS
SYNOPSIS
do_command()
do_command()
...
@@ -1497,24 +1504,26 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
...
@@ -1497,24 +1504,26 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
bool
do_command
(
THD
*
thd
)
bool
do_command
(
THD
*
thd
)
{
{
char
*
packet
;
char
*
packet
=
0
;
uint
old_timeout
;
ulong
packet_length
;
ulong
packet_length
;
NET
*
net
;
NET
*
net
=
&
thd
->
net
;
enum
enum_server_command
command
;
enum
enum_server_command
command
;
DBUG_ENTER
(
"do_command"
);
DBUG_ENTER
(
"do_command"
);
net
=
&
thd
->
net
;
/*
/*
indicator of uninitialized lex => normal flow of errors handling
indicator of uninitialized lex => normal flow of errors handling
(see my_message_sql)
(see my_message_sql)
*/
*/
thd
->
lex
->
current_select
=
0
;
thd
->
lex
->
current_select
=
0
;
packet
=
0
;
/*
old_timeout
=
net
->
read_timeout
;
This thread will do a blocking read from the client which
/* Wait max for 8 hours */
will be interrupted when the next command is received from
net
->
read_timeout
=
(
uint
)
thd
->
variables
.
net_wait_timeout
;
the client, the connection is closed or "net_wait_timeout"
number of seconds has passed
*/
net_set_read_timeout
(
net
,
thd
->
variables
.
net_wait_timeout
);
thd
->
clear_error
();
// Clear error message
thd
->
clear_error
();
// Clear error message
net_new_transaction
(
net
);
net_new_transaction
(
net
);
...
@@ -1543,7 +1552,10 @@ bool do_command(THD *thd)
...
@@ -1543,7 +1552,10 @@ bool do_command(THD *thd)
vio_description
(
net
->
vio
),
command
,
vio_description
(
net
->
vio
),
command
,
command_name
[
command
]));
command_name
[
command
]));
}
}
net
->
read_timeout
=
old_timeout
;
// restore it
/* Restore read timeout value */
net_set_read_timeout
(
net
,
thd
->
variables
.
net_read_timeout
);
/*
/*
packet_length contains length of data, as it was stored in packet
packet_length contains length of data, as it was stored in packet
header. In case of malformed header, packet_length can be zero.
header. In case of malformed header, packet_length can be zero.
...
...
sql/sql_repl.cc
View file @
07df8fd4
...
@@ -91,8 +91,8 @@ static int send_file(THD *thd)
...
@@ -91,8 +91,8 @@ static int send_file(THD *thd)
The client might be slow loading the data, give him wait_timeout to do
The client might be slow loading the data, give him wait_timeout to do
the job
the job
*/
*/
old_timeout
=
thd
->
net
.
read_timeout
;
old_timeout
=
net
->
read_timeout
;
thd
->
net
.
read_timeout
=
thd
->
variables
.
net_wait_timeout
;
net_set_read_timeout
(
net
,
thd
->
variables
.
net_wait_timeout
)
;
/*
/*
We need net_flush here because the client will not know it needs to send
We need net_flush here because the client will not know it needs to send
...
@@ -136,7 +136,7 @@ static int send_file(THD *thd)
...
@@ -136,7 +136,7 @@ static int send_file(THD *thd)
error
=
0
;
error
=
0
;
err:
err:
thd
->
net
.
read_timeout
=
old_timeout
;
net_set_read_timeout
(
net
,
old_timeout
)
;
if
(
fd
>=
0
)
if
(
fd
>=
0
)
(
void
)
my_close
(
fd
,
MYF
(
0
));
(
void
)
my_close
(
fd
,
MYF
(
0
));
if
(
errmsg
)
if
(
errmsg
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment