Code review comment for lp:~vlad-lesin/percona-server/5.6-binary-answer

Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

> The "reconnect" bug.

The issue was in this code:

my_bool
cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
       const uchar *header, ulong header_length,
       const uchar *arg, ulong arg_length, my_bool skip_check,
                     MYSQL_STMT *stmt)
{
...
  my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE;
...
  if (mysql->net.vio == 0)
  { /* Do reconnect if possible */
    if (mysql_reconnect(mysql) || stmt_skip)
      DBUG_RETURN(1);
  }
...
}

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
    main.parser
    main.query_cache_ps_no_prot
    perfschema.nesting
    rpl.rpl_err_ignoredtable 'row'

(http://jenkins.percona.com/view/PS%205.6/job/percona-server-5.6-param/709)

« Back to merge proposal