As stmt->state was set to MYSQL_STMT_PREPARE_DONE value in mysql_stmt_execute_immediate(), the code did reconnect but did not send commend after the reconnect.
The fix is skipping stmt argument of cli_advanced_command() when it is invoked from cli_stmt_execute_immediate.
As well there was error in mysql_stmt_close(). The function used to send COM_STMT_SEND command to server, and as there is no valid statement ID for queries sent with mysql_stmt_execute_immediate(), the server returned error. The bug was fixed with checking statement ID for "undefined" value which is 0 as statement ID's begin with 1 (see THD::statement_id_counter, THD and Prepared_statement constructors). The "udefined" statement ID is set in mysql_stmt_execute_immediate().
After fixing these two bugs the number of failed tests ran with '--binary-protocol' option decreased dramatically. Here is the list:
> The "reconnect" bug.
The issue was in this code:
my_bool command( MYSQL *mysql, enum enum_server_command command,
MYSQL_STMT *stmt) INIT_DONE : FALSE; reconnect( mysql) || stmt_skip) RETURN( 1);
cli_advanced_
const uchar *header, ulong header_length,
const uchar *arg, ulong arg_length, my_bool skip_check,
{
...
my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_
...
if (mysql->net.vio == 0)
{ /* Do reconnect if possible */
if (mysql_
DBUG_
}
...
}
As stmt->state was set to MYSQL_STMT_ PREPARE_ DONE value in mysql_stmt_ execute_ immediate( ), the code did reconnect but did not send commend after the reconnect.
The fix is skipping stmt argument of cli_advanced_ command( ) when it is invoked from cli_stmt_ execute_ immediate.
As well there was error in mysql_stmt_close(). The function used to send COM_STMT_SEND command to server, and as there is no valid statement ID for queries sent with mysql_stmt_ execute_ immediate( ), the server returned error. The bug was fixed with checking statement ID for "undefined" value which is 0 as statement ID's begin with 1 (see THD::statement_ id_counter, THD and Prepared_statement constructors). The "udefined" statement ID is set in mysql_stmt_ execute_ immediate( ).
After fixing these two bugs the number of failed tests ran with '--binary-protocol' option decreased dramatically. Here is the list:
main. mysql_binary_ mode query_cache_ ps_no_prot nesting rpl_err_ ignoredtable 'row'
main.parser
main.
perfschema.
rpl.
(http:// jenkins. percona. com/view/ PS%205. 6/job/percona- server- 5.6-param/ 709)