From: Date: March 26 2005 4:49am Subject: bk commit into 5.0 tree (jimw:1.1840) BUG#8866 List-Archive: http://lists.mysql.com/internals/23385 X-Bug: 8866 Message-Id: <20050326034933.5C792A9405@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 5.0 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1840 05/03/25 19:49:29 jimw@stripped +4 -0 Fix reconnect when using prepared statements, and add --disable_reconnect and --enable_reconnect to mysqltest so that it can be tested properly. (Bug #8866) mysql-test/t/kill.test 1.11 05/03/25 19:49:26 jimw@stripped +7 -5 Use --disable_reconnect and --enable_reconnect so we can specifically test for both the reconnect flag being set either way, and eliminate unnecessary sleep and ping commands. mysql-test/r/kill.result 1.6 05/03/25 19:49:26 jimw@stripped +2 -0 Update results libmysql/libmysql.c 1.206 05/03/25 19:49:26 jimw@stripped +5 -0 Reset stmt->mysql after simple_command() is called, because it may change what mysql points to when it calls mysql_reconnect(). client/mysqltest.c 1.136 05/03/25 19:49:25 jimw@stripped +9 -11 Add support for --disable_reconnect and --enable_reconnect # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-5.0-8866 --- 1.205/libmysql/libmysql.c 2005-03-24 04:17:31 -08:00 +++ 1.206/libmysql/libmysql.c 2005-03-25 19:49:26 -08:00 @@ -2050,6 +2050,11 @@ mysql->net.sqlstate); DBUG_RETURN(1); } + /* + Reset stmt->mysql, since simple_command may have reset mysql due to + a reconnect. + */ + stmt->mysql= mysql; if ((*mysql->methods->read_prepare_result)(mysql, stmt)) { --- 1.135/client/mysqltest.c 2005-03-20 09:28:59 -08:00 +++ 1.136/client/mysqltest.c 2005-03-25 19:49:25 -08:00 @@ -294,6 +294,7 @@ Q_START_TIMER, Q_END_TIMER, Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_EXIT, +Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -382,6 +383,8 @@ "disable_ps_protocol", "enable_ps_protocol", "exit", + "disable_reconnect", + "enable_reconnect", 0 }; @@ -1695,11 +1698,6 @@ } sleep(CON_RETRY_SLEEP); } - /* - TODO: change this to 0 in future versions, but the 'kill' test relies on - existing behavior - */ - con->reconnect= 1; return con_error; } @@ -1794,12 +1792,6 @@ goto err; } - /* - TODO: change this to 0 in future versions, but the 'kill' test relies on - existing behavior - */ - con->reconnect= 1; - if (record) { if (!q->record_file[0] && !result_file) @@ -3898,6 +3890,12 @@ case Q_EXIT: abort_flag= 1; + 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; } --- 1.5/mysql-test/r/kill.result 2005-03-18 16:17:06 -08:00 +++ 1.6/mysql-test/r/kill.result 2005-03-25 19:49:26 -08:00 @@ -5,6 +5,8 @@ ((@id := kill_id) - kill_id) 0 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 --- 1.10/mysql-test/t/kill.test 2005-03-18 16:17:06 -08:00 +++ 1.11/mysql-test/t/kill.test 2005-03-25 19:49:26 -08:00 @@ -23,12 +23,14 @@ select ((@id := kill_id) - kill_id) from t1; kill @id; -# Wait for thread to do. ---sleep 5 -# verify that con1 is doning a reconnect +# verify automatic reconnect 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();