Commit 1f1c4477 authored by jimw@mysql.com's avatar jimw@mysql.com

Merge mysql.com:/home/jimw/my/mysql-4.1-8866

into mysql.com:/home/jimw/my/mysql-4.1-clean
parents fc3c7d5f 9c86b351
...@@ -280,6 +280,7 @@ Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS, ...@@ -280,6 +280,7 @@ Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL, Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL,
Q_START_TIMER, Q_END_TIMER, Q_START_TIMER, Q_END_TIMER,
Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT,
Q_UNKNOWN, /* Unknown command. */ Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */ Q_COMMENT, /* Comments, ignored. */
...@@ -365,6 +366,8 @@ const char *command_names[]= ...@@ -365,6 +366,8 @@ const char *command_names[]=
"character_set", "character_set",
"disable_ps_protocol", "disable_ps_protocol",
"enable_ps_protocol", "enable_ps_protocol",
"disable_reconnect",
"enable_reconnect",
0 0
}; };
...@@ -3624,6 +3627,12 @@ int main(int argc, char **argv) ...@@ -3624,6 +3627,12 @@ int main(int argc, char **argv)
case Q_ENABLE_PS_PROTOCOL: case Q_ENABLE_PS_PROTOCOL:
ps_protocol_enabled= ps_protocol; ps_protocol_enabled= ps_protocol;
break; break;
case Q_DISABLE_RECONNECT:
cur_con->mysql.reconnect= 0;
break;
case Q_ENABLE_RECONNECT:
cur_con->mysql.reconnect= 1;
break;
default: processed = 0; break; default: processed = 0; break;
} }
......
...@@ -5,6 +5,14 @@ select ((@id := kill_id) - kill_id) from t1; ...@@ -5,6 +5,14 @@ select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0
kill @id; kill @id;
select 1;
ERROR HY000: MySQL server has gone away
select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id)
0
select @id != connection_id();
@id != connection_id()
1
select 4; select 4;
4 4
4 4
......
...@@ -23,12 +23,15 @@ connection con2; ...@@ -23,12 +23,15 @@ connection con2;
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
kill @id; kill @id;
# Wait for thread to do.
--sleep 5
# verify that con1 is doning a reconnect
connection con1; connection con1;
ping
ping --disable_reconnect
# this statement should fail
--error 2006
select 1;
--enable_reconnect
# this should work, and we should have a new connection_id()
select ((@id := kill_id) - kill_id) from t1;
select @id != connection_id(); select @id != connection_id();
#make sure the server is still alive #make sure the server is still alive
......
...@@ -2190,6 +2190,29 @@ my_bool mysql_reconnect(MYSQL *mysql) ...@@ -2190,6 +2190,29 @@ my_bool mysql_reconnect(MYSQL *mysql)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
tmp_mysql.free_me= mysql->free_me; tmp_mysql.free_me= mysql->free_me;
/*
For each stmt in mysql->stmts, move it to tmp_mysql if it is
in state MYSQL_STMT_INIT_DONE, otherwise close it.
*/
{
LIST *element= mysql->stmts;
for (; element; element= element->next)
{
MYSQL_STMT *stmt= (MYSQL_STMT *) element->data;
if (stmt->state != MYSQL_STMT_INIT_DONE)
{
stmt->mysql= 0;
}
else
{
tmp_mysql.stmts= list_add(tmp_mysql.stmts, &stmt->list);
}
/* No need to call list_delete for statement here */
}
mysql->stmts= NULL;
}
/* Don't free options as these are now used in tmp_mysql */ /* Don't free options as these are now used in tmp_mysql */
bzero((char*) &mysql->options,sizeof(mysql->options)); bzero((char*) &mysql->options,sizeof(mysql->options));
mysql->free_me=0; mysql->free_me=0;
...@@ -2278,6 +2301,10 @@ static void mysql_close_free(MYSQL *mysql) ...@@ -2278,6 +2301,10 @@ static void mysql_close_free(MYSQL *mysql)
SYNOPSYS SYNOPSYS
mysql_detach_stmt_list() mysql_detach_stmt_list()
stmt_list pointer to mysql->stmts stmt_list pointer to mysql->stmts
NOTE
There is similar code in mysql_reconnect(), so changes here
should also be reflected there.
*/ */
void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused))) void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment